Commit: 81f898f053d277a704c58031a56c261b974c36e2
Author: Campbell Barton
Date:   Sat Dec 1 08:17:00 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB81f898f053d277a704c58031a56c261b974c36e2

Merge branch 'master' into blender2.8

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



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

diff --cc source/blender/physics/intern/BPH_mass_spring.cpp
index d43ce37cbfe,1b8b05ac752..111d5c5b68f
--- a/source/blender/physics/intern/BPH_mass_spring.cpp
+++ b/source/blender/physics/intern/BPH_mass_spring.cpp
@@@ -967,15 -973,14 +967,15 @@@ int BPH_cloth_solve(Depsgraph *depsgrap
         * Collision detection and volumetrics work differently then.
         * Bad design, TODO
         */
 +      Scene *scene = DEG_get_evaluated_scene(depsgraph);
        const bool is_hair = (clmd->hairdata != NULL);
  
-       unsigned int i=0;
-       float step=0.0f, tf=clmd->sim_parms->timescale;
+       unsigned int i = 0;
+       float step = 0.0f, tf = clmd->sim_parms->timescale;
        Cloth *cloth = clmd->clothObject;
-       ClothVertex *verts = cloth->verts/*, *cv*/;
+       ClothVertex *verts = cloth->verts /*, *cv*/;
        unsigned int mvert_num = cloth->mvert_num;
 -      float dt = clmd->sim_parms->timescale / clmd->sim_parms->stepsPerFrame;
 +      float dt = clmd->sim_parms->dt * clmd->sim_parms->timescale;
        Implicit_Data *id = cloth->implicit;
        ColliderContacts *contacts = NULL;
        int totcolliders = 0;
diff --cc source/blender/physics/intern/implicit.h
index f99812a8aa9,477bc704aff..11621ac812c
--- a/source/blender/physics/intern/implicit.h
+++ b/source/blender/physics/intern/implicit.h
@@@ -108,24 -107,19 +108,24 @@@ void BPH_mass_spring_force_drag(struct 
  /* Custom external force */
  void BPH_mass_spring_force_extern(struct Implicit_Data *data, int i, const 
float f[3], float dfdx[3][3], float dfdv[3][3]);
  /* Wind force, acting on a face */
- void BPH_mass_spring_force_face_wind(struct Implicit_Data *data, int v1, int 
v2, int v3, const float (*winvec)[3]);
+ void BPH_mass_spring_force_face_wind(struct Implicit_Data *data, int v1, int 
v2, int v3, const float(*winvec)[3]);
  /* Wind force, acting on an edge */
- void BPH_mass_spring_force_edge_wind(struct Implicit_Data *data, int v1, int 
v2, float radius1, float radius2, const float (*winvec)[3]);
+ void BPH_mass_spring_force_edge_wind(struct Implicit_Data *data, int v1, int 
v2, float radius1, float radius2, const float(*winvec)[3]);
  /* Wind force, acting on a vertex */
- void BPH_mass_spring_force_vertex_wind(struct Implicit_Data *data, int v, 
float radius, const float (*winvec)[3]);
+ void BPH_mass_spring_force_vertex_wind(struct Implicit_Data *data, int v, 
float radius, const float(*winvec)[3]);
  /* Linear spring force between two points */
  bool BPH_mass_spring_force_spring_linear(struct Implicit_Data *data, int i, 
int j, float restlen,
 -                                         float stiffness, float damping, bool 
no_compress, float clamp_force);
 +                                         float stiffness_tension, float 
damping_tension,
 +                                         float stiffness_compression, float 
damping_compression,
 +                                         bool resist_compress, bool 
new_compress, float clamp_force);
 +/* Angular spring force between two polygons */
 +bool BPH_mass_spring_force_spring_angular(struct Implicit_Data *data, int i, 
int j, int *i_a, int *i_b, int len_a, int len_b,
 +                                          float restang, float stiffness, 
float damping);
  /* Bending force, forming a triangle at the base of two structural springs */
  bool BPH_mass_spring_force_spring_bending(struct Implicit_Data *data, int i, 
int j, float restlen, float kb, float cb);
  /* Angular bending force based on local target vectors */
 -bool BPH_mass_spring_force_spring_bending_angular(struct Implicit_Data *data, 
int i, int j, int k,
 -                                                  const float target[3], 
float stiffness, float damping);
 +bool BPH_mass_spring_force_spring_bending_hair(struct Implicit_Data *data, 
int i, int j, int k,
-                                                   const float target[3], 
float stiffness, float damping);
++                                               const float target[3], float 
stiffness, float damping);
  /* Global goal spring */
  bool BPH_mass_spring_force_spring_goal(struct Implicit_Data *data, int i, 
const float goal_x[3], const float goal_v[3],
                                         float stiffness, float damping);
