[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13158] trunk/blender/source/blender/ blenkernel/intern/anim.c:
Brecht Van Lommel
brechtvanlommel at pandora.be
Mon Jan 7 19:15:57 CET 2008
Revision: 13158
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13158
Author: blendix
Date: 2008-01-07 19:15:57 +0100 (Mon, 07 Jan 2008)
Log Message:
-----------
Addition to last commit, now the length of the hair is used to
scale the object. Also, the direction is now derived from the
first and last keys on the hair, instead of first and second.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/anim.c
Modified: trunk/blender/source/blender/blenkernel/intern/anim.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim.c 2008-01-07 18:03:41 UTC (rev 13157)
+++ trunk/blender/source/blender/blenkernel/intern/anim.c 2008-01-07 18:15:57 UTC (rev 13158)
@@ -660,12 +660,12 @@
dm->release(dm);
}
-static void particle_dupli_path_rotation(Object *ob, ParticleSettings *part, ParticleSystemModifierData *psmd, ParticleData *pa, ChildParticle *cpa, ParticleCacheKey *cache, float mat[][4])
+static void particle_dupli_path_rotation(Object *ob, ParticleSettings *part, ParticleSystemModifierData *psmd, ParticleData *pa, ChildParticle *cpa, ParticleCacheKey *cache, float mat[][4], float *scale)
{
- float loc[3], nor[3], vec[3], side[3];
+ float loc[3], nor[3], vec[3], side[3], len;
- VecSubf(vec, (cache+1)->co, cache->co);
- Normalize(vec);
+ VecSubf(vec, (cache+cache->steps-1)->co, cache->co);
+ len= Normalize(vec);
if(pa)
psys_particle_on_emitter(ob,psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0);
@@ -682,6 +682,8 @@
VECCOPY(mat[0], vec);
VECCOPY(mat[1], side);
VECCOPY(mat[2], nor);
+
+ *scale= len;
}
static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_space_mat[][4], ParticleSystem *psys, int level)
@@ -693,7 +695,7 @@
ParticleKey state;
ParticleCacheKey *cache;
ParticleSystemModifierData *psmd;
- float ctime, pa_time;
+ float ctime, pa_time, scale = 1.0f;
float tmat[4][4], mat[4][4], obrotmat[4][4], pamat[4][4], size=0.0;
float obmat[4][4], (*obmatlist)[4][4]=0;
float xvec[3] = {-1.0, 0.0, 0.0}, *q;
@@ -793,12 +795,12 @@
if(hair) {
if(a < totpart) {
cache = psys->pathcache[a];
- particle_dupli_path_rotation(par, part, psmd, pa, 0, cache, pamat);
+ particle_dupli_path_rotation(par, part, psmd, pa, 0, cache, pamat, &scale);
}
else {
ChildParticle *cpa= psys->child+(a-totpart);
cache = psys->childcache[a-totpart];
- particle_dupli_path_rotation(par, part, psmd, 0, cpa, cache, pamat);
+ particle_dupli_path_rotation(par, part, psmd, 0, cpa, cache, pamat, &scale);
}
VECCOPY(pamat[3], cache->co);
@@ -825,7 +827,7 @@
for(go= part->dup_group->gobject.first, b=0; go; go= go->next, b++) {
Mat4MulMat4(tmat, obmatlist[b], pamat);
- Mat4MulFloat3((float *)tmat, size);
+ Mat4MulFloat3((float *)tmat, size*scale);
if(par_space_mat)
Mat4MulMat4(mat, tmat, par_space_mat);
else
@@ -849,7 +851,7 @@
Mat4CpyMat4(mat, pamat);
Mat4MulMat4(tmat, obmat, mat);
- Mat4MulFloat3((float *)tmat, size);
+ Mat4MulFloat3((float *)tmat, size*scale);
if(par_space_mat)
Mat4MulMat4(mat, tmat, par_space_mat);
else
More information about the Bf-blender-cvs
mailing list