[Bf-blender-cvs] [a7ea968] hair_system: Create hair threads in a separate function.

Lukas Tönne noreply at git.blender.org
Sun Aug 24 18:55:03 CEST 2014


Commit: a7ea968246f08a5451bd98985efe6f8d8b384132
Author: Lukas Tönne
Date:   Sun Aug 24 15:38:45 2014 +0200
Branches: hair_system
https://developer.blender.org/rBa7ea968246f08a5451bd98985efe6f8d8b384132

Create hair threads in a separate function.

===================================================================

M	source/blender/hair/intern/HAIR_solver.cpp
M	source/blender/hair/intern/HAIR_solver.h

===================================================================

diff --git a/source/blender/hair/intern/HAIR_solver.cpp b/source/blender/hair/intern/HAIR_solver.cpp
index e4720a2..bb64efd 100644
--- a/source/blender/hair/intern/HAIR_solver.cpp
+++ b/source/blender/hair/intern/HAIR_solver.cpp
@@ -637,21 +637,8 @@ static void advance_state(SolverData *data)
 	}
 }
 
-void Solver::step_threaded(float time, float timestep)
+void Solver::create_step_tasks(float time, float timestep, const PointContactCache &contacts)
 {
-	/* filter and cache Bullet contact information */
-	PointContactCache contacts;
-	cache_point_contacts(contacts);
-	
-	if (Debug::active) {
-		for (int i = 0; i < contacts.size(); ++i) {
-			const PointContactInfo &info = contacts[i];
-			Debug::line(info.world_point_hair, info.world_point_body, 0.6, 0.6, 0.6, hash_int_2d(2347, i));
-			Debug::dot(info.world_point_hair, 0, 1, 0, hash_int_2d(2348, i));
-			Debug::dot(info.world_point_body, 1, 0, 0, hash_int_2d(2349, i));
-		}
-	}
-	
 	typedef std::vector<SolverTaskData> SolverTaskVector;
 	
 	const int max_points_per_task = 1024;
@@ -715,6 +702,24 @@ void Solver::step_threaded(float time, float timestep)
 	BLI_task_pool_work_and_wait(task_pool);
 	
 	BLI_task_pool_free(task_pool);
+}
+
+void Solver::step_threaded(float time, float timestep)
+{
+	/* filter and cache Bullet contact information */
+	PointContactCache contacts;
+	cache_point_contacts(contacts);
+	
+	if (Debug::active) {
+		for (int i = 0; i < contacts.size(); ++i) {
+			const PointContactInfo &info = contacts[i];
+			Debug::line(info.world_point_hair, info.world_point_body, 0.6, 0.6, 0.6, hash_int_2d(2347, i));
+			Debug::dot(info.world_point_hair, 0, 1, 0, hash_int_2d(2348, i));
+			Debug::dot(info.world_point_body, 1, 0, 0, hash_int_2d(2349, i));
+		}
+	}
+	
+	create_step_tasks(time, timestep, contacts);
 	
 	advance_state(m_data);
 }
diff --git a/source/blender/hair/intern/HAIR_solver.h b/source/blender/hair/intern/HAIR_solver.h
index 6ec4f5d..a5f5cc5 100644
--- a/source/blender/hair/intern/HAIR_solver.h
+++ b/source/blender/hair/intern/HAIR_solver.h
@@ -169,6 +169,9 @@ public:
 	
 	void step_threaded(float time, float timestep);
 	
+protected:
+	void create_step_tasks(float time, float timestep, const PointContactCache &contacts);
+	
 private:
 	HairParams m_params;
 	SolverForces m_forces;




More information about the Bf-blender-cvs mailing list