Simple debug drawing support inside the implicit solver.

This commit is contained in:
Lukas Tönne 2014-09-19 16:52:49 +02:00
parent 14bd99b0f3
commit e5ae13b809
3 changed files with 14 additions and 0 deletions

@ -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;
}

@ -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]);

@ -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])