diff --cc source/blender/physics/intern/implicit_blender.c
index 20f4a9f3163,8ee9513e81b..28546f8ca0d
--- a/source/blender/physics/intern/implicit_blender.c
+++ b/source/blender/physics/intern/implicit_blender.c
@@@ -610,10 -603,8 +610,10 @@@ DO_INLINE void mul_bfmatrix_lfvector(fl
        {
  #pragma omp section
                {
-                       for (i = from[0].vcount; i < 
from[0].vcount+from[0].scount; i++) {
+                       for (i = from[0].vcount; i < from[0].vcount + 
from[0].scount; i++) {
 -                              muladd_fmatrix_fvector(to[from[i].c], 
from[i].m, fLongVector[from[i].r]);
 +                              /* This is the lower triangle of the sparse 
matrix,
 +                               * therefore multiplication occurs with 
transposed submatrices. */
 +                              muladd_fmatrixT_fvector(to[from[i].c], 
from[i].m, fLongVector[from[i].r]);
                        }
                }
  #pragma omp section
@@@ -1802,11 -1671,11 +1802,11 @@@ BLI_INLINE void spring_grad_dir(Implici
        }
  }
  
 -BLI_INLINE void spring_angbend_forces(Implicit_Data *data, int i, int j, int 
k,
 -                                      const float goal[3],
 -                                      float stiffness, float damping,
 -                                      int q, const float dx[3], const float 
dv[3],
 -                                      float r_f[3])
 +BLI_INLINE void spring_hairbend_forces(Implicit_Data *data, int i, int j, int 
k,
-                                       const float goal[3],
-                                       float stiffness, float damping,
-                                       int q, const float dx[3], const float 
dv[3],
-                                       float r_f[3])
++                                       const float goal[3],
++                                       float stiffness, float damping,
++                                       int q, const float dx[3], const float 
dv[3],
++                                       float r_f[3])
  {
        float edge_ij[3], dir_ij[3];
        float edge_jk[3], dir_jk[3];
@@@ -1851,10 -1720,10 +1851,10 @@@
  }
  
  /* Finite Differences method for estimating the jacobian of the force */
 -BLI_INLINE void spring_angbend_estimate_dfdx(Implicit_Data *data, int i, int 
j, int k,
 -                                             const float goal[3],
 -                                             float stiffness, float damping,
 -                                             int q, float dfdx[3][3])
 +BLI_INLINE void spring_hairbend_estimate_dfdx(Implicit_Data *data, int i, int 
j, int k,
-                                              const float goal[3],
-                                              float stiffness, float damping,
-                                              int q, float dfdx[3][3])
++                                              const float goal[3],
++                                              float stiffness, float damping,
++                                              int q, float dfdx[3][3])
  {
        const float delta = 0.00001f; // TODO find a good heuristic for this
        float dvec_null[3][3], dvec_pos[3][3], dvec_neg[3][3];
@@@ -1870,12 -1739,12 +1870,12 @@@
        /* XXX TODO offset targets to account for position dependency */
  
        for (a = 0; a < 3; ++a) {
 -              spring_angbend_forces(data, i, j, k, goal, stiffness, damping,
 -                                    q, dvec_pos[a], dvec_null[a], f);
 +              spring_hairbend_forces(data, i, j, k, goal, stiffness, damping,
-                                     q, dvec_pos[a], dvec_null[a], f);
++                                     q, dvec_pos[a], dvec_null[a], f);
                copy_v3_v3(dfdx[a], f);
  
 -              spring_angbend_forces(data, i, j, k, goal, stiffness, damping,
 -                                    q, dvec_neg[a], dvec_null[a], f);
 +              spring_hairbend_forces(data, i, j, k, goal, stiffness, damping,
-                                     q, dvec_neg[a], dvec_null[a], f);
++                                     q, dvec_neg[a], dvec_null[a], f);
                sub_v3_v3(dfdx[a], f);
  
                for (b = 0; b < 3; ++b) {
@@@ -1885,10 -1754,10 +1885,10 @@@
  }
  
  /* Finite Differences method for estimating the jacobian of the force */
 -BLI_INLINE void spring_angbend_estimate_dfdv(Implicit_Data *data, int i, int 
j, int k,
 -                                             const float goal[3],
 -                                             float stiffness, float damping,
 -                                             int q, float dfdv[3][3])
 +BLI_INLINE void spring_hairbend_estimate_dfdv(Implicit_Data *data, int i, int 
j, int k,
-                                              const float goal[3],
-                                              float stiffness, float damping,
-                                              int q, float dfdv[3][3])
++                                              const float goal[3],
++                                              float stiffness, float damping,
++                                              int q, float dfdv[3][3])
  {
        const float delta = 0.00001f; // TODO find a good heuristic for this
        float dvec_null[3][3], dvec_pos[3][3], dvec_neg[3][3];
@@@ -1904,12 -1773,12 +1904,12 @@@
        /* XXX TODO offset targets to account for position dependency */
  
        for (a = 0; a < 3; ++a) {
 -              spring_angbend_forces(data, i, j, k, goal, stiffness, damping,
 -                                    q, dvec_null[a], dvec_pos[a], f);
 +              spring_hairbend_forces(data, i, j, k, goal, stiffness, damping,
-                                     q, dvec_null[a], dvec_pos[a], f);
++                                     q, dvec_null[a], dvec_pos[a], f);
                copy_v3_v3(dfdv[a], f);
  
 -              spring_angbend_forces(data, i, j, k, goal, stiffness, damping,
 -                                    q, dvec_null[a], dvec_neg[a], f);
 +              spring_hairbend_forces(data, i, j, k, goal, stiffness, damping,
-                                     q, dvec_null[a], dvec_neg[a], f);
++                                     q, dvec_null[a], dvec_neg[a], f);
                sub_v3_v3(dfdv[a], f);
  
                for (b = 0; b < 3; ++b) {
@@@ -1921,8 -1790,8 +1921,8 @@@
  /* Angular spring that pulls the vertex toward the local target
   * See "Artistic Simulation of Curly Hair" (Pixar technical memo #12-03a)
   */
 -bool BPH_mass_spring_force_spring_bending_angular(Implicit_Data *dat

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to