Commit: 7d601df2edfaef81dcac4f8779b48ba79b61d380
Author: Lukas Tönne
Date:   Fri Aug 29 17:09:45 2014 +0200
Branches: testbuild
https://developer.blender.org/rB7d601df2edfaef81dcac4f8779b48ba79b61d380

Revert "Squash hair_immediate_fixes branch."

This reverts commit 6733d31f60493535f33a3133065d07e5415b5653.

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

M       release/scripts/startup/bl_ui/properties_particle.py
M       release/scripts/startup/bl_ui/properties_texture.py
M       source/blender/blenkernel/BKE_cloth.h
M       source/blender/blenkernel/intern/implicit.c
M       source/blender/makesdna/DNA_cloth_types.h
M       source/blender/makesdna/DNA_texture_types.h
M       source/blender/makesrna/intern/rna_cloth.c
M       source/blender/makesrna/intern/rna_texture.c
M       source/blender/render/intern/source/voxeldata.c

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

diff --git a/release/scripts/startup/bl_ui/properties_particle.py 
b/release/scripts/startup/bl_ui/properties_particle.py
index 7124271..30fc3a9 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -292,8 +292,6 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, 
Panel):
         sub.prop(cloth, "bending_stiffness", text="Bending")
         sub.prop(cloth, "internal_friction", slider=True)
         sub.prop(cloth, "collider_friction", slider=True)
-        sub.prop(cloth, "pressure", slider=True)
-        sub.prop(cloth, "pressure_threshold", slider=True)
 
         col = split.column()
         col.label(text="Damping:")
diff --git a/release/scripts/startup/bl_ui/properties_texture.py 
b/release/scripts/startup/bl_ui/properties_texture.py
index 4f5d22d..faf0d4c 100644
--- a/release/scripts/startup/bl_ui/properties_texture.py
+++ b/release/scripts/startup/bl_ui/properties_texture.py
@@ -771,9 +771,6 @@ class TEXTURE_PT_voxeldata(TextureButtonsPanel, Panel):
         elif vd.file_format == 'SMOKE':
             layout.prop(vd, "domain_object")
             layout.prop(vd, "smoke_data_type")
-        elif vd.file_format == 'HAIR':
-            layout.prop(vd, "domain_object")
-            layout.prop(vd, "hair_data_type")
         elif vd.file_format == 'IMAGE_SEQUENCE':
             layout.template_ID(tex, "image", open="image.open")
             layout.template_image(tex, "image", tex.image_user, compact=True)
diff --git a/source/blender/blenkernel/BKE_cloth.h 
b/source/blender/blenkernel/BKE_cloth.h
index a6e1058..757d63e 100644
--- a/source/blender/blenkernel/BKE_cloth.h
+++ b/source/blender/blenkernel/BKE_cloth.h
@@ -42,7 +42,6 @@ struct MFace;
 struct DerivedMesh;
 struct ClothModifierData;
 struct CollisionTree;
-struct VoxelData;
 
 #define DO_INLINE MALWAYS_INLINE
 
@@ -197,8 +196,6 @@ int implicit_free (struct ClothModifierData *clmd );
 int implicit_solver (struct Object *ob, float frame, struct ClothModifierData 
*clmd, struct ListBase *effectors );
 void implicit_set_positions (struct ClothModifierData *clmd );
 
-bool implicit_hair_volume_get_texture_data(struct Object *UNUSED(ob), struct 
ClothModifierData *clmd, struct ListBase *UNUSED(effectors), struct VoxelData 
*vd);
-
 /////////////////////////////////////////////////
 // cloth.c
 ////////////////////////////////////////////////
diff --git a/source/blender/blenkernel/intern/implicit.c 
b/source/blender/blenkernel/intern/implicit.c
index db77190..4d80256 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -36,7 +36,6 @@
 #include "DNA_object_types.h"
 #include "DNA_object_force.h"
 #include "DNA_meshdata_types.h"
-#include "DNA_texture_types.h"
 
 #include "BLI_math.h"
 #include "BLI_linklist.h"
@@ -1405,451 +1404,145 @@ static float calculateVertexWindForce(const float 
wind[3], const float vertexnor
        return dot_v3v3(wind, vertexnormal);
 }
 
-/* ================ Volumetric Hair Interaction ================
+typedef struct HairGridVert {
+       float velocity[3];
+       float density;
+} HairGridVert;
+#define HAIR_GRID_INDEX(vec, min, max, axis) (int)((vec[axis] - min[axis]) / 
(max[axis] - min[axis]) * 9.99f)
+/* Smoothing of hair velocities:
  * adapted from
  *      Volumetric Methods for Simulation and Rendering of Hair
  *      by Lena Petrovic, Mark Henne and John Anderson
  *      Pixar Technical Memo #06-08, Pixar Animation Studios
  */
