diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-02-10 12:18:04 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-02-10 12:18:04 +0300 |
commit | 3bcb1ebdfeb9cfb39abfcc9cc063001432f94975 (patch) | |
tree | 7f7d93ad03cf2025b5d18d55ab2ab6235b25b5fe /source | |
parent | 8243e65ed813842c21808c531bcc5f8cbb59c642 (diff) |
2.5: Silencing MSVC warnings in a few files (many files still have many to clean out some other day).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 56 | ||||
-rw-r--r-- | source/blender/blenlib/intern/arithb.c | 259 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 30 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_header.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_time/space_time.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_time/time_header.c | 20 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawarmature.c | 203 |
8 files changed, 296 insertions, 304 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 53fa5d8570f..610e513aa65 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -699,7 +699,7 @@ float dof_camera(Object *ob) { Camera *cam = (Camera *)ob->data; if (ob->type != OB_CAMERA) - return 0.0; + return 0.0f; if (cam->dof_ob) { /* too simple, better to return the distance on the view axis only * return VecLenf(ob->obmat[3], cam->dof_ob->obmat[3]); */ @@ -709,7 +709,7 @@ float dof_camera(Object *ob) Mat4Ortho(obmat); Mat4Invert(ob->imat, obmat); Mat4MulMat4(mat, cam->dof_ob->obmat, ob->imat); - return fabs(mat[3][2]); + return (float)fabs(mat[3][2]); } return cam->YF_dofdist; } @@ -720,26 +720,26 @@ void *add_lamp(char *name) la= alloc_libblock(&G.main->lamp, ID_LA, name); - la->r= la->g= la->b= la->k= 1.0; - la->haint= la->energy= 1.0; - la->dist= 20.0; - la->spotsize= 45.0; - la->spotblend= 0.15; - la->att2= 1.0; + la->r= la->g= la->b= la->k= 1.0f; + la->haint= la->energy= 1.0f; + la->dist= 20.0f; + la->spotsize= 45.0f; + la->spotblend= 0.15f; + la->att2= 1.0f; la->mode= LA_SHAD_BUF; la->bufsize= 512; - la->clipsta= 0.5; - la->clipend= 40.0; - la->shadspotsize= 45.0; + la->clipsta= 0.5f; + la->clipend= 40.0f; + la->shadspotsize= 45.0f; la->samp= 3; - la->bias= 1.0; - la->soft= 3.0; + la->bias= 1.0f; + la->soft= 3.0f; la->ray_samp= la->ray_sampy= la->ray_sampz= 1; - la->area_size=la->area_sizey=la->area_sizez= 1.0; + la->area_size=la->area_sizey=la->area_sizez= 1.0f; la->buffers= 1; la->buftype= LA_SHADBUF_HALFWAY; la->ray_samp_method = LA_SAMP_HALTON; - la->adapt_thresh = 0.001; + la->adapt_thresh = 0.001f; la->preview=NULL; la->falloff_type = LA_FALLOFF_INVLINEAR; la->curfalloff = curvemapping_add(1, 0.0f, 1.0f, 1.0f, 0.0f); @@ -748,12 +748,12 @@ void *add_lamp(char *name) la->spread = 1.0; la->sun_brightness = 1.0; la->sun_size = 1.0; - la->backscattered_light = 1.0; - la->atm_turbidity = 2.0; - la->atm_inscattering_factor = 1.0; - la->atm_extinction_factor = 1.0; - la->atm_distance_factor = 1.0; - la->sun_intensity = 1.0; + la->backscattered_light = 1.0f; + la->atm_turbidity = 2.0f; + la->atm_inscattering_factor = 1.0f; + la->atm_extinction_factor = 1.0f; + la->atm_distance_factor = 1.0f; + la->sun_intensity = 1.0f; la->skyblendtype= MA_RAMP_ADD; la->skyblendfac= 1.0f; la->sky_colorspace= BLI_CS_CIE; @@ -1864,7 +1864,6 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime) /* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */ pop= 0; if(no_parent_ipo==0 && stime != par->ctime) { - // only for ipo systems? pushdata(par, sizeof(Object)); pop= 1; @@ -1874,16 +1873,15 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime) } solve_parenting(scene, ob, par, ob->obmat, slowmat, 0); - + if(pop) { poplast(par); } if(ob->partype & PARSLOW) { // include framerate - - fac1= (1.0f/(1.0f+ fabs(give_timeoffset(ob)))); - if(fac1>=1.0) return; + fac1= ( 1.0f / (1.0f + (float)fabs(give_timeoffset(ob))) ); + if(fac1 >= 1.0f) return; fac2= 1.0f-fac1; fp1= ob->obmat[0]; @@ -1892,7 +1890,6 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime) fp1[0]= fac1*fp1[0] + fac2*fp2[0]; } } - } else { object_to_mat4(ob, ob->obmat); @@ -1902,7 +1899,6 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime) if(ob->track) { if( ctime != ob->track->ctime) where_is_object_time(scene, ob->track, ctime); solve_tracking (ob, ob->track->obmat); - } /* solve constraints */ @@ -2088,7 +2084,7 @@ for a lamp that is the child of another object */ bConstraintOb *cob; cob= constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT); - solve_constraints (&ob->constraints, cob, scene->r.cfra); + solve_constraints(&ob->constraints, cob, (float)scene->r.cfra); constraints_clear_evalob(cob); } @@ -2127,7 +2123,7 @@ void what_does_parent(Scene *scene, Object *ob, Object *workob) BoundBox *unit_boundbox() { BoundBox *bb; - float min[3] = {-1,-1,-1}, max[3] = {-1,-1,-1}; + float min[3] = {-1.0f,-1.0f,-1.0f}, max[3] = {-1.0f,-1.0f,-1.0f}; bb= MEM_callocN(sizeof(BoundBox), "bb"); boundbox_set_from_min_max(bb, min, max); diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c index 0d65e615039..0df4792cd3d 100644 --- a/source/blender/blenlib/intern/arithb.c +++ b/source/blender/blenlib/intern/arithb.c @@ -1599,16 +1599,16 @@ void QuatInterpolW(float *result, float *quat1, float *quat2, float t) cosom = quat1[0]*quat2[0] + quat1[1]*quat2[1] + quat1[2]*quat2[2] + quat1[3]*quat2[3] ; /* rotate around shortest angle */ - if ((1.0 + cosom) > 0.0001) { + if ((1.0f + cosom) > 0.0001f) { - if ((1.0 - cosom) > 0.0001) { - omega = acos(cosom); - sinom = sin(omega); - sc1 = sin((1.0 - t) * omega) / sinom; - sc2 = sin(t * omega) / sinom; + if ((1.0f - cosom) > 0.0001f) { + omega = (float)acos(cosom); + sinom = (float)sin(omega); + sc1 = (float)sin((1.0 - t) * omega) / sinom; + sc2 = (float)sin(t * omega) / sinom; } else { - sc1 = 1.0 - t; + sc1 = 1.0f - t; sc2 = t; } result[0] = sc1*quat1[0] + sc2*quat2[0]; @@ -1622,9 +1622,9 @@ void QuatInterpolW(float *result, float *quat1, float *quat2, float t) result[2] = quat2[1]; result[3] = -quat2[0]; - sc1 = sin((1.0 - t)*M_PI_2); - sc2 = sin(t*M_PI_2); - + sc1 = (float)sin((1.0 - t)*M_PI_2); + sc2 = (float)sin(t*M_PI_2); + result[0] = sc1*quat1[0] + sc2*result[0]; result[1] = sc1*quat1[1] + sc2*result[1]; result[2] = sc1*quat1[2] + sc2*result[2]; @@ -1639,7 +1639,7 @@ void QuatInterpol(float *result, float *quat1, float *quat2, float t) cosom = quat1[0]*quat2[0] + quat1[1]*quat2[1] + quat1[2]*quat2[2] + quat1[3]*quat2[3] ; /* rotate around shortest angle */ - if (cosom < 0.0) { + if (cosom < 0.0f) { cosom = -cosom; quat[0]= -quat1[0]; quat[1]= -quat1[1]; @@ -1653,13 +1653,13 @@ void QuatInterpol(float *result, float *quat1, float *quat2, float t) quat[3]= quat1[3]; } - if ((1.0 - cosom) > 0.0001) { - omega = acos(cosom); - sinom = sin(omega); - sc1 = sin((1 - t) * omega) / sinom; - sc2 = sin(t * omega) / sinom; + if ((1.0f - cosom) > 0.0001f) { + omega = (float)acos(cosom); + sinom = (float)sin(omega); + sc1 = (float)sin((1 - t) * omega) / sinom; + sc2 = (float)sin(t * omega) / sinom; } else { - sc1= 1.0 - t; + sc1= 1.0f - t; sc2= t; } @@ -1775,7 +1775,7 @@ void DQuatToMat4(DualQuat *dq, float mat[][4]) QuatCopy(q0, dq->quat); /* normalize */ - len= sqrt(QuatDot(q0, q0)); + len= (float)sqrt(QuatDot(q0, q0)); if(len != 0.0f) QuatMulf(q0, 1.0f/len); @@ -1784,9 +1784,9 @@ void DQuatToMat4(DualQuat *dq, float mat[][4]) /* translation */ t= dq->trans; - mat[3][0]= 2.0*(-t[0]*q0[1] + t[1]*q0[0] - t[2]*q0[3] + t[3]*q0[2]); - mat[3][1]= 2.0*(-t[0]*q0[2] + t[1]*q0[3] + t[2]*q0[0] - t[3]*q0[1]); - mat[3][2]= 2.0*(-t[0]*q0[3] - t[1]*q0[2] + t[2]*q0[1] + t[3]*q0[0]); + mat[3][0]= 2.0f*(-t[0]*q0[1] + t[1]*q0[0] - t[2]*q0[3] + t[3]*q0[2]); + mat[3][1]= 2.0f*(-t[0]*q0[2] + t[1]*q0[3] + t[2]*q0[0] - t[3]*q0[1]); + mat[3][2]= 2.0f*(-t[0]*q0[3] - t[1]*q0[2] + t[2]*q0[1] + t[3]*q0[0]); /* note: this does not handle scaling */ } @@ -1815,10 +1815,10 @@ void DQuatAddWeighted(DualQuat *dqsum, DualQuat *dq, float weight) /* interpolate scale - but only if needed */ if (dq->scale_weight) { float wmat[4][4]; - + if(flipped) /* we don't want negative weights for scaling */ weight= -weight; - + Mat4CpyMat4(wmat, dq->scale); Mat4MulFloat((float*)wmat, weight); Mat4AddMat4(dqsum->scale, dqsum->scale, wmat); @@ -1835,7 +1835,7 @@ void DQuatNormalize(DualQuat *dq, float totweight) if(dq->scale_weight) { float addweight= totweight - dq->scale_weight; - + if(addweight) { dq->scale[0][0] += addweight; dq->scale[1][1] += addweight; @@ -2197,7 +2197,7 @@ void VecNegf(float *v1) void VecOrthoBasisf(float *v, float *v1, float *v2) { - float f = sqrt(v[0]*v[0] + v[1]*v[1]); + float f = (float)sqrt(v[0]*v[0] + v[1]*v[1]); if (f < 1e-35f) { // degenerate case @@ -2349,9 +2349,9 @@ double Sqrt3d(double d) void NormalShortToFloat(float *out, short *in) { - out[0] = in[0] / 32767.0; - out[1] = in[1] / 32767.0; - out[2] = in[2] / 32767.0; + out[0] = in[0] / 32767.0f; + out[1] = in[1] / 32767.0f; + out[2] = in[2] / 32767.0f; } void NormalFloatToShort(short *out, float *in) @@ -2488,15 +2488,15 @@ short IsectLL2Ds(short *v1, short *v2, short *v3, short *v4) */ float div, labda, mu; - div= (v2[0]-v1[0])*(v4[1]-v3[1])-(v2[1]-v1[1])*(v4[0]-v3[0]); - if(div==0.0) return -1; + div= (float)((v2[0]-v1[0])*(v4[1]-v3[1])-(v2[1]-v1[1])*(v4[0]-v3[0])); + if(div==0.0f) return -1; labda= ((float)(v1[1]-v3[1])*(v4[0]-v3[0])-(v1[0]-v3[0])*(v4[1]-v3[1]))/div; mu= ((float)(v1[1]-v3[1])*(v2[0]-v1[0])-(v1[0]-v3[0])*(v2[1]-v1[1]))/div; - if(labda>=0.0 && labda<=1.0 && mu>=0.0 && mu<=1.0) { - if(labda==0.0 || labda==1.0 || mu==0.0 || mu==1.0) return 1; + if(labda>=0.0f && labda<=1.0f && mu>=0.0f && mu<=1.0f) { + if(labda==0.0f || labda==1.0f || mu==0.0f || mu==1.0f) return 1; return 2; } return 0; @@ -2655,9 +2655,9 @@ static int BarycentricWeights(float *v1, float *v2, float *v3, float *co, float /* find best projection of face XY, XZ or YZ: barycentric weights of the 2d projected coords are the same and faster to compute */ - xn= fabs(n[0]); - yn= fabs(n[1]); - zn= fabs(n[2]); + xn= (float)fabs(n[0]); + yn= (float)fabs(n[1]); + zn= (float)fabs(n[2]); if(zn>=xn && zn>=yn) {i= 0; j= 1;} else if(yn>=xn && yn>=zn) {i= 0; j= 2;} else {i= 1; j= 2;} @@ -2889,12 +2889,12 @@ void Mat4ToEul(float tmat[][4], float *eul) { float tempMat[3][3]; - Mat3CpyMat4 (tempMat, tmat); + Mat3CpyMat4(tempMat, tmat); Mat3Ortho(tempMat); Mat3ToEul(tempMat, eul); } -void QuatToEul( float *quat, float *eul) +void QuatToEul(float *quat, float *eul) { float mat[3][3]; @@ -2903,7 +2903,7 @@ void QuatToEul( float *quat, float *eul) } -void EulToQuat( float *eul, float *quat) +void EulToQuat(float *eul, float *quat) { float ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss; @@ -2918,7 +2918,7 @@ void EulToQuat( float *eul, float *quat) quat[3] = cj*cs - sj*sc; } -void VecRotToMat3( float *vec, float phi, float mat[][3]) +void VecRotToMat3(float *vec, float phi, float mat[][3]) { /* rotation of phi radials around vec */ float vx, vx2, vy, vy2, vz, vz2, co, si; @@ -2944,7 +2944,7 @@ void VecRotToMat3( float *vec, float phi, float mat[][3]) } -void VecRotToMat4( float *vec, float phi, float mat[][4]) +void VecRotToMat4(float *vec, float phi, float mat[][4]) { float tmat[3][3]; @@ -2953,7 +2953,7 @@ void VecRotToMat4( float *vec, float phi, float mat[][4]) Mat4CpyMat3(mat, tmat); } -void VecRotToQuat( float *vec, float phi, float *quat) +void VecRotToQuat(float *vec, float phi, float *quat) { /* rotation of phi radials around vec */ float si; @@ -2962,7 +2962,7 @@ void VecRotToQuat( float *vec, float phi, float *quat) quat[2]= vec[1]; quat[3]= vec[2]; - if( Normalize(quat+1) == 0.0) { + if( Normalize(quat+1) == 0.0f) { QuatOne(quat); } else { @@ -2986,7 +2986,7 @@ float VecAngle3(float *v1, float *v2, float *v3) Normalize(vec1); Normalize(vec2); - return NormalizedVecAngle2(vec1, vec2) * 180.0/M_PI; + return NormalizedVecAngle2(vec1, vec2) * (float)(180.0/M_PI); } float VecAngle3_2D(float *v1, float *v2, float *v3) @@ -3002,7 +3002,7 @@ float VecAngle3_2D(float *v1, float *v2, float *v3) Normalize2(vec1); Normalize2(vec2); - return NormalizedVecAngle2_2D(vec1, vec2) * 180.0/M_PI; + return NormalizedVecAngle2_2D(vec1, vec2) * (float)(180.0/M_PI); } /* Return the shortest angle in degrees between the 2 vectors */ @@ -3015,7 +3015,7 @@ float VecAngle2(float *v1, float *v2) Normalize(vec1); Normalize(vec2); - return NormalizedVecAngle2(vec1, vec2)* 180.0/M_PI; + return NormalizedVecAngle2(vec1, vec2)* (float)(180.0/M_PI); } float NormalizedVecAngle2(float *v1, float *v2) @@ -3027,11 +3027,11 @@ float NormalizedVecAngle2(float *v1, float *v2) vec[0]= -v2[0]; vec[1]= -v2[1]; vec[2]= -v2[2]; - - return (float)M_PI - 2.0f*saasin(VecLenf(vec, v1)/2.0f); + + return (float)M_PI - 2.0f*(float)saasin(VecLenf(vec, v1)/2.0f); } else - return 2.0f*saasin(VecLenf(v2, v1)/2.0); + return 2.0f*(float)saasin(VecLenf(v2, v1)/2.0f); } float NormalizedVecAngle2_2D(float *v1, float *v2) @@ -3042,18 +3042,18 @@ float NormalizedVecAngle2_2D(float *v1, float *v2) vec[0]= -v2[0]; vec[1]= -v2[1]; - + return (float)M_PI - 2.0f*saasin(Vec2Lenf(vec, v1)/2.0f); } else - return 2.0f*saasin(Vec2Lenf(v2, v1)/2.0); + return 2.0f*(float)saasin(Vec2Lenf(v2, v1)/2.0f); } void euler_rot(float *beul, float ang, char axis) { float eul[3], mat1[3][3], mat2[3][3], totmat[3][3]; - eul[0]= eul[1]= eul[2]= 0.0; + eul[0]= eul[1]= eul[2]= 0.0f; if(axis=='x') eul[0]= ang; else if(axis=='y') eul[1]= ang; else eul[2]= ang; @@ -3073,33 +3073,32 @@ void compatible_eul(float *eul, float *oldrot) float dx, dy, dz; /* correct differences of about 360 degrees first */ - dx= eul[0] - oldrot[0]; dy= eul[1] - oldrot[1]; dz= eul[2] - oldrot[2]; - while( fabs(dx) > 5.1) { - if(dx > 0.0) eul[0] -= 2.0*M_PI; else eul[0]+= 2.0*M_PI; + while(fabs(dx) > 5.1) { + if(dx > 0.0f) eul[0] -= 2.0f*(float)M_PI; else eul[0]+= 2.0f*(float)M_PI; dx= eul[0] - oldrot[0]; } - while( fabs(dy) > 5.1) { - if(dy > 0.0) eul[1] -= 2.0*M_PI; else eul[1]+= 2.0*M_PI; + while(fabs(dy) > 5.1) { + if(dy > 0.0f) eul[1] -= 2.0f*(float)M_PI; else eul[1]+= 2.0f*(float)M_PI; dy= eul[1] - oldrot[1]; } - while( fabs(dz) > 5.1 ) { - if(dz > 0.0) eul[2] -= 2.0*M_PI; else eul[2]+= 2.0*M_PI; + while(fabs(dz) > 5.1) { + if(dz > 0.0f) eul[2] -= 2.0f*(float)M_PI; else eul[2]+= 2.0f*(float)M_PI; dz= eul[2] - oldrot[2]; } /* is 1 of the axis rotations larger than 180 degrees and the other small? NO ELSE IF!! */ if( fabs(dx) > 3.2 && fabs(dy)<1.6 && fabs(dz)<1.6 ) { - if(dx > 0.0) eul[0] -= 2.0*M_PI; else eul[0]+= 2.0*M_PI; + if(dx > 0.0) eul[0] -= 2.0f*(float)M_PI; else eul[0]+= 2.0f*(float)M_PI; } if( fabs(dy) > 3.2 && fabs(dz)<1.6 && fabs(dx)<1.6 ) { - if(dy > 0.0) eul[1] -= 2.0*M_PI; else eul[1]+= 2.0*M_PI; + if(dy > 0.0) eul[1] -= 2.0f*(float)M_PI; else eul[1]+= 2.0f*(float)M_PI; } if( fabs(dz) > 3.2 && fabs(dx)<1.6 && fabs(dy)<1.6 ) { - if(dz > 0.0) eul[2] -= 2.0*M_PI; else eul[2]+= 2.0*M_PI; + if(dz > 0.0) eul[2] -= 2.0f*(float)M_PI; else eul[2]+= 2.0f*(float)M_PI; } /* the method below was there from ancient days... but why! probably because the code sucks :) @@ -3142,8 +3141,8 @@ void Mat3ToCompatibleEul(float mat[][3], float *eul, float *oldrot) compatible_eul(eul1, oldrot); compatible_eul(eul2, oldrot); - d1= fabs(eul1[0]-oldrot[0]) + fabs(eul1[1]-oldrot[1]) + fabs(eul1[2]-oldrot[2]); - d2= fabs(eul2[0]-oldrot[0]) + fabs(eul2[1]-oldrot[1]) + fabs(eul2[2]-oldrot[2]); + d1= (float)fabs(eul1[0]-oldrot[0]) + (float)fabs(eul1[1]-oldrot[1]) + (float)fabs(eul1[2]-oldrot[2]); + d2= (float)fabs(eul2[0]-oldrot[0]) + (float)fabs(eul2[1]-oldrot[1]) + (float)fabs(eul2[2]-oldrot[2]); /* return best, which is just the one with lowest difference */ if( d1 > d2) { @@ -3160,14 +3159,14 @@ void Mat3ToCompatibleEul(float mat[][3], float *eul, float *oldrot) void SizeToMat3( float *size, float mat[][3]) { mat[0][0]= size[0]; - mat[0][1]= 0.0; - mat[0][2]= 0.0; + mat[0][1]= 0.0f; + mat[0][2]= 0.0f; mat[1][1]= size[1]; - mat[1][0]= 0.0; - mat[1][2]= 0.0; + mat[1][0]= 0.0f; + mat[1][2]= 0.0f; mat[2][2]= size[2]; - mat[2][1]= 0.0; - mat[2][0]= 0.0; + mat[2][1]= 0.0f; + mat[2][0]= 0.0f; } void SizeToMat4( float *size, float mat[][4]) @@ -3199,7 +3198,7 @@ void Mat4ToSize( float mat[][4], float *size) float Mat3ToScalef(float mat[][3]) { /* unit length vector */ - float unit_vec[3] = {0.577350269189626, 0.577350269189626, 0.577350269189626}; + float unit_vec[3] = {0.577350269189626f, 0.577350269189626f, 0.577350269189626f}; Mat3MulVecfl(mat, unit_vec); return VecLength(unit_vec); } @@ -3224,12 +3223,12 @@ void triatoquat( float *v1, float *v2, float *v3, float *quat) n[0]= vec[1]; n[1]= -vec[0]; - n[2]= 0.0; + n[2]= 0.0f; Normalize(n); - if(n[0]==0.0 && n[1]==0.0) n[0]= 1.0; + if(n[0]==0.0f && n[1]==0.0f) n[0]= 1.0f; - angle= -0.5f*saacos(vec[2]); + angle= -0.5f*(float)saacos(vec[2]); co= (float)cos(angle); si= (float)sin(angle); q1[0]= co; @@ -3244,7 +3243,7 @@ void triatoquat( float *v1, float *v2, float *v3, float *quat) Mat3MulVecfl(imat, vec); /* what angle has this line with x-axis? */ - vec[2]= 0.0; + vec[2]= 0.0f; Normalize(vec); angle= (float)(0.5*atan2(vec[1], vec[0])); @@ -3319,12 +3318,11 @@ float Normalize2(float *n) if(d>1.0e-35F) { d= (float)sqrt(d); - n[0]/=d; n[1]/=d; } else { - n[0]=n[1]= 0.0; - d= 0.0; + n[0]=n[1]= 0.0f; + d= 0.0f; } return d; } @@ -3389,9 +3387,9 @@ void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b) void rgb_to_yuv(float r, float g, float b, float *ly, float *lu, float *lv) { float y, u, v; - y= 0.299*r + 0.587*g + 0.114*b; - u=-0.147*r - 0.289*g + 0.436*b; - v= 0.615*r - 0.515*g - 0.100*b; + y= 0.299f*r + 0.587f*g + 0.114f*b; + u=-0.147f*r - 0.289f*g + 0.436f*b; + v= 0.615f*r - 0.515f*g - 0.100f*b; *ly=y; *lu=u; @@ -3401,9 +3399,9 @@ void rgb_to_yuv(float r, float g, float b, float *ly, float *lu, float *lv) void yuv_to_rgb(float y, float u, float v, float *lr, float *lg, float *lb) { float r, g, b; - r=y+1.140*v; - g=y-0.394*u - 0.581*v; - b=y+2.032*u; + r=y+1.140f*v; + g=y-0.394f*u - 0.581f*v; + b=y+2.032f*u; *lr=r; *lg=g; @@ -3415,14 +3413,14 @@ void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr) float sr,sg, sb; float y, cr, cb; - sr=255.0*r; - sg=255.0*g; - sb=255.0*b; + sr=255.0f*r; + sg=255.0f*g; + sb=255.0f*b; - y=(0.257*sr)+(0.504*sg)+(0.098*sb)+16.0; - cb=(-0.148*sr)-(0.291*sg)+(0.439*sb)+128.0; - cr=(0.439*sr)-(0.368*sg)-(0.071*sb)+128.0; + y=(0.257f*sr)+(0.504f*sg)+(0.098f*sb)+16.0f; + cb=(-0.148f*sr)-(0.291f*sg)+(0.439f*sb)+128.0f; + cr=(0.439f*sr)-(0.368f*sg)-(0.071f*sb)+128.0f; *ly=y; *lcb=cb; @@ -3433,13 +3431,13 @@ void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb) { float r,g,b; - r=1.164*(y-16)+1.596*(cr-128); - g=1.164*(y-16)-0.813*(cr-128)-0.392*(cb-128); - b=1.164*(y-16)+2.017*(cb-128); + r=1.164f*(y-16.0f)+1.596f*(cr-128.0f); + g=1.164f*(y-16.0f)-0.813f*(cr-128.0f)-0.392f*(cb-128.0f); + b=1.164f*(y-16.0f)+2.017f*(cb-128.0f); - *lr=r/255.0; - *lg=g/255.0; - *lb=b/255.0; + *lr=r/255.0f; + *lg=g/255.0f; + *lb=b/255.0f; } void hex_to_rgb(char *hexcol, float *r, float *g, float *b) @@ -3449,9 +3447,9 @@ void hex_to_rgb(char *hexcol, float *r, float *g, float *b) if (hexcol[0] == '#') hexcol++; if (sscanf(hexcol, "%02x%02x%02x", &ri, &gi, &bi)) { - *r = ri / 255.0; - *g = gi / 255.0; - *b = bi / 255.0; + *r = ri / 255.0f; + *g = gi / 255.0f; + *b = bi / 255.0f; } } @@ -3469,14 +3467,14 @@ void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv) cmin = (b<cmin ? b:cmin); v = cmax; /* value */ - if (cmax!=0.0) + if (cmax != 0.0f) s = (cmax - cmin)/cmax; else { - s = 0.0; - h = 0.0; + s = 0.0f; + h = 0.0f; } - if (s == 0.0) - h = -1.0; + if (s == 0.0f) + h = -1.0f; else { cdelta = cmax-cmin; rc = (cmax-r)/cdelta; @@ -3490,13 +3488,13 @@ void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv) else h = 4.0f+gc-rc; h = h*60.0f; - if (h<0.0f) + if (h < 0.0f) h += 360.0f; } *ls = s; - *lh = h/360.0f; - if( *lh < 0.0) *lh= 0.0; + *lh = h / 360.0f; + if(*lh < 0.0f) *lh= 0.0f; *lv = v; } @@ -3506,14 +3504,14 @@ void xyz_to_rgb(float xc, float yc, float zc, float *r, float *g, float *b, int { switch (colorspace) { case BLI_CS_SMPTE: - *r = (3.50570 * xc) + (-1.73964 * yc) + (-0.544011 * zc); - *g = (-1.06906 * xc) + (1.97781 * yc) + (0.0351720 * zc); - *b = (0.0563117 * xc) + (-0.196994 * yc) + (1.05005 * zc); + *r = (3.50570f * xc) + (-1.73964f * yc) + (-0.544011f * zc); + *g = (-1.06906f * xc) + (1.97781f * yc) + (0.0351720f * zc); + *b = (0.0563117f * xc) + (-0.196994f * yc) + (1.05005f * zc); break; case BLI_CS_REC709: - *r = (3.240476 * xc) + (-1.537150 * yc) + (-0.498535 * zc); - *g = (-0.969256 * xc) + (1.875992 * yc) + (0.041556 * zc); - *b = (0.055648 * xc) + (-0.204043 * yc) + (1.057311 * zc); + *r = (3.240476f * xc) + (-1.537150f * yc) + (-0.498535f * zc); + *g = (-0.969256f * xc) + (1.875992f * yc) + (0.041556f * zc); + *b = (0.055648f * xc) + (-0.204043f * yc) + (1.057311f * zc); break; case BLI_CS_CIE: *r = (2.28783848734076f * xc) + (-0.833367677835217f * yc) + (-0.454470795871421f * zc); @@ -3558,13 +3556,12 @@ int constrain_rgb(float *r, float *g, float *b) static void gamma_correct(float *c) { /* Rec. 709 gamma correction. */ - float cc = 0.018; + float cc = 0.018f; - if (*c < cc) { - *c *= ((1.099 * pow(cc, 0.45)) - 0.099) / cc; - } else { - *c = (1.099 * pow(*c, 0.45)) - 0.099; - } + if (*c < cc) + *c *= ((1.099f * (float)pow(cc, 0.45)) - 0.099f) / cc; + else + *c = (1.099f * (float)pow(*c, 0.45)) - 0.099f; } void gamma_correct_rgb(float *r, float *g, float *b) @@ -3630,14 +3627,13 @@ void tubemap(float x, float y, float z, float *u, float *v) { float len; - *v = (z + 1.0) / 2.0; + *v = (z + 1.0f) / 2.0f; - len= sqrt(x*x+y*y); - if(len>0) { - *u = (1.0 - (atan2(x/len,y/len) / M_PI)) / 2.0; - } else { + len= (float)sqrt(x*x+y*y); + if(len > 0.0f) + *u = (float)((1.0 - (atan2(x/len,y/len) / M_PI)) / 2.0); + else *v = *u = 0.0f; /* to avoid un-initialized variables */ - } } /* ------------------------------------------------------------------------- */ @@ -3646,14 +3642,13 @@ void spheremap(float x, float y, float z, float *u, float *v) { float len; - len= sqrt(x*x+y*y+z*z); - if(len>0.0) { - - if(x==0.0 && y==0.0) *u= 0.0; /* othwise domain error */ - else *u = (1.0 - atan2(x,y)/M_PI )/2.0; + len= (float)sqrt(x*x+y*y+z*z); + if(len > 0.0f) { + if(x==0.0f && y==0.0f) *u= 0.0f; /* othwise domain error */ + else *u = (float)((1.0 - (float)atan2(x,y) / M_PI) / 2.0); z/=len; - *v = 1.0- saacos(z)/M_PI; + *v = 1.0f - (float)saacos(z)/(float)M_PI; } else { *v = *u = 0.0f; /* to avoid un-initialized variables */ } @@ -3913,7 +3908,7 @@ static int getLowestRoot(float a, float b, float c, float maxR, float* root) { // calculate the two roots: (if determinant == 0 then // x1==x2 but let’s disregard that slight optimization) - float sqrtD = sqrt(determinant); + float sqrtD = (float)sqrt(determinant); float r1 = (-b - sqrtD) / (2.0f*a); float r2 = (-b + sqrtD) / (2.0f*a); @@ -4694,5 +4689,5 @@ void tangent_from_uv(float *uv1, float *uv2, float *uv3, float *co1, float *co2, /* used for zoom values*/ float power_of_2(float val) { - return pow(2, ceil(log(val) / log(2))); + return (float)pow(2, ceil(log(val) / log(2))); } diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 6e575ab1952..be763cb21c7 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -162,18 +162,18 @@ void make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent) VECCOPY(eBone->head, curBone->arm_head); VECCOPY(eBone->tail, curBone->arm_tail); - eBone->roll= 0.0; + eBone->roll= 0.0f; /* roll fixing */ VecSubf(delta, eBone->tail, eBone->head); - vec_roll_to_mat3(delta, 0.0, postmat); + vec_roll_to_mat3(delta, 0.0f, postmat); Mat3CpyMat4(premat, curBone->arm_mat); Mat3Inv(imat, postmat); Mat3MulMat3(difmat, imat, premat); - eBone->roll = atan2(difmat[2][0], difmat[2][2]); + eBone->roll = (float)atan2(difmat[2][0], difmat[2][2]); /* rest of stuff copy */ eBone->length= curBone->length; @@ -234,7 +234,7 @@ static void fix_bonelist_roll (ListBase *bonelist, ListBase *editbonelist) printmatrix4("difmat", difmat); printf ("Roll = %f\n", (-atan2(difmat[2][0], difmat[2][2]) * (180.0/M_PI))); #endif - curBone->roll = -atan2(difmat[2][0], difmat[2][2]); + curBone->roll = (float)-atan2(difmat[2][0], difmat[2][2]); /* and set restposition again */ where_is_armature_bone(curBone, curBone->parent); @@ -403,13 +403,13 @@ void docenter_armature (Scene *scene, View3D *v3d, Object *ob, int centermode) DO_MINMAX(ebone->tail, min, max); } - cent[0]= (min[0]+max[0])/2.0f; - cent[1]= (min[1]+max[1])/2.0f; - cent[2]= (min[2]+max[2])/2.0f; + cent[0]= (min[0] + max[0]) / 2.0f; + cent[1]= (min[1] + max[1]) / 2.0f; + cent[2]= (min[2] + max[2]) / 2.0f; } /* Do the adjustments */ - for (ebone= arm->edbo->first; ebone; ebone=ebone->next){ + for (ebone= arm->edbo->first; ebone; ebone=ebone->next) { VecSubf(ebone->head, ebone->head, cent); VecSubf(ebone->tail, ebone->tail, cent); } @@ -422,9 +422,9 @@ void docenter_armature (Scene *scene, View3D *v3d, Object *ob, int centermode) Mat3CpyMat4(omat, ob->obmat); Mat3MulVecfl(omat, cent); - ob->loc[0]+= cent[0]; - ob->loc[1]+= cent[1]; - ob->loc[2]+= cent[2]; + ob->loc[0] += cent[0]; + ob->loc[1] += cent[1]; + ob->loc[2] += cent[2]; } else ED_armature_edit_free(ob); @@ -477,7 +477,7 @@ void unique_editbone_name (ListBase *edbo, char *name) *dot=0; } - for (number = 1; number <=999; number++) { + for (number = 1; number <= 999; number++) { sprintf(tempname, "%s.%03d", name, number); if (!editbone_name_exists(edbo, tempname)) { BLI_strncpy(name, tempname, 32); @@ -745,7 +745,7 @@ int join_armature(Scene *scene, View3D *v3d) Mat4Invert(imat, premat); Mat4MulMat4(difmat, postmat, imat); - curbone->roll -= atan2(difmat[2][0], difmat[2][2]); + curbone->roll -= (float)atan2(difmat[2][0], difmat[2][2]); } /* Fix Constraints and Other Links to this Bone and Armature */ @@ -1905,7 +1905,7 @@ void auto_align_ebone_tocursor(Scene *scene, View3D *v3d, EditBone *ebone) /* check that cursor is in usable position */ if ((IS_EQ(vec[0], 0)==0) && (IS_EQ(vec[2], 0)==0)) { /* Compute a rotation matrix around y */ - rot[1] = atan2(vec[0], vec[2]); + rot[1] = (float)atan2(vec[0], vec[2]); rot[0] = rot[2] = 0.0f; EulToMat4(rot, rmat); @@ -2359,7 +2359,7 @@ void adduplicate_armature(Scene *scene) /* Lets duplicate the list of constraints that the * current bone has. */ - if (OBACT->pose) { + if (obedit->pose) { bPoseChannel *chanold, *channew; ListBase *listold, *listnew; diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index fb3195db030..fbc475d3bdd 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -3510,7 +3510,7 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase * if((tselem->flag & TSE_CLOSED)==0) { outliner_draw_struct_marks(ar, soops, &te->subtree, starty); if(tselem->type == TSE_RNA_STRUCT) - fdrawline(0, *starty+OL_H-1, (int)ar->v2d.cur.xmax, *starty+OL_H-1); + fdrawline(0, (float)*starty+OL_H-1, ar->v2d.cur.xmax, (float)*starty+OL_H-1); } } } @@ -3919,14 +3919,14 @@ static void outliner_draw_rnacols(ARegion *ar, SpaceOops *soops, int sizex) UI_ThemeColorShadeAlpha(TH_BACK, -15, -200); /* draw column separator lines */ - fdrawline(sizex, + fdrawline((float)sizex, v2d->cur.ymax, - sizex, + (float)sizex, v2d->cur.ymin); - fdrawline(sizex+OL_RNA_COL_SIZEX, + fdrawline((float)sizex+OL_RNA_COL_SIZEX, v2d->cur.ymax, - sizex+OL_RNA_COL_SIZEX, + (float)sizex+OL_RNA_COL_SIZEX, v2d->cur.ymin); } @@ -3945,15 +3945,15 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa if(tselem->type == TSE_RNA_PROPERTY) { ptr= &te->rnaptr; prop= te->directdata; - + if(!(RNA_property_type(ptr, prop) == PROP_POINTER && (tselem->flag & TSE_CLOSED)==0)) - uiDefAutoButR(block, ptr, prop, -1, "", sizex, te->ys, OL_RNA_COL_SIZEX, OL_H-1); + uiDefAutoButR(block, ptr, prop, -1, "", sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1); } else if(tselem->type == TSE_RNA_ARRAY_ELEM) { ptr= &te->rnaptr; prop= te->directdata; - - uiDefAutoButR(block, ptr, prop, te->index, "", sizex, te->ys, OL_RNA_COL_SIZEX, OL_H-1); + + uiDefAutoButR(block, ptr, prop, te->index, "", sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1); } } diff --git a/source/blender/editors/space_outliner/outliner_header.c b/source/blender/editors/space_outliner/outliner_header.c index 1f3bf71f814..2c114f3099b 100644 --- a/source/blender/editors/space_outliner/outliner_header.c +++ b/source/blender/editors/space_outliner/outliner_header.c @@ -199,16 +199,16 @@ void outliner_header_buttons(const bContext *C, ARegion *ar) uiBlockSetEmboss(block, UI_EMBOSS); } - if(1) { // XXX soutliner->type==SO_OUTLINER) { + //if (outliner->type==SO_OUTLINER) { if(G.main->library.first) uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10|Datablocks %x11|User Preferences %x12", xco, yco, 120, 20, &soutliner->outlinevis, 0, 0, 0, 0, ""); else uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10|Datablocks %x11|User Preferences %x12", xco, yco, 120, 20, &soutliner->outlinevis, 0, 0, 0, 0, ""); - } + //} /* always as last */ - UI_view2d_totRect_set(&ar->v2d, xco+XIC+100, ar->v2d.tot.ymax-ar->v2d.tot.ymin); + UI_view2d_totRect_set(&ar->v2d, xco+XIC+100, (int)(ar->v2d.tot.ymax-ar->v2d.tot.ymin)); uiEndBlock(C, block); uiDrawBlock(C, block); diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 5b36939a471..d28fdc7f371 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -93,8 +93,8 @@ static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime, ARegion *ar UI_ThemeColorShade(TH_BACK, -25); if (PSFRA < PEFRA) { - glRectf(v2d->cur.xmin, v2d->cur.ymin, PSFRA, v2d->cur.ymax); - glRectf(PEFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); + glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax); + glRectf((float)PEFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); } else { glRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); @@ -102,8 +102,8 @@ static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime, ARegion *ar UI_ThemeColorShade(TH_BACK, -60); /* thin lines where the actual frames are */ - fdrawline(PSFRA, v2d->cur.ymin, PSFRA, v2d->cur.ymax); - fdrawline(PEFRA, v2d->cur.ymin, PEFRA, v2d->cur.ymax); + fdrawline((float)PSFRA, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax); + fdrawline((float)PEFRA, v2d->cur.ymin, (float)PEFRA, v2d->cur.ymax); } /* add handlers, stuff you only do once or on area/region changes */ diff --git a/source/blender/editors/space_time/time_header.c b/source/blender/editors/space_time/time_header.c index e4acf052534..65946a4288b 100644 --- a/source/blender/editors/space_time/time_header.c +++ b/source/blender/editors/space_time/time_header.c @@ -469,28 +469,28 @@ void time_header_buttons(const bContext *C, ARegion *ar) if (scene->r.psfra) { uiDefButI(block, NUM, B_REDRAWALL,"Start:", - xco,yco, 4.5*XIC, YIC, + xco,yco, (int)4.5*XIC, YIC, &scene->r.psfra,MINFRAMEF, MAXFRAMEF, 0, 0, "The start frame of the animation preview (inclusive)"); - xco += (short)(4.5*XIC); + xco += (int)(4.5*XIC); uiDefButI(block, NUM, B_REDRAWALL,"End:", - xco,yco,4.5*XIC,YIC, - &scene->r.pefra,PSFRA,MAXFRAMEF, 0, 0, + xco,yco, (int)4.5*XIC,YIC, + &scene->r.pefra,(float)PSFRA, MAXFRAMEF, 0, 0, "The end frame of the animation preview (inclusive)"); } else { uiDefButI(block, NUM, B_REDRAWALL,"Start:", - xco,yco, 4.5*XIC, YIC, + xco,yco, (int)4.5*XIC, YIC, &scene->r.sfra,MINFRAMEF, MAXFRAMEF, 0, 0, "The start frame of the animation (inclusive)"); xco += (short)(4.5*XIC); uiDefButI(block, NUM, B_REDRAWALL,"End:", - xco,yco,4.5*XIC,YIC, - &scene->r.efra,(float)SFRA,MAXFRAMEF, 0, 0, + xco,yco, (int)4.5*XIC,YIC, + &scene->r.efra,(float)SFRA, MAXFRAMEF, 0, 0, "The end frame of the animation (inclusive)"); } uiBlockEndAlign(block); @@ -498,7 +498,7 @@ void time_header_buttons(const bContext *C, ARegion *ar) xco += (short)(4.5 * XIC + 16); uiDefButI(block, NUM, B_NEWFRAME, "", - xco,yco,3.5*XIC,YIC, + xco,yco, (int)3.5*XIC,YIC, &(scene->r.cfra), MINFRAMEF, MAXFRAMEF, 0, 0, "Displays Current Frame of animation"); @@ -532,7 +532,7 @@ void time_header_buttons(const bContext *C, ARegion *ar) if (scene->autokey_mode & AUTOKEY_ON) { uiDefButS(block, MENU, REDRAWINFO, "Auto-Keying Mode %t|Add/Replace Keys%x3|Replace Keys %x5", - xco, yco, 3.5*XIC, YIC, &(scene->autokey_mode), 0, 1, 0, 0, + xco, yco, (int)3.5*XIC, YIC, &(scene->autokey_mode), 0, 1, 0, 0, "Mode of automatic keyframe insertion for Objects and Bones"); xco+= (4*XIC); } @@ -553,7 +553,7 @@ void time_header_buttons(const bContext *C, ARegion *ar) /* always as last */ - UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin); + UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, (int)(ar->v2d.tot.ymax-ar->v2d.tot.ymin)); uiEndBlock(C, block); uiDrawBlock(C, block); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index b91ed0894e3..5d130cee48d 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -283,7 +283,7 @@ static short set_pchan_glColor (short colCode, int armflag, int boneflag, int co else { if (bcolor) { char *cp= bcolor->solid; - glColor4ub(cp[0], cp[1], cp[2], 0.8); + glColor4ub(cp[0], cp[1], cp[2], 204); } else UI_ThemeColorShade(TH_BACK, -30); @@ -430,7 +430,7 @@ static void draw_bonevert_solid(void) qobj = gluNewQuadric(); gluQuadricDrawStyle(qobj, GLU_FILL); glShadeModel(GL_SMOOTH); - gluSphere( qobj, 0.05, 8, 5); + gluSphere(qobj, 0.05, 8, 5); glShadeModel(GL_FLAT); gluDeleteQuadric(qobj); @@ -450,13 +450,13 @@ static void draw_bone_octahedral() displist= glGenLists(1); glNewList(displist, GL_COMPILE_AND_EXECUTE); - vec[0][0]= vec[0][1]= vec[0][2]= 0.0; - vec[5][0]= vec[5][2]= 0.0; vec[5][1]= 1.0; + vec[0][0]= vec[0][1]= vec[0][2]= 0.0f; + vec[5][0]= vec[5][2]= 0.0f; vec[5][1]= 1.0f; - vec[1][0]= 0.1; vec[1][2]= 0.1; vec[1][1]= 0.1; - vec[2][0]= 0.1; vec[2][2]= -0.1; vec[2][1]= 0.1; - vec[3][0]= -0.1; vec[3][2]= -0.1; vec[3][1]= 0.1; - vec[4][0]= -0.1; vec[4][2]= 0.1; vec[4][1]= 0.1; + vec[1][0]= 0.1f; vec[1][2]= 0.1f; vec[1][1]= 0.1f; + vec[2][0]= 0.1f; vec[2][2]= -0.1f; vec[2][1]= 0.1f; + vec[3][0]= -0.1f; vec[3][2]= -0.1f; vec[3][1]= 0.1f; + vec[4][0]= -0.1f; vec[4][2]= 0.1f; vec[4][1]= 0.1f; /* Section 1, sides */ glBegin(GL_LINE_LOOP); @@ -494,49 +494,49 @@ static void draw_bone_solid_octahedral(void) displist= glGenLists(1); glNewList(displist, GL_COMPILE_AND_EXECUTE); - vec[0][0]= vec[0][1]= vec[0][2]= 0.0; - vec[5][0]= vec[5][2]= 0.0; vec[5][1]= 1.0; + vec[0][0]= vec[0][1]= vec[0][2]= 0.0f; + vec[5][0]= vec[5][2]= 0.0f; vec[5][1]= 1.0f; - vec[1][0]= 0.1; vec[1][2]= 0.1; vec[1][1]= 0.1; - vec[2][0]= 0.1; vec[2][2]= -0.1; vec[2][1]= 0.1; - vec[3][0]= -0.1; vec[3][2]= -0.1; vec[3][1]= 0.1; - vec[4][0]= -0.1; vec[4][2]= 0.1; vec[4][1]= 0.1; + vec[1][0]= 0.1f; vec[1][2]= 0.1f; vec[1][1]= 0.1f; + vec[2][0]= 0.1f; vec[2][2]= -0.1f; vec[2][1]= 0.1f; + vec[3][0]= -0.1f; vec[3][2]= -0.1f; vec[3][1]= 0.1f; + vec[4][0]= -0.1f; vec[4][2]= 0.1f; vec[4][1]= 0.1f; glBegin(GL_TRIANGLES); /* bottom */ CalcNormFloat(vec[2], vec[1], vec[0], nor); glNormal3fv(nor); - glVertex3fv(vec[2]);glVertex3fv(vec[1]);glVertex3fv(vec[0]); + glVertex3fv(vec[2]); glVertex3fv(vec[1]); glVertex3fv(vec[0]); CalcNormFloat(vec[3], vec[2], vec[0], nor); glNormal3fv(nor); - glVertex3fv(vec[3]);glVertex3fv(vec[2]);glVertex3fv(vec[0]); + glVertex3fv(vec[3]); glVertex3fv(vec[2]); glVertex3fv(vec[0]); CalcNormFloat(vec[4], vec[3], vec[0], nor); glNormal3fv(nor); - glVertex3fv(vec[4]);glVertex3fv(vec[3]);glVertex3fv(vec[0]); + glVertex3fv(vec[4]); glVertex3fv(vec[3]); glVertex3fv(vec[0]); CalcNormFloat(vec[1], vec[4], vec[0], nor); glNormal3fv(nor); - glVertex3fv(vec[1]);glVertex3fv(vec[4]);glVertex3fv(vec[0]); + glVertex3fv(vec[1]); glVertex3fv(vec[4]); glVertex3fv(vec[0]); /* top */ CalcNormFloat(vec[5], vec[1], vec[2], nor); glNormal3fv(nor); - glVertex3fv(vec[5]);glVertex3fv(vec[1]);glVertex3fv(vec[2]); + glVertex3fv(vec[5]); glVertex3fv(vec[1]); glVertex3fv(vec[2]); CalcNormFloat(vec[5], vec[2], vec[3], nor); glNormal3fv(nor); - glVertex3fv(vec[5]);glVertex3fv(vec[2]);glVertex3fv(vec[3]); + glVertex3fv(vec[5]); glVertex3fv(vec[2]); glVertex3fv(vec[3]); CalcNormFloat(vec[5], vec[3], vec[4], nor); glNormal3fv(nor); - glVertex3fv(vec[5]);glVertex3fv(vec[3]);glVertex3fv(vec[4]); + glVertex3fv(vec[5]); glVertex3fv(vec[3]); glVertex3fv(vec[4]); CalcNormFloat(vec[5], vec[4], vec[1], nor); glNormal3fv(nor); - glVertex3fv(vec[5]);glVertex3fv(vec[4]);glVertex3fv(vec[1]); + glVertex3fv(vec[5]); glVertex3fv(vec[4]); glVertex3fv(vec[1]); glEnd(); @@ -592,38 +592,38 @@ static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id) UI_ThemeColor(TH_BONE_SOLID); } - glTranslatef(0.0, 1.0, 0.0); + glTranslatef(0.0f, 1.0f, 0.0f); if (dt > OB_WIRE) draw_bonevert_solid(); else draw_bonevert(); - glTranslatef(0.0, -1.0, 0.0); + glTranslatef(0.0f, -1.0f, 0.0f); } /* 16 values of sin function (still same result!) */ static float si[16] = { - 0.00000000, - 0.20129852, 0.39435585, - 0.57126821, 0.72479278, - 0.84864425, 0.93775213, - 0.98846832, 0.99871650, - 0.96807711, 0.89780453, - 0.79077573, 0.65137248, - 0.48530196, 0.29936312, - 0.10116832 + 0.00000000f, + 0.20129852f, 0.39435585f, + 0.57126821f, 0.72479278f, + 0.84864425f, 0.93775213f, + 0.98846832f, 0.99871650f, + 0.96807711f, 0.89780453f, + 0.79077573f, 0.65137248f, + 0.48530196f, 0.29936312f, + 0.10116832f }; /* 16 values of cos function (still same result!) */ static float co[16] ={ - 1.00000000, - 0.97952994, 0.91895781, - 0.82076344, 0.68896691, - 0.52896401, 0.34730525, - 0.15142777, -0.05064916, - -0.25065253, -0.44039415, - -0.61210598, -0.75875812, - -0.87434661, -0.95413925, - -0.99486932 + 1.00000000f, + 0.97952994f, 0.91895781f, + 0.82076344f, 0.68896691f, + 0.52896401f, 0.34730525f, + 0.15142777f, -0.05064916f, + -0.25065253f, -0.44039415f, + -0.61210598f, -0.75875812f, + -0.87434661f, -0.95413925f, + -0.99486932f }; @@ -667,7 +667,7 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], int boneflag VecSubf(dirvec, tailvec, headvec); Mat4Mul3Vecfl(smat, dirvec); /* clear zcomp */ - dirvec[2]= 0.0; + dirvec[2]= 0.0f; /* move vector back */ Mat4Mul3Vecfl(imat, dirvec); @@ -807,7 +807,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, /* move vector to viewspace */ Mat4Mul3Vecfl(smat, dirvec); /* clear zcomp */ - dirvec[2]= 0.0; + dirvec[2]= 0.0f; /* move vector back */ Mat4Mul3Vecfl(imat, dirvec); @@ -916,9 +916,9 @@ static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, u if (id != -1) glLoadName(id | BONESEL_TIP); - glTranslatef(0.0, 0.0, length); + glTranslatef(0.0f, 0.0f, length); gluSphere(qobj, tail, 16, 10); - glTranslatef(0.0, 0.0, -length); + glTranslatef(0.0f, 0.0f, -length); /* base */ if (armflag & ARM_EDITMODE) { @@ -938,7 +938,7 @@ static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, u glLoadName (id | BONESEL_BONE); glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(-1.0, -1.0); + glPolygonOffset(-1.0f, -1.0f); glTranslatef(0.0f, 0.0f, head); gluCylinder(qobj, fac1*head + (1.0f-fac1)*tail, fac2*tail + (1.0f-fac2)*head, length-head-tail, 16, 1); @@ -956,7 +956,7 @@ static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, u } else { /* 1 sphere in center */ - glTranslatef(0.0f, 0.0f, (head + length-tail)/2.0); + glTranslatef(0.0f, 0.0f, (head + length-tail)/2.0f); gluSphere(qobj, fac1*head + (1.0f-fac1)*tail, 16, 10); } @@ -994,7 +994,7 @@ static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned in /* this chunk not in object mode */ if (armflag & (ARM_EDITMODE|ARM_POSEMODE)) { - glLineWidth(4.0); + glLineWidth(4.0f); if (armflag & ARM_POSEMODE) set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); else if (armflag & ARM_EDITMODE) { @@ -1331,11 +1331,11 @@ static void bgl_sphere_project(float ax, float az) { float dir[3], sine, q3; - sine= 1.0f-ax*ax-az*az; - q3= (sine < 0.0f)? 0.0f: 2.0f*sqrt(sine); + sine= 1.0f - ax*ax - az*az; + q3= (sine < 0.0f)? 0.0f: (float)(2.0*sqrt(sine)); dir[0]= -az*q3; - dir[1]= 1.0f-2.0f*sine; + dir[1]= 1.0f - 2.0f*sine; dir[2]= ax*q3; glVertex3fv(dir); @@ -1344,11 +1344,11 @@ static void bgl_sphere_project(float ax, float az) static void draw_dof_ellipse(float ax, float az) { static float staticSine[16] = { - 0.0, 0.104528463268, 0.207911690818, 0.309016994375, - 0.406736643076, 0.5, 0.587785252292, 0.669130606359, - 0.743144825477, 0.809016994375, 0.866025403784, - 0.913545457643, 0.951056516295, 0.978147600734, - 0.994521895368, 1.0 + 0.0f, 0.104528463268f, 0.207911690818f, 0.309016994375f, + 0.406736643076f, 0.5f, 0.587785252292f, 0.669130606359f, + 0.743144825477f, 0.809016994375f, 0.866025403784f, + 0.913545457643f, 0.951056516295f, 0.978147600734f, + 0.994521895368f, 1.0f }; int i, j, n=16; @@ -1363,11 +1363,11 @@ static void draw_dof_ellipse(float ax, float az) pz= 0.0f; for(i=1; i<n; i++) { z= staticSine[i]; - + px= 0.0f; for(j=1; j<n-i+1; j++) { x = staticSine[j]; - + if(j == n-i) { glEnd(); glBegin(GL_TRIANGLES); @@ -1383,7 +1383,7 @@ static void draw_dof_ellipse(float ax, float az) bgl_sphere_project(ax*px, az*pz); bgl_sphere_project(ax*px, az*z); } - + px= x; } pz= z; @@ -1442,37 +1442,38 @@ static void draw_pose_dofs(Object *ob) float amin[3], amax[3]; for (i=0; i<3; i++) { - amin[i]= sin(pchan->limitmin[i]*M_PI/360.0); - amax[i]= sin(pchan->limitmax[i]*M_PI/360.0); + amin[i]= (float)sin(pchan->limitmin[i]*M_PI/360.0); + amax[i]= (float)sin(pchan->limitmax[i]*M_PI/360.0); } - glScalef(1.0, -1.0, 1.0); - if (amin[0] != 0.0 && amin[2] != 0.0) + glScalef(1.0f, -1.0f, 1.0f); + if ((amin[0] != 0.0f) && (amin[2] != 0.0f)) draw_dof_ellipse(amin[0], amin[2]); - if (amin[0] != 0.0 && amax[2] != 0.0) + if ((amin[0] != 0.0f) && (amax[2] != 0.0f)) draw_dof_ellipse(amin[0], amax[2]); - if (amax[0] != 0.0 && amin[2] != 0.0) + if ((amax[0] != 0.0f) && (amin[2] != 0.0f)) draw_dof_ellipse(amax[0], amin[2]); - if (amax[0] != 0.0 && amax[2] != 0.0) + if ((amax[0] != 0.0f) && (amax[2] != 0.0f)) draw_dof_ellipse(amax[0], amax[2]); - glScalef(1.0, -1.0, 1.0); + glScalef(1.0f, -1.0f, 1.0f); } } /* arcs */ if (pchan->ikflag & BONE_IK_ZLIMIT) { - theta= 0.5*(pchan->limitmin[2]+pchan->limitmax[2]); + theta= 0.5f*(pchan->limitmin[2]+pchan->limitmax[2]); glRotatef(theta, 0.0f, 0.0f, 1.0f); glColor3ub(50, 50, 255); // blue, Z axis limit glBegin(GL_LINE_STRIP); for (a=-16; a<=16; a++) { float fac= ((float)a)/16.0f; - phi= fac*(M_PI/360.0f)*(pchan->limitmax[2]-pchan->limitmin[2]); + + phi= fac * (float)(M_PI/360.0f) * (pchan->limitmax[2] - pchan->limitmin[2]); i= (a == -16) ? 0 : 1; - corner[i][0]= sin(phi); - corner[i][1]= cos(phi); + corner[i][0]= (float)sin(phi); + corner[i][1]= (float)cos(phi); corner[i][2]= 0.0f; glVertex3fv(corner[i]); } @@ -1482,19 +1483,19 @@ static void draw_pose_dofs(Object *ob) } if (pchan->ikflag & BONE_IK_XLIMIT) { - theta= 0.5*(pchan->limitmin[0]+pchan->limitmax[0]); + theta= 0.5f * (pchan->limitmin[0] + pchan->limitmax[0]); glRotatef(theta, 1.0f, 0.0f, 0.0f); glColor3ub(255, 50, 50); // Red, X axis limit glBegin(GL_LINE_STRIP); for (a=-16; a<=16; a++) { float fac= ((float)a)/16.0f; - phi= 0.5f*M_PI + fac*(M_PI/360.0f)*(pchan->limitmax[0]-pchan->limitmin[0]); + phi= (float)(0.5*M_PI) + fac * (float)(M_PI/360.0f) * (pchan->limitmax[0] - pchan->limitmin[0]); i= (a == -16) ? 2 : 3; corner[i][0]= 0.0f; - corner[i][1]= sin(phi); - corner[i][2]= cos(phi); + corner[i][1]= (float)sin(phi); + corner[i][2]= (float)cos(phi); glVertex3fv(corner[i]); } glEnd(); @@ -1840,7 +1841,7 @@ static void set_matrix_editbone(EditBone *eBone) VecSubf(delta, eBone->tail, eBone->head); - eBone->length = sqrt (delta[0]*delta[0] + delta[1]*delta[1] +delta[2]*delta[2]); + eBone->length = (float)sqrt(delta[0]*delta[0] + delta[1]*delta[1] +delta[2]*delta[2]); vec_roll_to_mat3(delta, eBone->roll, mat); Mat4CpyMat3(bmat, mat); @@ -1920,7 +1921,7 @@ static void draw_ebones(View3D *v3d, RegionView3D *rv3d, Object *ob, int dt) index= 0; } else if (dt > OB_WIRE) - bglPolygonOffset(rv3d->dist, 1.0); + bglPolygonOffset(rv3d->dist, 1.0f); else if (arm->flag & ARM_EDITMODE) index= 0; /* do selection codes */ @@ -1971,7 +1972,7 @@ static void draw_ebones(View3D *v3d, RegionView3D *rv3d, Object *ob, int dt) /* restore */ if (arm->drawtype==ARM_LINE); - else if (dt>OB_WIRE) bglPolygonOffset(rv3d->dist, 0.0); + else if (dt>OB_WIRE) bglPolygonOffset(rv3d->dist, 0.0f); /* finally names and axes */ if (arm->flag & (ARM_DRAWNAMES|ARM_DRAWAXES)) { @@ -2091,11 +2092,11 @@ static void draw_pose_paths(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec if ((a+sfra) < CFRA) { /* black - before cfra */ if (pchan->bone->flag & BONE_SELECTED) { - // intensity= 0.5; + // intensity= 0.5f; intensity = SET_INTENSITY(sfra, a, CFRA, 0.25f, 0.75f); } else { - //intensity= 0.8; + //intensity= 0.8f; intensity = SET_INTENSITY(sfra, a, CFRA, 0.68f, 0.92f); } UI_ThemeColorBlend(TH_WIRE, TH_BACK, intensity); @@ -2103,11 +2104,11 @@ static void draw_pose_paths(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec else if ((a+sfra) > CFRA) { /* blue - after cfra */ if (pchan->bone->flag & BONE_SELECTED) { - //intensity = 0.5; + //intensity = 0.5f; intensity = SET_INTENSITY(CFRA, a, efra, 0.25f, 0.75f); } else { - //intensity = 0.8; + //intensity = 0.8f; intensity = SET_INTENSITY(CFRA, a, efra, 0.68f, 0.92f); } UI_ThemeColorBlend(TH_BONE_POSE, TH_BACK, intensity); @@ -2115,10 +2116,10 @@ static void draw_pose_paths(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec else { /* green - on cfra */ if (pchan->bone->flag & BONE_SELECTED) { - intensity= 0.5; + intensity= 0.5f; } else { - intensity= 0.99; + intensity= 0.99f; } UI_ThemeColorBlendShade(TH_CFRAME, TH_BACK, intensity, 10); } @@ -2184,7 +2185,7 @@ static void draw_pose_paths(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec /* Draw slightly-larger yellow dots at each keyframe */ UI_ThemeColor(TH_VERTEX_SELECT); - glPointSize(5.0); + glPointSize(5.0f); glBegin(GL_POINTS); for (a=0, fp=fp_start; a<len; a++, fp+=3) { @@ -2195,7 +2196,7 @@ static void draw_pose_paths(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec } glEnd(); - glPointSize(1.0); + glPointSize(1.0f); /* Draw frame numbers of keyframes */ if ((arm->pathflag & ARM_PATH_FNUMS) || (arm->pathflag & ARM_PATH_KFNOS)) { @@ -2265,8 +2266,8 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, RegionView3D *rv3d float start, end, stepsize, range, colfac; int cfrao, flago, ipoflago; - start = arm->ghostsf; - end = arm->ghostef; + start = (float)arm->ghostsf; + end = (float)arm->ghostef; if (end <= start) return; @@ -2292,9 +2293,9 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, RegionView3D *rv3d if (v3d->zbuf) glDisable(GL_DEPTH_TEST); /* draw from first frame of range to last */ - for (CFRA= start; CFRA<end; CFRA+=stepsize) { - colfac = (end-CFRA)/range; - UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0f*sqrt(colfac))); + for (CFRA= (int)start; CFRA < end; CFRA += (int)stepsize) { + colfac = (end - (float)CFRA) / range; + UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0*sqrt(colfac))); //do_all_pose_actions(scene, ob); // XXX old animation system where_is_pose(scene, ob); @@ -2330,8 +2331,8 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, RegionView3D *rv3d, float start, end, range, colfac, i; int cfrao, flago; - aki.start= start = arm->ghostsf; - aki.end= end = arm->ghostef; + aki.start= start = (float)arm->ghostsf; + aki.end= end = (float)arm->ghostef; if (end <= start) return; @@ -2368,7 +2369,7 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, RegionView3D *rv3d, /* draw from first frame of range to last */ for (ak=keys.first, i=0; ak; ak=ak->next, i++) { colfac = i/range; - UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0f*sqrt(colfac))); + UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0*sqrt(colfac))); CFRA= (int)ak->cfra; @@ -2428,7 +2429,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base ob->flag &= ~OB_POSEMODE; cfrao= CFRA; if (maptime) actframe= get_action_frame(ob, (float)CFRA); - else actframe= CFRA; + else actframe= (float)CFRA; flago= arm->flag; arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES); @@ -2444,25 +2445,25 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base /* draw from darkest blend to lowest */ for(cur= stepsize; cur<range; cur+=stepsize) { - ctime= cur - fmod((float)cfrao, stepsize); /* ensures consistant stepping */ + ctime= cur - (float)fmod(cfrao, stepsize); /* ensures consistant stepping */ colfac= ctime/range; - UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0f*sqrt(colfac))); + UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0*sqrt(colfac))); /* only within action range */ if (actframe+ctime >= start && actframe+ctime <= end) { if (maptime) CFRA= (int)get_action_frame_inv(ob, actframe+ctime); else CFRA= (int)floor(actframe+ctime); - if (CFRA!=cfrao) { + if (CFRA != cfrao) { //do_all_pose_actions(scene, ob); // xxx old animation system crap where_is_pose(scene, ob); draw_pose_channels(scene, v3d, rv3d, base, OB_WIRE); } } - ctime= cur + fmod((float)cfrao, stepsize) - stepsize+1.0f; /* ensures consistant stepping */ + ctime= cur + (float)fmod((float)cfrao, stepsize) - stepsize+1.0f; /* ensures consistant stepping */ colfac= ctime/range; - UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0f*sqrt(colfac))); + UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0*sqrt(colfac))); /* only within action range */ if ((actframe-ctime >= start) && (actframe-ctime <= end)) { |