Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-07-17 16:05:15 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-17 16:05:15 +0400
commit6f0950a1f4abd884234c4e5f980e21ef3915eaff (patch)
treed3b938d284332760ed6f80363a711c21dc81e8a1 /source/blender/blenkernel/intern/particle_system.c
parente35d3083ecce72ad01fa63977355beb0c7a5ff68 (diff)
use math vector init functions
Diffstat (limited to 'source/blender/blenkernel/intern/particle_system.c')
-rw-r--r--source/blender/blenkernel/intern/particle_system.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index aa798f59482..457903a4d09 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -2441,7 +2441,8 @@ static void sph_particle_courant(SPHData *sphdata, SPHRangeData *pfr)
int i;
float flow[3], offset[3], dist;
- flow[0] = flow[1] = flow[2] = 0.0f;
+ zero_v3(flow);
+
dist = 0.0f;
if (pfr->tot_neighbors > 0) {
pa = pfr->pa;
@@ -2733,9 +2734,8 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
{
float rotfac, rot1[4], rot2[4]={1.0,0.0,0.0,0.0}, dtime=dfra*timestep, extrotfac;
- if ((part->flag & PART_ROTATIONS)==0) {
- pa->state.rot[0]=1.0f;
- pa->state.rot[1]=pa->state.rot[2]=pa->state.rot[3]=0;
+ if ((part->flag & PART_ROTATIONS) == 0) {
+ unit_qt(pa->state.rot);
return;
}
@@ -2747,8 +2747,9 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
float len2 = len_v3(pa->state.vel);
float vec[3];
- if (len1==0.0f || len2==0.0f)
- pa->state.ave[0] = pa->state.ave[1] = pa->state.ave[2] = 0.0f;
+ if (len1 == 0.0f || len2 == 0.0f) {
+ zero_v3(pa->state.ave);
+ }
else {
cross_v3_v3v3(pa->state.ave, pa->prev_state.vel, pa->state.vel);
normalize_v3(pa->state.ave);
@@ -2761,9 +2762,8 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
}
rotfac = len_v3(pa->state.ave);
- if (rotfac == 0.0f || (part->flag & PART_ROT_DYN)==0 || extrotfac == 0.0f) { /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */
- rot1[0]=1.0f;
- rot1[1]=rot1[2]=rot1[3]=0;
+ if (rotfac == 0.0f || (part->flag & PART_ROT_DYN)==0 || extrotfac == 0.0f) {
+ unit_qt(rot1);
}
else {
axis_angle_to_quat(rot1,pa->state.ave,rotfac*dtime);
@@ -3750,8 +3750,10 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
pa->totkey++;
/* root is always in the origin of hair space so we set it to be so after the last key is saved*/
- if (pa->totkey == psys->part->hair_step + 1)
- root->co[0] = root->co[1] = root->co[2] = 0.0f;
+ if (pa->totkey == psys->part->hair_step + 1) {
+ zero_v3(root->co);
+ }
+
}
}
@@ -4130,9 +4132,8 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
pa->state.vel[j] = wrf;
}
- pa->state.ave[0] = pa->state.ave[1] = pa->state.ave[2] = 0.0f;
- pa->state.rot[0] = 1.0;
- pa->state.rot[1] = pa->state.rot[2] = pa->state.rot[3] = 0.0;
+ zero_v3(pa->state.ave);
+ unit_qt(pa->state.rot);
pa->time = 1.f;
pa->dietime = sim->scene->r.efra + 1;