From ca383667327683e99cb9ca36f6cac3b82e25d674 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 28 Mar 2011 11:21:39 +0000 Subject: particles & vector-font: floats were being implicitly promoted to doubles, adjust to use floats. --- source/blender/blenkernel/BKE_curve.h | 2 +- source/blender/blenkernel/intern/font.c | 46 +++++++-------- source/blender/blenkernel/intern/particle.c | 66 +++++++++++----------- source/blender/blenkernel/intern/particle_system.c | 54 +++++++++--------- 4 files changed, 84 insertions(+), 84 deletions(-) diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index f0c58e0a511..0491116d199 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -51,7 +51,7 @@ struct BevList; #define SEGMENTSV(nu) ( ((nu)->flagv & CU_NURB_CYCLIC) ? (nu)->pntsv : (nu)->pntsv-1 ) #define CU_DO_TILT(cu, nu) (((nu->flag & CU_2D) && (cu->flag & CU_3D)==0) ? 0 : 1) -#define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || ((cu)->flag & CU_PATH_RADIUS) || (cu)->bevobj || (cu)->ext1!=0.0 || (cu)->ext2!=0.0) ? 1:0) +#define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || ((cu)->flag & CU_PATH_RADIUS) || (cu)->bevobj || (cu)->ext1!=0.0f || (cu)->ext2!=0.0f) ? 1:0) void unlink_curve( struct Curve *cu); diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index b521dbad17a..5c1922b469b 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -490,19 +490,19 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i nu2->bp[0].vec[0] = x1; nu2->bp[0].vec[1] = y1; nu2->bp[0].vec[2] = 0; - nu2->bp[0].vec[3] = 1.0; + nu2->bp[0].vec[3] = 1.0f; nu2->bp[1].vec[0] = x2; nu2->bp[1].vec[1] = y1; nu2->bp[1].vec[2] = 0; - nu2->bp[1].vec[3] = 1.0; + nu2->bp[1].vec[3] = 1.0f; nu2->bp[2].vec[0] = x2; nu2->bp[2].vec[1] = y2; nu2->bp[2].vec[2] = 0; - nu2->bp[2].vec[3] = 1.0; + nu2->bp[2].vec[3] = 1.0f; nu2->bp[3].vec[0] = x1; nu2->bp[3].vec[1] = y2; nu2->bp[3].vec[2] = 0; - nu2->bp[3].vec[3] = 1.0; + nu2->bp[3].vec[3] = 1.0f; BLI_addtail(&(cu->nurb), nu2); @@ -574,7 +574,7 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float memcpy(bezt2, bezt1, i * sizeof(struct BezTriple)); nu2->bezt = bezt2; - if (shear != 0.0) { + if (shear != 0.0f) { bezt2 = nu2->bezt; for (i= nu2->pntsu; i > 0; i--) { @@ -584,7 +584,7 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float bezt2++; } } - if(rot!=0.0) { + if(rot != 0.0f) { bezt2= nu2->bezt; for (i=nu2->pntsu; i > 0; i--) { fp= bezt2->vec[0]; @@ -709,8 +709,8 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) // Count the wchar_t string length slen = wcslen(mem); - if (cu->ulheight == 0.0) - cu->ulheight = 0.05; + if (cu->ulheight == 0.0f) + cu->ulheight = 0.05f; if (cu->strinfo==NULL) /* old file */ cu->strinfo = MEM_callocN((slen+4) * sizeof(CharInfo), "strinfo compat"); @@ -815,7 +815,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) twidth = char_width(cu, che, info); // Calculate positions - if((tb->w != 0.0) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w + cu->xof*cu->fsize) { + if((tb->w != 0.0f) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w + cu->xof*cu->fsize) { // fprintf(stderr, "linewidth exceeded: %c%c%c...\n", mem[i], mem[i+1], mem[i+2]); for (j=i; j && (mem[j] != '\n') && (mem[j] != '\r') && (chartransdata[j].dobreak==0); j--) { if (mem[j]==' ' || mem[j]=='-') { @@ -855,7 +855,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) linedata3[lnr]= tb->w/cu->fsize; linedata4[lnr]= wsnr; - if ( (tb->h != 0.0) && + if ( (tb->h != 0.0f) && ((-(yof-(tb->y/cu->fsize))) > ((tb->h/cu->fsize)-(linedist*cu->fsize)) - cu->yof) && (cu->totbox > (curbox+1)) ) { maxlen= 0; @@ -886,7 +886,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) ct->charnr= cnr++; tabfac= (xof-cu->xof+0.01f); - tabfac= (float)(2.0*ceil(tabfac/2.0)); + tabfac= 2.0f*ceilf(tabfac/2.0f); xof= cu->xof+tabfac; } else { @@ -900,7 +900,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) if (cu->selboxes && (i>=selstart) && (i<=selend)) { sb = &(cu->selboxes[i-selstart]); - sb->y = yof*cu->fsize-linedist*cu->fsize*0.1; + sb->y = yof*cu->fsize-linedist*cu->fsize*0.1f; sb->h = linedist*cu->fsize; sb->w = xof*cu->fsize; } @@ -909,12 +909,12 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) wsfac = cu->wordspace; wsnr++; } - else wsfac = 1.0; + else wsfac = 1.0f; // Set the width of the character twidth = char_width(cu, che, info); - xof += (twidth*wsfac*(1.0+(info->kern/40.0)) ) + xtrax; + xof += (twidth*wsfac*(1.0f+(info->kern/40.0f)) ) + xtrax; if (sb) sb->w = (xof*cu->fsize) - sb->w; @@ -951,7 +951,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) ct++; } } else if((cu->spacemode==CU_FLUSH) && - (cu->tb[0].w != 0.0)) { + (cu->tb[0].w != 0.0f)) { for(i=0;i1) linedata[i]= (linedata3[i]-linedata[i])/(linedata2[i]-1); @@ -964,7 +964,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) ct++; } } - else if((cu->spacemode==CU_JUSTIFY) && (cu->tb[0].w != 0.0)) { + else if((cu->spacemode==CU_JUSTIFY) && (cu->tb[0].w != 0.0f)) { float curofs= 0.0f; for (i=0; i<=slen; i++) { for (j=i; (mem[j]) && (mem[j]!='\n') && @@ -1015,9 +1015,9 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) /* length correction */ distfac= sizefac*cucu->path->totdist/(maxx-minx); - timeofs= 0.0; + timeofs= 0.0f; - if(distfac > 1.0) { + if(distfac > 1.0f) { /* path longer than text: spacemode involves */ distfac= 1.0f/distfac; @@ -1051,7 +1051,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) dtime= distfac*0.5f*twidth; ctime= timeofs + distfac*( ct->xof - minx); - CLAMP(ctime, 0.0, 1.0); + CLAMP(ctime, 0.0f, 1.0f); /* calc the right loc AND the right rot separately */ /* vec, tvec need 4 items */ @@ -1173,17 +1173,17 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) if ( (i<(slen-1)) && (mem[i+1] != '\n') && (mem[i+1] != '\r') && ((mem[i+1] != ' ') || (custrinfo[i+1].flag & CU_CHINFO_UNDERLINE)) && ((custrinfo[i+1].flag & CU_CHINFO_WRAP)==0) ) { - uloverlap = xtrax + 0.1; + uloverlap = xtrax + 0.1f; } // Find the character, the characters has to be in the memory already // since character checking has been done earlier already. che= find_vfont_char(vfd, cha); twidth = char_width(cu, che, info); - ulwidth = cu->fsize * ((twidth* (1.0+(info->kern/40.0)))+uloverlap); - build_underline(cu, ct->xof*cu->fsize, ct->yof*cu->fsize + (cu->ulpos-0.05)*cu->fsize, + ulwidth = cu->fsize * ((twidth* (1.0f+(info->kern/40.0f)))+uloverlap); + build_underline(cu, ct->xof*cu->fsize, ct->yof*cu->fsize + (cu->ulpos-0.05f)*cu->fsize, ct->xof*cu->fsize + ulwidth, - ct->yof*cu->fsize + (cu->ulpos-0.05)*cu->fsize - cu->ulheight*cu->fsize, + ct->yof*cu->fsize + (cu->ulpos-0.05f)*cu->fsize - cu->ulheight*cu->fsize, i, info->mat_nr); } ct++; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index f937d7265aa..5c1c8eae622 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -660,7 +660,7 @@ static float psys_render_projected_area(ParticleSystem *psys, float *center, flo } /* screen space radius */ - radius= sqrt(area/M_PI); + radius= sqrt(area/(float)M_PI); /* make smaller using fallof once over screen edge */ *viewport= 1.0f; @@ -869,7 +869,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot) powrate= log(0.5f)/log(part->simplify_rate*0.5f); if(part->simplify_flag & PART_SIMPLIFY_VIEWPORT) - vprate= pow(1.0 - part->simplify_viewport, 5.0); + vprate= pow(1.0f - part->simplify_viewport, 5.0); else vprate= 1.0; @@ -1990,25 +1990,25 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float inp_y=dot_v3v3(y_vec, vec_one); inp_z=dot_v3v3(z_vec, vec_one); - if(inp_y>0.5){ + if(inp_y > 0.5f){ copy_v3_v3(state_co, y_vec); mul_v3_fl(y_vec, amplitude*(float)cos(t)); mul_v3_fl(z_vec, amplitude/2.f*(float)sin(2.f*t)); } - else if(inp_z>0.0){ - mul_v3_v3fl(state_co, z_vec, (float)sin(M_PI/3.f)); + else if(inp_z > 0.0f){ + mul_v3_v3fl(state_co, z_vec, (float)sin((float)M_PI/3.f)); VECADDFAC(state_co,state_co,y_vec,-0.5f); - mul_v3_fl(y_vec, -amplitude * (float)cos(t + M_PI/3.f)); - mul_v3_fl(z_vec, amplitude/2.f * (float)cos(2.f*t + M_PI/6.f)); + mul_v3_fl(y_vec, -amplitude * (float)cos(t + (float)M_PI/3.f)); + mul_v3_fl(z_vec, amplitude/2.f * (float)cos(2.f*t + (float)M_PI/6.f)); } else{ - mul_v3_v3fl(state_co, z_vec, -(float)sin(M_PI/3.f)); + mul_v3_v3fl(state_co, z_vec, -(float)sin((float)M_PI/3.f)); madd_v3_v3fl(state_co, y_vec, -0.5f); - mul_v3_fl(y_vec, amplitude * (float)-sin(t + M_PI/6.f)); - mul_v3_fl(z_vec, amplitude/2.f * (float)-sin(2.f*t + M_PI/3.f)); + mul_v3_fl(y_vec, amplitude * (float)-sin(t + (float)M_PI/6.f)); + mul_v3_fl(z_vec, amplitude/2.f * (float)-sin(2.f*t + (float)M_PI/3.f)); } mul_v3_fl(state_co, amplitude); @@ -2047,15 +2047,15 @@ static float do_clump(ParticleKey *state, ParticleKey *par, float time, float cl { float clump = 0.f; - if(par && clumpfac!=0.0){ + if(par && clumpfac!=0.0f){ float cpow; - if(clumppow<0.0) + if(clumppow < 0.0f) cpow=1.0f+clumppow; else cpow=1.0f+9.0f*clumppow; - if(clumpfac<0.0) /* clump roots instead of tips */ + if(clumpfac < 0.0f) /* clump roots instead of tips */ clump = -clumpfac*pa_clump*(float)pow(1.0-(double)time,(double)cpow); else clump = clumpfac*pa_clump*(float)pow((double)time,(double)cpow); @@ -2129,7 +2129,7 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time) if(data->strength <= 0.0f) continue; - guidetime = time / (1.0 - pd->free_end); + guidetime = time / (1.0f - pd->free_end); if(guidetime>1.0f) continue; @@ -2152,7 +2152,7 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time) VECCOPY(vec_to_point, data->vec_to_point); - if(guidetime != 0.0){ + if(guidetime != 0.0f) { /* curve direction */ cross_v3_v3v3(temp, eff->guide_dir, guidedir); angle = dot_v3v3(eff->guide_dir, guidedir)/(len_v3(eff->guide_dir)); @@ -2167,7 +2167,7 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time) /* curve taper */ if(cu->taperobj) - mul_v3_fl(vec_to_point, calc_taper(eff->scene, cu->taperobj, (int)(data->strength*guidetime*100.0), 100)); + mul_v3_fl(vec_to_point, calc_taper(eff->scene, cu->taperobj, (int)(data->strength*guidetime*100.0f), 100)); else{ /* curve size*/ if(cu->flag & CU_PATH_RADIUS) { @@ -2191,10 +2191,10 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time) totstrength *= weight; } - if(totstrength != 0.0){ - if(totstrength > 1.0) + if(totstrength != 0.0f){ + if(totstrength > 1.0f) mul_v3_fl(effect, 1.0f / totstrength); - CLAMP(totstrength, 0.0, 1.0); + CLAMP(totstrength, 0.0f, 1.0f); //VECADD(effect,effect,pa_zero); interp_v3_v3v3(state->co, state->co, effect, totstrength); @@ -2210,8 +2210,8 @@ static void do_rough(float *loc, float mat[4][4], float t, float fac, float size float rough[3]; float rco[3]; - if(thres!=0.0) - if((float)fabs((float)(-1.5+loc[0]+loc[1]+loc[2]))<1.5f*thres) return; + if(thres != 0.0f) + if((float)fabs((float)(-1.5f+loc[0]+loc[1]+loc[2]))<1.5f*thres) return; VECCOPY(rco,loc); mul_v3_fl(rco,t); @@ -2333,7 +2333,7 @@ void psys_find_parents(ParticleSimulationData *sim) int p, totparent,totchild=sim->psys->totchild; float co[3], orco[3]; int from=PART_FROM_FACE; - totparent=(int)(totchild*part->parents*0.3); + totparent=(int)(totchild*part->parents*0.3f); if(G.rendering && part->child_nbr && part->ren_child_nbr) totparent*=(float)part->child_nbr/(float)part->ren_child_nbr; @@ -2409,7 +2409,7 @@ static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float c } if(totchild && part->childtype==PART_CHILD_FACES){ - totparent=(int)(totchild*part->parents*0.3); + totparent=(int)(totchild*part->parents*0.3f); if(G.rendering && part->child_nbr && part->ren_child_nbr) totparent*=(float)part->child_nbr/(float)part->ren_child_nbr; @@ -2549,7 +2549,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle normalize_v3(v1); normalize_v3(v2); - d = saacos(dot_v3v3(v1, v2)) * 180.f / M_PI; + d = saacos(dot_v3v3(v1, v2)) * 180.0f/(float)M_PI; } if(p_max > p_min) @@ -3063,8 +3063,8 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf ParticleInterpolationData pind; ParticleKey result; - float birthtime = 0.0, dietime = 0.0; - float t, time = 0.0, keytime = 0.0, frs_sec; + float birthtime = 0.0f, dietime = 0.0f; + float t, time = 0.0f, keytime = 0.0f, frs_sec; float hairmat[4][4], rotmat[3][3], prev_tangent[3] = {0.0f, 0.0f, 0.0f}; int k, i; int steps = (int)pow(2.0, (double)pset->draw_step); @@ -3697,8 +3697,8 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, fl } #define SET_PARTICLE_TEXTURE(type, pvalue, texfac) if((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend);} -#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) if(event & type) { if(pvalue < 0.f) pvalue = 1.f+pvalue; CLAMP(pvalue, 0.0, 1.0); } -#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) if(event & type) { CLAMP(pvalue, -1.0, 1.0); } +#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) if(event & type) { if(pvalue < 0.f) pvalue = 1.f+pvalue; CLAMP(pvalue, 0.0f, 1.0f); } +#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) if(event & type) { CLAMP(pvalue, -1.0f, 1.0f); } static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, float *fw, float *orco, ParticleTexture *ptex, int event, float cfra) { @@ -3898,7 +3898,7 @@ float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float UNUSED size*=part->childsize; - if(part->childrandsize!=0.0) + if(part->childrandsize != 0.0f) size *= 1.0f - part->childrandsize * PSYS_FRAND(cpa - psys->child + 26); return size; @@ -4002,7 +4002,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey * memset(keys, 0, 4*sizeof(ParticleKey)); t=state->time; - CLAMP(t, 0.0, 1.0); + CLAMP(t, 0.0f, 1.0f); if(pparticles + p; @@ -4199,8 +4199,8 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta state->time = psys_get_child_time(psys, cpa, cfra, NULL, NULL); if(!always) - if((state->time < 0.0 && !(part->flag & PART_UNBORN)) - || (state->time > 1.0 && !(part->flag & PART_DIED))) + if((state->time < 0.0f && !(part->flag & PART_UNBORN)) + || (state->time > 1.0f && !(part->flag & PART_DIED))) return 0; state->time= (cfra - (part->sta + (part->end - part->sta) * PSYS_FRAND(p + 23))) / (part->lifetime * PSYS_FRAND(p + 24)); @@ -4240,7 +4240,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta key1=&pa->state; offset_child(cpa, key1, key1->rot, state, part->childflat, part->childrad); - CLAMP(t,0.0,1.0); + CLAMP(t, 0.0f, 1.0f); unit_m4(mat); do_child_modifiers(sim, NULL, key1, key1->rot, cpa, cpa->fuv, mat, state, t); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 19d4ed598ee..649a6fa90a0 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -635,8 +635,8 @@ static void hammersley_create(float *out, int n, int seed, float amount) int k, kk; rng = rng_new(31415926 + n + seed); - offs[0]= rng_getDouble(rng) + amount; - offs[1]= rng_getDouble(rng) + amount; + offs[0]= rng_getDouble(rng) + (double)amount; + offs[1]= rng_getDouble(rng) + (double)amount; rng_free(rng); for (k = 0; k < n; k++) { @@ -659,8 +659,8 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount) if(num==0) return; - rad1= (float)(1.0/sqrt((float)num)); - rad2= (float)(1.0/((float)num)); + rad1= (float)(1.0f/sqrt((float)num)); + rad2= (float)(1.0f/((float)num)); rad3= (float)sqrt((float)num)/((float)num); rng = rng_new(31415926 + num + seed2); @@ -890,7 +890,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch if(ctx->tree){ KDTreeNearest ptn[10]; int w,maxw;//, do_seams; - float maxd,mind,/*dd,*/totw=0.0; + float maxd,mind,/*dd,*/totw= 0.0f; int parent[10]; float pweight[10]; @@ -1210,10 +1210,10 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D if(mf->v4) { tweight += vweight[mf->v4]; - tweight /= 4.0; + tweight /= 4.0f; } else { - tweight /= 3.0; + tweight /= 3.0f; } element_weight[i]*=tweight; @@ -1271,7 +1271,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D /* For hair, sort by origindex (allows optimizations in rendering), */ /* however with virtual parents the children need to be in random order. */ - if(part->type == PART_HAIR && !(part->childtype==PART_CHILD_FACES && part->parents!=0.0)) { + if(part->type == PART_HAIR && !(part->childtype==PART_CHILD_FACES && part->parents!=0.0f)) { COMPARE_ORIG_INDEX = NULL; if(from == PART_FROM_VERT) { @@ -1606,11 +1606,11 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, normalize_v3(nor); /* -tangent */ - if(part->tanfac!=0.0){ + if(part->tanfac!=0.0f){ //float phase=vg_rot?2.0f*(psys_particle_value_from_verts(sim->psmd->dm,part->from,pa,vg_rot)-0.5f):0.0f; float phase=0.0f; - mul_v3_fl(vtan,-(float)cos(M_PI*(part->tanphase+phase))); - fac=-(float)sin(M_PI*(part->tanphase+phase)); + mul_v3_fl(vtan,-(float)cos((float)M_PI*(part->tanphase+phase))); + fac=-(float)sin((float)M_PI*(part->tanphase+phase)); VECADDFAC(vtan,vtan,utan,fac); mul_mat3_m4_v3(ob->obmat,vtan); @@ -1624,7 +1624,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, /* -velocity */ - if(part->randfac!=0.0){ + if(part->randfac != 0.0f){ r_vel[0] = 2.0f * (PSYS_FRAND(p + 10) - 0.5f); r_vel[1] = 2.0f * (PSYS_FRAND(p + 11) - 0.5f); r_vel[2] = 2.0f * (PSYS_FRAND(p + 12) - 0.5f); @@ -1821,7 +1821,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, else{ pa->lifetime = part->lifetime * ptex.life; - if(part->randlife != 0.0) + if(part->randlife != 0.0f) pa->lifetime *= 1.0f - part->randlife * PSYS_FRAND(p + 21); } @@ -1987,7 +1987,7 @@ void psys_get_pointcache_start_end(Scene *scene, ParticleSystem *psys, int *sfra ParticleSettings *part = psys->part; *sfra = MAX2(1, (int)part->sta); - *efra = MIN2((int)(part->end + part->lifetime + 1.0), scene->r.efra); + *efra = MIN2((int)(part->end + part->lifetime + 1.0f), scene->r.efra); } /************************************************/ @@ -2516,7 +2516,7 @@ static void basic_force_cb(void *efdata_v, ParticleKey *state, float *force, flo madd_v3_v3fl(force, state->vel, -part->dragfac * pa->size * pa->size * len_v3(state->vel)); /* brownian force */ - if(part->brownfac != 0.0){ + if(part->brownfac != 0.0f){ force[0] += (BLI_frand()-0.5f) * part->brownfac; force[1] += (BLI_frand()-0.5f) * part->brownfac; force[2] += (BLI_frand()-0.5f) * part->brownfac; @@ -2559,7 +2559,7 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa /* finally we do guides */ time=(cfra-pa->time)/pa->lifetime; - CLAMP(time,0.0,1.0); + CLAMP(time, 0.0f, 1.0f); VECCOPY(tkey.co,pa->state.co); VECCOPY(tkey.vel,pa->state.vel); @@ -2599,8 +2599,8 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f } rotfac=len_v3(pa->state.ave); - if(rotfac==0.0){ /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */ - rot1[0]=1.0; + if(rotfac == 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; } else{ @@ -3093,8 +3093,8 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR float frict = pd->pdef_frict + pd->pdef_rfrict * 2 * (BLI_frand() - 0.5f); float distance, nor[3], dot; - CLAMP(damp,0.0,1.0); - CLAMP(frict,0.0,1.0); + CLAMP(damp,0.0f, 1.0f); + CLAMP(frict,0.0f, 1.0f); /* get exact velocity right before collision */ madd_v3_v3v3fl(v0, col->ve1, col->acc, dt1); @@ -3141,7 +3141,7 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR /* convert to angular velocity*/ cross_v3_v3v3(ave, vr_tan, pce->nor); - mul_v3_fl(ave, 1.0f/MAX2(pa->size, 0.001)); + mul_v3_fl(ave, 1.0f/MAX2(pa->size, 0.001f)); /* only friction will cause change in linear & angular velocity */ interp_v3_v3v3(pa->state.ave, pa->state.ave, ave, frict); @@ -3329,7 +3329,7 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra) if(!(psys->part->type == PART_HAIR) || (psys->flag & PSYS_HAIR_DONE)) { distribute_particles(sim, PART_FROM_CHILD); - if(part->childtype==PART_CHILD_FACES && part->parents!=0.0) + if(part->childtype==PART_CHILD_FACES && part->parents != 0.0f) psys_find_parents(sim); } } @@ -3582,11 +3582,11 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) timestep = psys_get_timestep(sim); dtime= dfra*timestep; - if(dfra<0.0){ + if(dfra < 0.0f) { LOOP_EXISTING_PARTICLES { psys_get_texture(sim, pa, &ptex, PAMAP_SIZE, cfra); pa->size = part->size*ptex.size; - if(part->randsize > 0.0) + if(part->randsize > 0.0f) pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1); reset_particle(sim, pa, dtime, cfra); @@ -3641,7 +3641,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) psys_get_texture(sim, pa, &ptex, PAMAP_SIZE, cfra); pa->size = part->size*ptex.size; - if(part->randsize > 0.0) + if(part->randsize > 0.0f) pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1); birthtime = pa->time; @@ -3785,7 +3785,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra) LOOP_PARTICLES { psys_get_texture(sim, pa, &ptex, PAMAP_SIZE, cfra); pa->size = part->size*ptex.size; - if(part->randsize > 0.0) + if(part->randsize > 0.0f) pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1); psys->lattice= psys_get_lattice(sim); @@ -4310,7 +4310,7 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) LOOP_EXISTING_PARTICLES { pa->size = part->size; - if(part->randsize > 0.0) + if(part->randsize > 0.0f) pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1); reset_particle(&sim, pa, 0.0, cfra); -- cgit v1.2.3