diff options
author | Kent Mein <mein@cs.umn.edu> | 2004-01-22 18:45:42 +0300 |
---|---|---|
committer | Kent Mein <mein@cs.umn.edu> | 2004-01-22 18:45:42 +0300 |
commit | 4e9ac81f779e86274549ef9fb5780afbbd91a75b (patch) | |
tree | c3d2db0cb7e476885e585d99f741f7488efe4644 /source | |
parent | d4fc04f76a5e6e26aadaddee7debf5416a25bc8d (diff) |
I modified it so that the particles on a face's position are affected
by the seed variable. Requested by S68.
Basically they move slightly when you change the seed. Might be
a good idea to split this up so there are two seed options in a
particle effect, however there are already quite a bit of them so I opted
for this.
Kent
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_effect.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h index cb3abf9d182..17cabf0c390 100644 --- a/source/blender/blenkernel/BKE_effect.h +++ b/source/blender/blenkernel/BKE_effect.h @@ -56,8 +56,8 @@ struct PartEff *give_parteff(struct Object *ob); void where_is_particle(struct PartEff *paf, struct Particle *pa, float ctime, float *vec); void particle_tex(struct MTex *mtex, struct PartEff *paf, float *co, float *no); void make_particle_keys(int depth, int nr, struct PartEff *paf, struct Particle *part, float *force, int deform, struct MTex *mtex); -void init_mv_jit(float *jit, int num); -void give_mesh_mvert(struct Mesh *me, int nr, float *co, short *no); +void init_mv_jit(float *jit, int num,float seed2); +void give_mesh_mvert(struct Mesh *me, int nr, float *co, short *no,float seed2); void build_particle_system(struct Object *ob); void calc_wave_deform(struct WaveEff *wav, float ctime, float *co); void object_wave(struct Object *ob); diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index f038be8d2ca..db9cfaf9b9d 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -434,7 +434,7 @@ void make_particle_keys(int depth, int nr, PartEff *paf, Particle *part, float * } } -void init_mv_jit(float *jit, int num) +void init_mv_jit(float *jit, int num,float seed2) { float *jit2, x, rad1, rad2, rad3; int i, num2; @@ -445,7 +445,7 @@ void init_mv_jit(float *jit, int num) rad2= (float)(1.0/((float)num)); rad3= (float)sqrt((float)num)/((float)num); - BLI_srand(31415926 + num); + BLI_srand(31415926 + num + seed2); x= 0; num2 = 2 * num; for(i=0; i<num2; i+=2) { @@ -471,7 +471,7 @@ void init_mv_jit(float *jit, int num) } -void give_mesh_mvert(Mesh *me, int nr, float *co, short *no) +void give_mesh_mvert(Mesh *me, int nr, float *co, short *no, float seed2) { static float *jit=0; static int jitlevel=1; @@ -503,7 +503,7 @@ void give_mesh_mvert(Mesh *me, int nr, float *co, short *no) if(jitlevel>100) jitlevel= 100; jit= MEM_callocN(2+ jitlevel*2*sizeof(float), "jit"); - init_mv_jit(jit, jitlevel); + init_mv_jit(jit, jitlevel,seed2); } @@ -647,7 +647,7 @@ void build_particle_system(Object *ob) if(deform) init_latt_deform(ob->parent, 0); /* init */ - give_mesh_mvert(me, totpart, co, no); + give_mesh_mvert(me, totpart, co, no,paf->seed); for(a=0; a<totpart; a++, ftime+=dtime) { @@ -680,7 +680,7 @@ void build_particle_system(Object *ob) } } /* get coordinates */ - if(paf->flag & PAF_FACE) give_mesh_mvert(me, a, co, no); + if(paf->flag & PAF_FACE) give_mesh_mvert(me, a, co, no,paf->seed); else { mvert= me->mvert + (a % me->totvert); VECCOPY(co, mvert->co); @@ -733,7 +733,7 @@ void build_particle_system(Object *ob) /* restore */ G.scene->r.cfra= cfraont; G.scene->r.framelen= framelenont; - give_mesh_mvert(0, 0, 0, 0); + give_mesh_mvert(0, 0, 0, 0,paf->seed); /* put hierarchy back */ |