[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26002] trunk/blender/source/blender/ editors/physics/particle_edit.c: improve volume preserving puff to shape the end strands of the hair in relation to the underlying form of the head .
Campbell Barton
ideasman42 at gmail.com
Thu Jan 14 17:14:24 CET 2010
Revision: 26002
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26002
Author: campbellbarton
Date: 2010-01-14 17:14:24 +0100 (Thu, 14 Jan 2010)
Log Message:
-----------
improve volume preserving puff to shape the end strands of the hair in relation to the underlying form of the head.
Modified Paths:
--------------
trunk/blender/source/blender/editors/physics/particle_edit.c
Modified: trunk/blender/source/blender/editors/physics/particle_edit.c
===================================================================
--- trunk/blender/source/blender/editors/physics/particle_edit.c 2010-01-14 16:01:05 UTC (rev 26001)
+++ trunk/blender/source/blender/editors/physics/particle_edit.c 2010-01-14 16:14:24 UTC (rev 26002)
@@ -2923,9 +2923,13 @@
#else
/* translate (not rotate) the rest of the hair if its not selected */
if(ofs[0] || ofs[1] || ofs[2]) {
+#if 0 /* kindof works but looks worse then whats below */
+
+ /* Move the unselected point on a vector based on the
+ * hair direction and the offset */
float c1[3], c2[3];
VECSUB(dco, lastco, co);
- mul_m4_v3(imat, dco); /* into particle space */
+ mul_mat3_m4_v3(imat, dco); /* into particle space */
/* move the point allong a vector perpendicular to the
* hairs direction, reduces odd kinks, */
@@ -2934,6 +2938,26 @@
normalize_v3(c2);
mul_v3_fl(c2, len_v3(ofs));
add_v3_v3(key->co, c2);
+#else
+ /* Move the unselected point on a vector based on the
+ * the normal of the closest geometry */
+ float oco[3], onor[3];
+ VECCOPY(oco, key->co);
+ mul_m4_v3(mat, oco);
+ mul_v3_m4v3(kco, data->ob->imat, oco); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */
+
+ point_index= BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL, NULL);
+ if(point_index != -1) {
+ copy_v3_v3(onor, &edit->emitter_cosnos[point_index*6+3]);
+ mul_mat3_m4_v3(data->ob->obmat, onor); /* normal into worldspace */
+ mul_mat3_m4_v3(imat, onor); /* worldspace into particle space */
+ normalize_v3(onor);
+
+
+ mul_v3_fl(onor, len_v3(ofs));
+ add_v3_v3(key->co, onor);
+ }
+#endif
}
#endif
}
More information about the Bf-blender-cvs
mailing list