Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2014-09-19 18:52:49 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2015-01-20 11:30:02 +0300
commite5ae13b809df309569878d2c36f85b695aaf0992 (patch)
tree9dc064de0d5578305573b3fd454271a5923682c7 /source/blender/physics
parent14bd99b0f3f89312004520f644b663b584b081bd (diff)
Simple debug drawing support inside the implicit solver.
Diffstat (limited to 'source/blender/physics')
-rw-r--r--source/blender/physics/intern/BPH_mass_spring.cpp4
-rw-r--r--source/blender/physics/intern/implicit.h3
-rw-r--r--source/blender/physics/intern/implicit_blender.c7
3 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/physics/intern/BPH_mass_spring.cpp b/source/blender/physics/intern/BPH_mass_spring.cpp
index 56de54e4192..2700f4a0f6d 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 ea9a5b8211a..ac2c942379b 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 3994f0b340e..84db552d2ff 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])