-
-/* Note about array indexing:
- * Generally the arrays here are one-dimensional.
- * The relation between 3D indices and the array offset is
- *   offset = x + res_x * y + res_y * z
- */
-
-/* TODO: This is an initial implementation and should be made much better in 
due time.
- * What should at least be implemented is a grid size parameter and a 
smoothing kernel
- * for bigger grids.
- */
-
-/* 10x10x10 grid gives nice initial results */
-static const int hair_grid_res = 10;
-
-static int hair_grid_size(int res)
-{
-       return res * res * res;
-}
-
-BLI_INLINE void hair_grid_get_scale(int res, const float gmin[3], const float 
gmax[3], float scale[3])
-{
-       sub_v3_v3v3(scale, gmax, gmin);
-       mul_v3_fl(scale, 1.0f / (res-1));
-}
-
-typedef struct HairGridVert {
-       float velocity[3];
-       float density;
-} HairGridVert;
-
-#define HAIR_GRID_INDEX_AXIS(vec, res, gmin, scale, axis) ( min_ii( max_ii( 
(int)((vec[axis] - gmin[axis]) / scale[axis]), 0), res-2 ) )
-
-BLI_INLINE int hair_grid_offset(const float vec[3], int res, const float 
gmin[3], const float scale[3])
-{
-       int i, j, k;
-       i = HAIR_GRID_INDEX_AXIS(vec, res, gmin, scale, 0);
-       j = HAIR_GRID_INDEX_AXIS(vec, res, gmin, scale, 1);
-       k = HAIR_GRID_INDEX_AXIS(vec, res, gmin, scale, 2);
-       return i + (j + k*res)*res;
-}
-
-BLI_INLINE int hair_grid_interp_weights(int res, const float gmin[3], const 
float scale[3], const float vec[3], float uvw[3])
-{
-       int i, j, k, offset;
-       
-       i = HAIR_GRID_INDEX_AXIS(vec, res, gmin, scale, 0);
-       j = HAIR_GRID_INDEX_AXIS(vec, res, gmin, scale, 1);
-       k = HAIR_GRID_INDEX_AXIS(vec, res, gmin, scale, 2);
-       offset = i + (j + k*res)*res;
-       
-       uvw[0] = (vec[0] - gmin[0]) / scale[0] - (float)i;
-       uvw[1] = (vec[1] - gmin[1]) / scale[1] - (float)j;
-       uvw[2] = (vec[2] - gmin[2]) / scale[2] - (float)k;
-       
-       return offset;
-}
-
-BLI_INLINE void hair_grid_interpolate(const HairGridVert *grid, int res, const 
float gmin[3], const float scale[3], const float vec[3],
-                                      float *density, float velocity[3], float 
density_gradient[3])
-{
-       HairGridVert data[8];
-       float uvw[3], muvw[3];
-       int res2 = res * res;
-       int offset;
-       
-       offset = hair_grid_interp_weights(res, gmin, scale, vec, uvw);
-       muvw[0] = 1.0f - uvw[0];
-       muvw[1] = 1.0f - uvw[1];
-       muvw[2] = 1.0f - uvw[2];
-       
-       data[0] = grid[offset           ];
-       data[1] = grid[offset         +1];
-       data[2] = grid[offset     +res  ];
-       data[3] = grid[offset     +res+1];
-       data[4] = grid[offset+res2      ];
-       data[5] = grid[offset+res2    +1];
-       data[6] = grid[offset+res2+res  ];
-       data[7] = grid[offset+res2+res+1];
-       
-       if (density) {
-               *density = muvw[2]*( muvw[1]*( muvw[0]*data[0].density + 
uvw[0]*data[1].density )   +
-                                     uvw[1]*( muvw[0]*data[2].density + 
uvw[0]*data[3].density ) ) +
-                           uvw[2]*( muvw[1]*( muvw[0]*data[4].density + 
uvw[0]*data[5].density )   +
-                                     uvw[1]*( muvw[0]*data[6].density + 
uvw[0]*data[7].density ) );
-       }
-       if (velocity) {
-               int k;
-               for (k = 0; k < 3; ++k) {
-                       velocity[k] = muvw[2]*( muvw[1]*( 
muvw[0]*data[0].velocity[k] + uvw[0]*data[1].velocity[k] )   +
-                                                uvw[1]*( 
muvw[0]*data[2].velocity[k] + uvw[0]*data[3].velocity[k] ) ) +
-                                      uvw[2]*( muvw[1]*( 
muvw[0]*data[4].velocity[k] + uvw[0]*data[5].velocity[k] )   +
-                                                uvw[1]*( 
muvw[0]*data[6].velocity[k] + uvw[0]*data[7].velocity[k] ) );
-               }
-       }
-       if (density_gradient) {
-               density_gradient[0] = muvw[1] * muvw[2] * ( data[0].density - 
data[1].density ) +
-                                      uvw[1] * muvw[2] * ( data[2].density - 
data[3].density ) +
-                                     muvw[1] *  uvw[2] * ( data[4].density - 
data[5].density ) +
-                                      uvw[1] *  uvw[2] * ( data[6].density - 
data[7].density );
-               
-               density_gradient[1] = muvw[2] * muvw[0] * ( data[0].density - 
data[2].density ) +
-                                      uvw[2] * muvw[0] * ( data[4].density - 
data[6].density ) +
-                                     muvw[2] *  uvw[0] * ( data[1].density - 
data[3].density ) +
-                                      uvw[2] *  uvw[0] * ( data[5].density - 
data[7].density );
-               
-               density_gradient[2] = muvw[2] * muvw[0] * ( data[0].density - 
data[4].density ) +
-                                      uvw[2] * muvw[0] * ( data[1].density - 
data[5].density ) +
-                                     muvw[2] *  uvw[0] * ( data[2].density - 
data[6].density ) +
-                                      uvw[2] *  uvw[0] * ( data[3].density - 
data[7].density );
-       }
-}
-
-static void hair_velocity_smoothing(const HairGridVert *hairgrid, const float 
gmin[3], const float scale[3], float smoothfac,
-                                    lfVector *lF, lfVector *lX, lfVector *lV, 
unsigned int numverts)
+static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, 
lfVector *lX, lfVector *lV, unsigned int numverts)
 {
-       int v;
-       /* calculate forces */
-       for (v = 0; v < numverts; v++) {
-               float density, velocity[3];
-               
-               hair_grid_interpolate(hairgrid, hair_grid_res, gmin, scale, 
lX[v], &density, velocity, NULL);
-               
-               sub_v3_v3(velocity, lV[v]);
-               madd_v3_v3fl(lF[v], velocity, smoothfac);
-       }
-}
-
-static void hair_velocity_collision(const HairGridVert *collgrid, const float 
gmin[3], const float scale[3], float collfac,
-                                    lfVector *lF, lfVector *lX, lfVector *lV, 
unsigned int numverts)
-{
-       int v;
-       /* calculate forces */
-       for (v = 0; v < numverts; v++) {
-               int offset = hair_grid_offset(lX[v], hair_grid_res, gmin, 
scale);
-               
-               if (collgrid[offset].density > 0.0f) {
-                       lF[v][0] += collfac * (collgrid[offset].velocity[0] - 
lV[v][0]);
-                       lF[v][1] += collfac * (collgrid[offset].velocity[1] - 
lV[v][1]);
-                       lF[v][2] += collfac * (collgrid[offset].velocity[2] - 
lV[v][2]);
-               }
-       }
-}
-
-static void hair_pressure_force(const HairGridVert *hairgrid, const float 
gmin[3], const float scale[3], float pressurefac, float minpressure,
-                                lfVector *lF, lfVector *lX, unsigned int 
numverts)
-{
-       int v;
-       
-       /* calculate forces */
-       for (v = 0; v < numverts; v++) {
-               float density, gradient[3], gradlen;
-               
-               hair_grid_interpolate(hairgrid, hair_grid_res, gmin, scale, 
lX[v], &density, NULL, gradient);
-               
-               gradlen = normalize_v3(gradient) - minpressure;
-               if (gradlen < 0.0f)
-                       continue;
-               mul_v3_fl(gradient, gradlen);
-               
-               madd_v3_v3fl(lF[v], gradient, pressurefac);
-       }
-}
-
-static void hair_volume_get_boundbox(lfVector *lX, unsigned int numverts, 
float gmin[3], float gmax[3])
-{
-       int i;
-       
-       INIT_MINMAX(gmin, gmax);
-       for (i = 0; i < numverts; i++)
-               DO_MINMAX(lX[i], gmin, gmax);
-}
-
-BLI_INLINE bool hair_grid_point_valid(const float vec[3], float gmin[3], float 
gmax[3])
-{
-       return !(vec[

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to