[Bf-blender-cvs] [48e207a] temp_merge_gooseberry_hair: Simple debug drawing support inside the implicit solver.

Lukas Tönne noreply at git.blender.org
Mon Jan 19 20:49:30 CET 2015


Commit: 48e207a490aab8f600fd1368fba49d654b490135
Author: Lukas Tönne
Date:   Fri Sep 19 16:52:49 2014 +0200
Branches: temp_merge_gooseberry_hair
https://developer.blender.org/rB48e207a490aab8f600fd1368fba49d654b490135

Simple debug drawing support inside the implicit solver.

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

M	source/blender/physics/intern/BPH_mass_spring.cpp
M	source/blender/physics/intern/implicit.h
M	source/blender/physics/intern/implicit_blender.c

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

diff --git a/source/blender/physics/intern/BPH_mass_spring.cpp b/source/blender/physics/intern/BPH_mass_spring.cpp
index 56de54e..2700f4a 100644
--- a/source/blender/physics/intern/BPH_mass_spring.cpp
+++ b/source/blender/physics/intern/BPH_mass_spring.cpp
@@ -542,6 +542,8 @@ int BPH_cloth_solve(Object *ob, float frame, ClothModifierData *clmd, ListBase *
 	ColliderContacts *contacts = NULL;
 	int totcolliders = 0;
 	
+	BPH_mass_spring_solver_debug_data(id, clmd->debug_data);
+	
 	BKE_sim_debug_data_clear_category(clmd->debug_data, "collision");
 	
 	if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) { /* do goal stuff */
@@ -632,5 +634,7 @@ int BPH_cloth_solve(Object *ob, float frame, ClothModifierData *clmd, ListBase *
 		copy_v3_v3(verts[i].txold, verts[i].x);
 	}
 	
+	BPH_mass_spring_solver_debug_data(id, NULL);
+	
 	return 1;
 }
diff --git a/source/blender/physics/intern/implicit.h b/source/blender/physics/intern/implicit.h
index ea9a5b8..ac2c942 100644
--- a/source/blender/physics/intern/implicit.h
+++ b/source/blender/physics/intern/implicit.h
@@ -59,6 +59,7 @@ extern "C" {
 //#define IMPLICIT_ENABLE_EIGEN_DEBUG
 
 struct Implicit_Data;
+struct SimDebugData;
 
 BLI_INLINE void implicit_print_matrix_elem(float v)
 {
@@ -100,6 +101,8 @@ BLI_INLINE int hash_collpair(int type, CollPair *collpair)
 }
 /* ================ */
 
+void BPH_mass_spring_solver_debug_data(struct Implicit_Data *id, struct SimDebugData *debug_data);
+
 void BPH_mass_spring_set_rest_transform(struct Implicit_Data *data, int index, float rot[3][3]);
 
 void BPH_mass_spring_set_motion_state(struct Implicit_Data *data, int index, const float x[3], const float v[3]);
diff --git a/source/blender/physics/intern/implicit_blender.c b/source/blender/physics/intern/implicit_blender.c
index 3994f0b..84db552 100644
--- a/source/blender/physics/intern/implicit_blender.c
+++ b/source/blender/physics/intern/implicit_blender.c
@@ -669,6 +669,8 @@ typedef struct Implicit_Data  {
 	lfVector *z;				/* target velocity in constrained directions */
 	fmatrix3x3 *S;				/* filtering matrix for constraints */
 	fmatrix3x3 *P, *Pinv;		/* pre-conditioning matrix */
+	
+	struct SimDebugData *debug_data;
 } Implicit_Data;
 
 Implicit_Data *BPH_mass_spring_solver_create(int numverts, int numsprings)
@@ -723,6 +725,11 @@ void BPH_mass_spring_solver_free(Implicit_Data *id)
 	MEM_freeN(id);
 }
 
+void BPH_mass_spring_solver_debug_data(Implicit_Data *id, struct SimDebugData *debug_data)
+{
+	id->debug_data = debug_data;
+}
+
 /* ==== Transformation from/to root reference frames ==== */
 
 BLI_INLINE void world_to_root_v3(Implicit_Data *data, int index, float r[3], const float v[3])




More information about the Bf-blender-cvs mailing list