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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-03-27 19:57:27 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-03-27 19:57:27 +0400
commit4237c0393a9d1f089f01dd7c4b223b1f61b15023 (patch)
treef10b16ee980afd457a1294af1b159f4359549172 /source
parent59cdbfd8849315984e280b92968d6cf1d9d44c4b (diff)
view3d / object drawing: floats were being implicitly promoted to doubles, adjust to use floats.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_view3d/drawobject.c158
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c20
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c45
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c62
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c33
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c34
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c82
8 files changed, 220 insertions, 220 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index c18ec4b617c..e656c0ebb91 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -153,16 +153,16 @@ static void view3d_project_short_clip(ARegion *ar, float *vec, short *adr, int l
mul_m4_v4(rv3d->persmatob, vec4);
/* clipplanes in window space */
- if( vec4[3]>BL_NEAR_CLIP ) { /* is the NEAR clipping cutoff for picking */
+ if( vec4[3] > (float)BL_NEAR_CLIP ) { /* is the NEAR clipping cutoff for picking */
fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
if( fx>0 && fx<ar->winx) {
fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
- if(fy>0.0 && fy< (float)ar->winy) {
- adr[0]= (short)floor(fx);
- adr[1]= (short)floor(fy);
+ if(fy > 0.0f && fy < (float)ar->winy) {
+ adr[0]= (short)floorf(fx);
+ adr[1]= (short)floorf(fy);
}
}
}
@@ -181,16 +181,16 @@ static void view3d_project_short_noclip(ARegion *ar, float *vec, short *adr)
mul_m4_v4(rv3d->persmatob, vec4);
- if( vec4[3]>BL_NEAR_CLIP ) { /* is the NEAR clipping cutoff for picking */
+ if( vec4[3] > (float)BL_NEAR_CLIP ) { /* is the NEAR clipping cutoff for picking */
fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
if( fx>-32700 && fx<32700) {
fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
- if(fy>-32700.0 && fy<32700.0) {
- adr[0]= (short)floor(fx);
- adr[1]= (short)floor(fy);
+ if(fy > -32700.0f && fy < 32700.0f) {
+ adr[0]= (short)floorf(fx);
+ adr[1]= (short)floorf(fy);
}
}
}
@@ -325,7 +325,7 @@ static float cosval[32] ={
static void draw_xyz_wire(const float c[3], float size, int axis)
{
float v1[3]= {0.f, 0.f, 0.f}, v2[3] = {0.f, 0.f, 0.f};
- float dim = size * 0.1;
+ float dim = size * 0.1f;
float dx[3], dy[3], dz[3];
dx[0]=dim; dx[1]=0.f; dx[2]=0.f;
@@ -444,9 +444,9 @@ void drawaxes(float size, char drawtype)
/* square pyramid */
glBegin(GL_TRIANGLES);
- v2[0]= size*0.035; v2[1] = size*0.035;
- v3[0]= size*-0.035; v3[1] = size*0.035;
- v2[2]= v3[2]= size*0.75;
+ v2[0]= size * 0.035f; v2[1] = size * 0.035f;
+ v3[0]= size * -0.035f; v3[1] = size * 0.035f;
+ v2[2]= v3[2]= size * 0.75f;
for (axis=0; axis<4; axis++) {
if (axis % 2 == 1) {
@@ -492,18 +492,18 @@ void drawaxes(float size, char drawtype)
glVertex3fv(v1);
glVertex3fv(v2);
- v1[axis]= size*0.85;
- v1[arrow_axis]= -size*0.08;
+ v1[axis]= size*0.85f;
+ v1[arrow_axis]= -size*0.08f;
glVertex3fv(v1);
glVertex3fv(v2);
- v1[arrow_axis]= size*0.08;
+ v1[arrow_axis]= size*0.08f;
glVertex3fv(v1);
glVertex3fv(v2);
glEnd();
- v2[axis]+= size*0.125;
+ v2[axis]+= size*0.125f;
draw_xyz_wire(v2, size, axis);
@@ -824,7 +824,7 @@ static void spotvolume(float *lvec, float *vvec, float inp)
q[3] = 0 ;
normalize_v3(&q[1]);
- angle = saacos(plane[2])/2.0;
+ angle = saacos(plane[2])/2.0f;
co = cos(angle);
si = sqrt(1-co*co);
@@ -881,7 +881,7 @@ static void draw_spot_cone(Lamp *la, float x, float z)
for(a=0; a<33; a++) {
angle= a*M_PI*2/(33-1);
- glVertex3f(z*cos(angle), z*sin(angle), 0);
+ glVertex3f(z*cosf(angle), z*sinf(angle), 0);
}
}
@@ -1001,7 +1001,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
short axis;
/* setup a 45 degree rotation matrix */
- vec_rot_to_mat3( mat,imat[2], M_PI/4.0f);
+ vec_rot_to_mat3(mat, imat[2], (float)M_PI/4.0f);
/* vectors */
mul_v3_v3fl(v1, imat[0], circrad * 1.2f);
@@ -1048,7 +1048,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
vvec[1]= x*ob->obmat[1][0] + y*ob->obmat[1][1] + z*ob->obmat[1][2];
vvec[2]= x*ob->obmat[2][0] + y*ob->obmat[2][1] + z*ob->obmat[2][2];
- y = cos( M_PI*la->spotsize/360.0 );
+ y = cosf(la->spotsize*(float)(M_PI/360.0));
spotvolume(lvec, vvec, y);
x = -la->dist;
mul_v3_fl(lvec, x);
@@ -1061,7 +1061,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
glVertex3fv(lvec);
glEnd();
- z = x*sqrt(1.0 - y*y);
+ z = x*sqrtf(1.0f - y*y);
x *= y;
/* draw the circle/square at the end of the cone */
@@ -1083,7 +1083,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
glVertex3fv(tvec);
glEnd();
}
- else circ(0.0, 0.0, fabs(z));
+ else circ(0.0, 0.0, fabsf(z));
/* draw the circle/square representing spotbl */
if(la->type==LA_SPOT) {
@@ -1091,7 +1091,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* hide line if it is zero size or overlaps with outer border,
previously it adjusted to always to show it but that seems
confusing because it doesn't show the actual blend size */
- if (spotblcirc != 0 && spotblcirc != fabs(z))
+ if (spotblcirc != 0 && spotblcirc != fabsf(z))
circ(0.0, 0.0, spotblcirc);
}
@@ -1165,9 +1165,9 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
} else if(la->type==LA_AREA) {
setlinestyle(3);
if(la->area_shape==LA_AREA_SQUARE)
- fdrawbox(-la->area_size*0.5, -la->area_size*0.5, la->area_size*0.5, la->area_size*0.5);
+ fdrawbox(-la->area_size*0.5f, -la->area_size*0.5f, la->area_size*0.5f, la->area_size*0.5f);
else if(la->area_shape==LA_AREA_RECT)
- fdrawbox(-la->area_size*0.5, -la->area_sizey*0.5, la->area_size*0.5, la->area_sizey*0.5);
+ fdrawbox(-la->area_size*0.5f, -la->area_sizey*0.5f, la->area_size*0.5f, la->area_sizey*0.5f);
glBegin(GL_LINE_STRIP);
glVertex3f(0.0,0.0,-circrad);
@@ -1287,7 +1287,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
if(is_view) {
/* fixed depth, variable size (avoids exceeding clipping range) */
- depth = -(cam->clipsta + 0.1);
+ depth = -(cam->clipsta + 0.1f);
fac = depth / (cam->lens/-16.0f * scaz);
}
else {
@@ -1342,15 +1342,15 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
else if (i==1 && (ob == v3d->camera)) glBegin(GL_TRIANGLES);
else break;
- vec[0][0]= shx + ((-0.7 * drawsize) * scax);
- vec[0][1]= shy + ((drawsize * (caspy + 0.1)) * scay);
+ vec[0][0]= shx + ((-0.7f * drawsize) * scax);
+ vec[0][1]= shy + ((drawsize * (caspy + 0.1f)) * scay);
glVertex3fv(vec[0]); /* left */
- vec[0][0]= shx + ((0.7 * drawsize) * scax);
+ vec[0][0]= shx + ((0.7f * drawsize) * scax);
glVertex3fv(vec[0]); /* right */
vec[0][0]= shx;
- vec[0][1]= shy + ((1.1 * drawsize * (caspy + 0.7)) * scay);
+ vec[0][1]= shy + ((1.1f * drawsize * (caspy + 0.7f)) * scay);
glVertex3fv(vec[0]); /* top */
glEnd();
@@ -1939,7 +1939,7 @@ static int draw_dm_creases__setDrawOptions(void *UNUSED(userData), int index)
{
EditEdge *eed = EM_get_edge_for_index(index);
- if (eed->h==0 && eed->crease!=0.0) {
+ if (eed->h==0 && eed->crease != 0.0f) {
UI_ThemeColorBlend(TH_WIRE, TH_EDGE_CREASE, eed->crease);
return 1;
} else {
@@ -1957,7 +1957,7 @@ static int draw_dm_bweights__setDrawOptions(void *UNUSED(userData), int index)
{
EditEdge *eed = EM_get_edge_for_index(index);
- if (eed->h==0 && eed->bweight!=0.0) {
+ if (eed->h==0 && eed->bweight != 0.0f) {
UI_ThemeColorBlend(TH_WIRE, TH_EDGE_SELECT, eed->bweight);
return 1;
} else {
@@ -1968,7 +1968,7 @@ static void draw_dm_bweights__mapFunc(void *UNUSED(userData), int index, float *
{
EditVert *eve = EM_get_vert_for_index(index);
- if (eve->h==0 && eve->bweight!=0.0) {
+ if (eve->h==0 && eve->bweight != 0.0f) {
UI_ThemeColorBlend(TH_VERTEX, TH_VERTEX_SELECT, eve->bweight);
bglVertex3fv(co);
}
@@ -2026,8 +2026,8 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, Deriv
continue;
}
- size = (size>2.1?size/2.0:size);
- fsize = (fsize>2.1?fsize/2.0:fsize);
+ size = (size > 2.1f ? size/2.0f:size);
+ fsize = (fsize > 2.1f ? fsize/2.0f:fsize);
col[3] = fcol[3] = 100;
} else {
col[3] = fcol[3] = 255;
@@ -2162,7 +2162,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
bUnit_AsString(val, sizeof(val), len_v3v3(v1, v2)*unit->scale_length, 3, unit->system, B_UNIT_LENGTH, do_split, FALSE);
else
sprintf(val, conv_float, len_v3v3(v1, v2));
-
+
view3d_cached_text_draw_add(vmid, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
}
@@ -2231,29 +2231,29 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
if( (e4->f & e1->f & SELECT) || (do_moving && (efa->v1->f & SELECT)) ) {
/* Vec 1 */
- sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v4, v1, v2)));
+ sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v4, v1, v2)));
interp_v3_v3v3(fvec, efa->cent, efa->v1->co, 0.8f);
view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
if( (e1->f & e2->f & SELECT) || (do_moving && (efa->v2->f & SELECT)) ) {
/* Vec 2 */
- sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v1, v2, v3)));
+ sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v1, v2, v3)));
interp_v3_v3v3(fvec, efa->cent, efa->v2->co, 0.8f);
view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
if( (e2->f & e3->f & SELECT) || (do_moving && (efa->v3->f & SELECT)) ) {
/* Vec 3 */
if(efa->v4)
- sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v2, v3, v4)));
+ sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v2, v3, v4)));
else
- sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v2, v3, v1)));
+ sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v2, v3, v1)));
interp_v3_v3v3(fvec, efa->cent, efa->v3->co, 0.8f);
view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
/* Vec 4 */
if(efa->v4) {
if( (e3->f & e4->f & SELECT) || (do_moving && (efa->v4->f & SELECT)) ) {
- sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v3, v4, v1)));
+ sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v3, v4, v1)));
interp_v3_v3v3(fvec, efa->cent, efa->v4->co, 0.8f);
view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
@@ -2455,7 +2455,7 @@ static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm)
{
if(v3d->transp==0) { // not when we draw the transparent pass
- glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0);
+ glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0f);
glDepthMask(0);
/* if transparent, we cannot draw the edges for solid select... edges have no material info.
@@ -3184,7 +3184,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
drawDispListsolid(lb, ob, 0);
GPU_end_object_materials();
}
- if(cu->editnurb && cu->bevobj==NULL && cu->taperobj==NULL && cu->ext1 == 0.0 && cu->ext2 == 0.0) {
+ if(cu->editnurb && cu->bevobj==NULL && cu->taperobj==NULL && cu->ext1 == 0.0f && cu->ext2 == 0.0f) {
cpack(0);
draw_index_wire= 0;
drawDispListwire(lb);
@@ -3577,7 +3577,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
pixsize= view3d_pixel_size(rv3d, ob->obmat[3]);
if(part->draw_size==0.0)
- pixsize*=2.0;
+ pixsize *= 2.0f;
else
pixsize*=part->draw_size;
@@ -3761,8 +3761,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
drawn = 0;
if(part->draw_as == PART_DRAW_REND && part->trail_count > 1) {
- float length = part->path_end * (1.0 - part->randlength * r_length);
- int trail_count = part->trail_count * (1.0 - part->randlength * r_length);
+ float length = part->path_end * (1.0f - part->randlength * r_length);
+ int trail_count = part->trail_count * (1.0f - part->randlength * r_length);
float ct = ((part->draw & PART_ABS_PATH_TIME) ? cfra : pa_time) - length;
float dt = length / (trail_count ? (float)trail_count : 1.0f);
int i=0;
@@ -4114,7 +4114,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
if(timed) {
for(k=0, pcol=pathcol, pkey=path; k<steps; k++, pkey++, pcol+=4){
copy_v3_v3(pcol, pkey->col);
- pcol[3] = 1.0f - fabs((float)CFRA - pkey->time)/(float)pset->fade_frames;
+ pcol[3] = 1.0f - fabsf((float)(CFRA) - pkey->time)/(float)pset->fade_frames;
}
glColorPointer(4, GL_FLOAT, 4*sizeof(float), pathcol);
@@ -4163,7 +4163,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
}
if(timed)
- *(cd+3) = 1.0f - fabs((float)CFRA - *key->time)/(float)pset->fade_frames;
+ *(cd+3) = 1.0f - fabsf((float)CFRA - *key->time)/(float)pset->fade_frames;
cd += (timed?4:3);
}
@@ -4757,7 +4757,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* direction vectors for 3d curve paths
when at its lowest, dont render normals */
- if(cu->flag & CU_3D && ts->normalsize > 0.0015 && (cu->drawflag & CU_HIDE_NORMALS)==0) {
+ if(cu->flag & CU_3D && ts->normalsize > 0.0015f && (cu->drawflag & CU_HIDE_NORMALS)==0) {
UI_ThemeColor(TH_WIRE);
for (bl=cu->bev.first,nu=nurb; nu && bl; bl=bl->next,nu=nu->next) {
@@ -4854,7 +4854,7 @@ static void draw_empty_cone (float size)
radius = size;
glTranslatef(cent,cent, cent);
- glScalef(radius, 2.0*size, radius);
+ glScalef(radius, size * 2.0f, radius);
glRotatef(-90., 1.0, 0.0, 0.0);
gluCylinder(qobj, 1.0, 0.0, 1.0, 8, 1);
@@ -5083,7 +5083,7 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
ml->selcol2= code;
glLoadName(code++);
}
- drawcircball(GL_LINE_LOOP, &(ml->x), ml->rad*atan(ml->s)/M_PI_2, imat);
+ drawcircball(GL_LINE_LOOP, &(ml->x), ml->rad*atanf(ml->s)/(float)M_PI_2, imat);
}
ml= ml->next;
@@ -5125,15 +5125,15 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
// force_val = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, scene->r.cfra);
//else
force_val = pd->f_strength;
- force_val*= 0.1;
+ force_val *= 0.1f;
drawcircball(GL_LINE_LOOP, vec, size, tmat);
- vec[2]= 0.5*force_val;
+ vec[2]= 0.5f * force_val;
drawcircball(GL_LINE_LOOP, vec, size, tmat);
- vec[2]= 1.0*force_val;
+ vec[2]= 1.0f * force_val;
drawcircball(GL_LINE_LOOP, vec, size, tmat);
- vec[2]= 1.5*force_val;
+ vec[2]= 1.5f * force_val;
drawcircball(GL_LINE_LOOP, vec, size, tmat);
- vec[2] = 0; /* reset vec for max dist circle */
+ vec[2] = 0.0f; /* reset vec for max dist circle */
}
else if (pd->forcefield == PFIELD_FORCE) {
@@ -5146,10 +5146,10 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
UI_ThemeColorBlend(curcol, TH_BACK, 0.5);
drawcircball(GL_LINE_LOOP, vec, size, imat);
- UI_ThemeColorBlend(curcol, TH_BACK, 0.9 - 0.4 / pow(1.5, (double)ffall_val));
- drawcircball(GL_LINE_LOOP, vec, size*1.5, imat);
- UI_ThemeColorBlend(curcol, TH_BACK, 0.9 - 0.4 / pow(2.0, (double)ffall_val));
- drawcircball(GL_LINE_LOOP, vec, size*2.0, imat);
+ UI_ThemeColorBlend(curcol, TH_BACK, 0.9f - 0.4f / powf(1.5f, ffall_val));
+ drawcircball(GL_LINE_LOOP, vec, size * 1.5f, imat);
+ UI_ThemeColorBlend(curcol, TH_BACK, 0.9f - 0.4f / powf(2.0f, ffall_val));
+ drawcircball(GL_LINE_LOOP, vec, size*2.0f, imat);
}
else if (pd->forcefield == PFIELD_VORTEX) {
float /*ffall_val,*/ force_val;
@@ -5165,14 +5165,14 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
//else
force_val = pd->f_strength;
- UI_ThemeColorBlend(curcol, TH_BACK, 0.7);
+ UI_ThemeColorBlend(curcol, TH_BACK, 0.7f);
if (force_val < 0) {
- drawspiral(vec, size*1.0, tmat, 1);
- drawspiral(vec, size*1.0, tmat, 16);
+ drawspiral(vec, size, tmat, 1);
+ drawspiral(vec, size, tmat, 16);
}
else {
- drawspiral(vec, size*1.0, tmat, -1);
- drawspiral(vec, size*1.0, tmat, -16);
+ drawspiral(vec, size, tmat, -1);
+ drawspiral(vec, size, tmat, -16);
}
}
else if (pd->forcefield == PFIELD_GUIDE && ob->type==OB_CURVE) {
@@ -5244,9 +5244,9 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
distance=(pd->flag&PFIELD_USEMAX)?pd->maxdist:0.0f;
if(pd->flag & (PFIELD_USEMAX|PFIELD_USEMAXR)){
- drawcone(vec,distance*sin(radius),distance*cos(radius),tmat);
+ drawcone(vec, distance * sinf(radius),distance * cosf(radius), tmat);
if((pd->flag & PFIELD_POSZ)==0)
- drawcone(vec,distance*sin(radius),-distance*cos(radius),tmat);
+ drawcone(vec, distance * sinf(radius),-distance * cosf(radius),tmat);
}
radius=(pd->flag&PFIELD_USEMINR)?pd->minrad:1.0f;
@@ -5254,9 +5254,9 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
distance=(pd->flag&PFIELD_USEMIN)?pd->mindist:0.0f;
if(pd->flag & (PFIELD_USEMIN|PFIELD_USEMINR)){
- drawcone(vec,distance*sin(radius),distance*cos(radius),tmat);
+ drawcone(vec,distance*sinf(radius),distance*cosf(radius),tmat);
if((pd->flag & PFIELD_POSZ)==0)
- drawcone(vec,distance*sin(radius),-distance*cos(radius),tmat);
+ drawcone(vec, distance * sinf(radius), -distance * cosf(radius), tmat);
}
}
setlinestyle(0);
@@ -5306,13 +5306,13 @@ static void draw_bb_quadric(BoundBox *bb, short type)
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
- size[0]= 0.5*fabs(bb->vec[0][0] - bb->vec[4][0]);
- size[1]= 0.5*fabs(bb->vec[0][1] - bb->vec[2][1]);
- size[2]= 0.5*fabs(bb->vec[0][2] - bb->vec[1][2]);
+ size[0]= 0.5f*fabsf(bb->vec[0][0] - bb->vec[4][0]);
+ size[1]= 0.5f*fabsf(bb->vec[0][1] - bb->vec[2][1]);
+ size[2]= 0.5f*fabsf(bb->vec[0][2] - bb->vec[1][2]);
- cent[0]= (bb->vec[0][0] + bb->vec[4][0])/2.0;
- cent[1]= (bb->vec[0][1] + bb->vec[2][1])/2.0;
- cent[2]= (bb->vec[0][2] + bb->vec[1][2])/2.0;
+ cent[0]= 0.5f*(bb->vec[0][0] + bb->vec[4][0]);
+ cent[1]= 0.5f*(bb->vec[0][1] + bb->vec[2][1]);
+ cent[2]= 0.5f*(bb->vec[0][2] + bb->vec[1][2]);
glPushMatrix();
if(type==OB_BOUND_SPHERE) {
@@ -5323,13 +5323,13 @@ static void draw_bb_quadric(BoundBox *bb, short type)
else if(type==OB_BOUND_CYLINDER) {
float radius = size[0] > size[1] ? size[0] : size[1];
glTranslatef(cent[0], cent[1], cent[2]-size[2]);
- glScalef(radius, radius, 2.0*size[2]);
+ glScalef(radius, radius, 2.0f * size[2]);
gluCylinder(qobj, 1.0, 1.0, 1.0, 8, 1);
}
else if(type==OB_BOUND_CONE) {
float radius = size[0] > size[1] ? size[0] : size[1];
glTranslatef(cent[0], cent[2]-size[2], cent[1]);
- glScalef(radius, 2.0*size[2], radius);
+ glScalef(radius, 2.0f * size[2], radius);
glRotatef(-90., 1.0, 0.0, 0.0);
gluCylinder(qobj, 1.0, 0.0, 1.0, 8, 1);
}
@@ -5838,7 +5838,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
drawDispList(scene, v3d, rv3d, base, dt);
}
- if (cu->linewidth != 0.0) {
+ if (cu->linewidth != 0.0f) {
cpack(0xff44ff);
UI_ThemeColor(TH_WIRE);
copy_v3_v3(vec1, ob->orig);
@@ -5857,7 +5857,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
setlinestyle(3);
for (i=0; i<cu->totbox; i++) {
- if (cu->tb[i].w != 0.0) {
+ if (cu->tb[i].w != 0.0f) {
if (i == (cu->actbox-1))
UI_ThemeColor(TH_ACTIVE);
else
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 1f123c11a8b..4277a7e85e3 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -383,7 +383,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
EditMesh *em = BKE_mesh_get_editmesh(me);
/* allow for some rounding error becasue of matrix transform */
- if(len_v3(median) > 0.000001) {
+ if(len_v3(median) > 0.000001f) {
EditVert *eve;
for(eve= em->verts.first; eve; eve= eve->next) {
@@ -397,7 +397,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
if(median[3] != 0.0f) {
EditEdge *eed;
- const float fixed_crease= (ve_median[3] <= 0.0f ? 0.0 : (ve_median[3] >= 1.0f ? 1.0 : FLT_MAX));
+ const float fixed_crease= (ve_median[3] <= 0.0f ? 0.0f : (ve_median[3] >= 1.0f ? 1.0f : FLT_MAX));
if(fixed_crease != FLT_MAX) {
/* simple case */
@@ -414,8 +414,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
float median_orig= ve_median[3] - median[3]; /* previous median value */
/* incase of floating point error */
- CLAMP(median_orig, 0.0, 1.0);
- CLAMP(median_new, 0.0, 1.0);
+ CLAMP(median_orig, 0.0f, 1.0f);
+ CLAMP(median_new, 0.0f, 1.0f);
if(median_new < median_orig) {
/* scale down */
@@ -424,7 +424,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
for(eed= em->edges.first; eed; eed= eed->next) {
if(eed->f & SELECT) {
eed->crease *= sca;
- CLAMP(eed->crease, 0.0, 1.0);
+ CLAMP(eed->crease, 0.0f, 1.0f);
}
}
}
@@ -435,7 +435,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
for(eed= em->edges.first; eed; eed= eed->next) {
if(eed->f & SELECT) {
eed->crease = 1.0f - ((1.0f - eed->crease) * sca);
- CLAMP(eed->crease, 0.0, 1.0);
+ CLAMP(eed->crease, 0.0f, 1.0f);
}
}
}
@@ -1090,9 +1090,9 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event
if (!pchan) return;
/* make a copy to eul[3], to allow TAB on buttons to work */
- eul[0]= M_PI*tfp->ob_eul[0]/180.0;
- eul[1]= M_PI*tfp->ob_eul[1]/180.0;
- eul[2]= M_PI*tfp->ob_eul[2]/180.0;
+ eul[0]= (float)M_PI*tfp->ob_eul[0]/180.0f;
+ eul[1]= (float)M_PI*tfp->ob_eul[1]/180.0f;
+ eul[2]= (float)M_PI*tfp->ob_eul[2]/180.0f;
if (pchan->rotmode == ROT_MODE_AXISANGLE) {
float quat[4];
@@ -1237,7 +1237,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
}
*/
- lim= 10000.0f*MAX2(1.0, v3d->grid);
+ lim= 10000.0f * MAX2(1.0f, v3d->grid);
block= uiLayoutGetBlock(pa->layout);
uiBlockSetHandleFunc(block, do_view3d_region_buttons, NULL);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index dadc51b89fe..f5037ca24a1 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -223,7 +223,7 @@ static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, flo
v1[1]= 0.0f;
v2[1]= (float)ar->winy;
- v1[0] = v2[0] = x-dx*floor(x/dx);
+ v1[0] = v2[0] = x-dx*floorf(x/dx);
glBegin(GL_LINES);
@@ -236,7 +236,7 @@ static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, flo
v1[0]= 0.0f;
v2[0]= (float)ar->winx;
- v1[1]= v2[1]= y-dx*floor(y/dx);
+ v1[1]= v2[1]= y-dx*floorf(y/dx);
while(v1[1] < ar->winy) {
glVertex2fv(v1);
@@ -292,7 +292,6 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
* items are less useful when dealing with units */
void *usys;
int len, i;
- double scalar;
float dx_scalar;
float blend_fac;
@@ -301,7 +300,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
if(usys) {
i= len;
while(i--) {
- scalar= bUnit_GetScaler(usys, i);
+ float scalar= bUnit_GetScaler(usys, i);
dx_scalar = dx * scalar / unit->scale_length;
if (dx_scalar < (GRID_MIN_PX*2))
@@ -447,7 +446,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
if(usys) {
int i= bUnit_GetBaseUnit(usys);
*grid_unit= bUnit_GetNameDisplay(usys, i);
- grid_scale = (grid_scale * bUnit_GetScaler(usys, i)) / scene->unit.scale_length;
+ grid_scale = (grid_scale * (float)bUnit_GetScaler(usys, i)) / scene->unit.scale_length;
}
}
@@ -600,7 +599,7 @@ static void draw_view_axis(RegionView3D *rv3d)
{
const float k = U.rvisize; /* axis size */
const float toll = 0.5; /* used to see when view is quasi-orthogonal */
- const float start = k + 1.0; /* axis center in screen coordinates, x=y */
+ const float start = k + 1.0f;/* axis center in screen coordinates, x=y */
float ydisp = 0.0; /* vertical displacement to allow obj info text */
int bright = 25*(float)U.rvibright + 5; /* axis alpha (rvibright has range 0-10) */
@@ -626,7 +625,7 @@ static void draw_view_axis(RegionView3D *rv3d)
glVertex2f(start + dx, start + dy + ydisp);
glEnd();
- if (fabs(dx) > toll || fabs(dy) > toll) {
+ if (fabsf(dx) > toll || fabsf(dy) > toll) {
BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "x", 1);
}
@@ -646,7 +645,7 @@ static void draw_view_axis(RegionView3D *rv3d)
glVertex2f(start + dx, start + dy + ydisp);
glEnd();
- if (fabs(dx) > toll || fabs(dy) > toll) {
+ if (fabsf(dx) > toll || fabsf(dy) > toll) {
BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "y", 1);
}
@@ -665,7 +664,7 @@ static void draw_view_axis(RegionView3D *rv3d)
glVertex2f(start + dx, start + dy + ydisp);
glEnd();
- if (fabs(dx) > toll || fabs(dy) > toll) {
+ if (fabsf(dx) > toll || fabsf(dy) > toll) {
BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "z", 1);
}
@@ -860,7 +859,7 @@ void view3d_viewborder_size_get(Scene *scene, ARegion *ar, float size_r[2])
float winmax= MAX2(ar->winx, ar->winy);
float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
- if(aspect>1.0) {
+ if(aspect > 1.0f) {
size_r[0]= winmax;
size_r[1]= winmax/aspect;
} else {
@@ -887,15 +886,15 @@ void view3d_calc_camera_border(Scene *scene, ARegion *ar, RegionView3D *rv3d, Vi
* with multiple keypad presses (ton)
*/
- zoomfac= (M_SQRT2 + rv3d->camzoom/50.0);
- zoomfac= (zoomfac*zoomfac)*0.25;
+ zoomfac= ((float)M_SQRT2 + rv3d->camzoom/50.0f);
+ zoomfac= (zoomfac*zoomfac) * 0.25f;
size[0]= size[0]*zoomfac;
size[1]= size[1]*zoomfac;
/* center in window */
- viewborder_r->xmin= 0.5*ar->winx - 0.5*size[0];
- viewborder_r->ymin= 0.5*ar->winy - 0.5*size[1];
+ viewborder_r->xmin= 0.5f * ar->winx - 0.5f * size[0];
+ viewborder_r->ymin= 0.5f * ar->winy - 0.5f * size[1];
viewborder_r->xmax= viewborder_r->xmin + size[0];
viewborder_r->ymax= viewborder_r->ymin + size[1];
@@ -951,21 +950,21 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
y2i= (int)(y2 + 1.0f);
/* passepartout, specified in camera edit buttons */
- if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001) {
- if (ca->passepartalpha == 1.0) {
+ if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001f) {
+ if (ca->passepartalpha == 1.0f) {
glColor3f(0, 0, 0);
} else {
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable(GL_BLEND);
glColor4f(0, 0, 0, ca->passepartalpha);
}
- if (x1i > 0.0)
+ if (x1i > 0.0f)
glRectf(0.0, (float)ar->winy, x1i, 0.0);
if (x2i < (float)ar->winx)
glRectf(x2i, (float)ar->winy, (float)ar->winx, 0.0);
if (y2i < (float)ar->winy)
glRectf(x1i, (float)ar->winy, x2i, y2i);
- if (y2i > 0.0)
+ if (y2i > 0.0f)
glRectf(x1i, y1i, x2i, 0.0);
glDisable(GL_BLEND);
@@ -1288,7 +1287,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
initgrabz(rv3d, 0.0, 0.0, 0.0);
window_to_3d_delta(ar, vec, 1, 0);
fac= MAX3( fabs(vec[0]), fabs(vec[1]), fabs(vec[1]) );
- fac= 1.0/fac;
+ fac= 1.0f/fac;
asp= ( (float)ibuf->y)/(float)ibuf->x;
@@ -1344,7 +1343,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
ED_region_pixelspace(ar);
glPixelZoom(zoomx, zoomy);
- glColor4f(1.0, 1.0, 1.0, 1.0-bgpic->blend);
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f-bgpic->blend);
glaDrawPixelsTex(x1, y1, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, ibuf->rect);
glPixelZoom(1.0, 1.0);
@@ -2286,13 +2285,13 @@ static void draw_viewport_fps(Scene *scene, ARegion *ar)
#endif
/* is this more then half a frame behind? */
- if (fps+0.5 < FPS) {
+ if (fps+0.5f < (float)(FPS)) {
UI_ThemeColor(TH_REDALERT);
- BLI_snprintf(printable, sizeof(printable), "fps: %.2f", (float)fps);
+ BLI_snprintf(printable, sizeof(printable), "fps: %.2f", fps);
}
else {
UI_ThemeColor(TH_TEXT_HI);
- BLI_snprintf(printable, sizeof(printable), "fps: %i", (int)(fps+0.5));
+ BLI_snprintf(printable, sizeof(printable), "fps: %i", (int)(fps+0.5f));
}
BLF_draw_default(22, ar->winy-17, 0.0f, printable, sizeof(printable)-1);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 38888670dc2..ca5213e357b 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -313,11 +313,11 @@ static void calctrackballvec(rcti *rect, int mx, int my, float *vec)
y/= (float)((rect->ymax - rect->ymin)/2);
d = sqrt(x*x + y*y);
- if (d < radius*M_SQRT1_2) /* Inside sphere */
+ if (d < radius * (float)M_SQRT1_2) /* Inside sphere */
z = sqrt(radius*radius - d*d);
else
{ /* On hyperbola */
- t = radius / M_SQRT2;
+ t = radius / (float)M_SQRT2;
z = t*t / d;
}
@@ -552,22 +552,22 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
sub_v3_v3v3(dvec, newvec, vod->trackvec);
si= sqrt(dvec[0]*dvec[0]+ dvec[1]*dvec[1]+ dvec[2]*dvec[2]);
- si/= (2.0*TRACKBALLSIZE);
+ si /= (float)(2.0 * TRACKBALLSIZE);
cross_v3_v3v3(q1+1, vod->trackvec, newvec);
normalize_v3(q1+1);
/* Allow for rotation beyond the interval
* [-pi, pi] */
- while (si > 1.0)
- si -= 2.0;
+ while (si > 1.0f)
+ si -= 2.0f;
/* This relation is used instead of
* phi = asin(si) so that the angle
* of rotation is linearly proportional
* to the distance that the mouse is
* dragged. */
- phi = si * M_PI / 2.0;
+ phi = si * (float)(M_PI / 2.0);
q1[0]= cos(phi);
mul_v3_fl(q1+1, sin(phi));
@@ -591,12 +591,12 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
float phi, q1[4];
float m[3][3];
float m_inv[3][3];
- float xvec[3] = {1,0,0};
+ float xvec[3] = {1.0f, 0.0f, 0.0f};
/* Sensitivity will control how fast the viewport rotates. 0.0035 was
obtained experimentally by looking at viewport rotation sensitivities
on other modeling programs. */
/* Perhaps this should be a configurable user parameter. */
- const float sensitivity = 0.0035;
+ const float sensitivity = 0.0035f;
/* Get the 3x3 matrix and its inverse from the quaternion */
quat_to_mat3( m,rv3d->viewquat);
@@ -652,7 +652,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
invert_qt_qt(viewquat_inv_test, snapquats[i]);
mul_qt_v3(viewquat_inv_test, zaxis_test);
- if(angle_v3v3(zaxis_test, zaxis) < DEG2RAD(45/3)) {
+ if(angle_v3v3(zaxis_test, zaxis) < DEG2RADF(45/3)) {
/* find the best roll */
float quat_roll[4], quat_final[4], quat_best[4];
float viewquat_align[4]; /* viewquat aligned to zaxis_test */
@@ -675,7 +675,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
float xaxis2[3]={1,0,0};
float quat_final_inv[4];
- axis_angle_to_quat(quat_roll, zaxis_test, j * DEG2RAD(45.0));
+ axis_angle_to_quat(quat_roll, zaxis_test, (float)j * DEG2RADF(45.0f));
normalize_qt(quat_roll);
mul_qt_qtqt(quat_final, snapquats[i], quat_roll);
@@ -891,8 +891,8 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
static void viewmove_apply(ViewOpsData *vod, int x, int y)
{
if(vod->rv3d->persp==RV3D_CAMOB) {
- float zoomfac= (M_SQRT2 + vod->rv3d->camzoom/50.0);
- zoomfac= (zoomfac*zoomfac)*0.5;
+ float zoomfac= ((float)M_SQRT2 + (float)vod->rv3d->camzoom / 50.0f);
+ zoomfac= (zoomfac * zoomfac) * 0.5f;
vod->rv3d->camdx += (vod->oldx - x)/(vod->ar->winx * zoomfac);
vod->rv3d->camdy += (vod->oldy - y)/(vod->ar->winy * zoomfac);
@@ -1084,7 +1084,7 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, short viewzoom)
float time_step= (float)(time - vod->timer_lastdraw);
// oldstyle zoom
- zfac = 1.0f + (((float)(vod->origx - x + vod->origy - y)/20.0) * time_step);
+ zfac = 1.0f + (((float)(vod->origx - x + vod->origy - y) / 20.0f) * time_step);
vod->timer_lastdraw= time;
}
else if(viewzoom==USER_ZOOM_SCALE) {
@@ -1113,11 +1113,11 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, short viewzoom)
if (U.uiflag & USER_ZOOM_INVERT)
SWAP(float, len1, len2);
- zfac = vod->dist0 * (2.0*((len2/len1)-1.0) + 1.0) / vod->rv3d->dist;
+ zfac = vod->dist0 * (2.0f * ((len2/len1)-1.0f) + 1.0f) / vod->rv3d->dist;
}
- if(zfac != 1.0 && zfac*vod->rv3d->dist > 0.001*vod->grid &&
- zfac*vod->rv3d->dist < 10.0*vod->far)
+ if(zfac != 1.0f && zfac*vod->rv3d->dist > 0.001f * vod->grid &&
+ zfac * vod->rv3d->dist < 10.0f * vod->far)
view_zoom_mouseloc(vod->ar, zfac, vod->oldx, vod->oldy);
@@ -1133,8 +1133,8 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, short viewzoom)
add_v3_v3(vod->rv3d->ofs, upvec);
} else {
/* these limits were in old code too */
- if(vod->rv3d->dist<0.001*vod->grid) vod->rv3d->dist= 0.001*vod->grid;
- if(vod->rv3d->dist>10.0*vod->far) vod->rv3d->dist=10.0*vod->far;
+ if(vod->rv3d->dist<0.001f * vod->grid) vod->rv3d->dist= 0.001f * vod->grid;
+ if(vod->rv3d->dist>10.0f * vod->far) vod->rv3d->dist=10.0f * vod->far;
}
// XXX if(vod->rv3d->persp==RV3D_ORTHO || vod->rv3d->persp==RV3D_CAMOB) preview3d_event= 0;
@@ -1224,7 +1224,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
rv3d->camzoom-= 10;
if(rv3d->camzoom < RV3D_CAMZOOM_MIN) rv3d->camzoom= RV3D_CAMZOOM_MIN;
}
- else if(rv3d->dist<10.0*v3d->far) {
+ else if(rv3d->dist < 10.0f * v3d->far) {
view_zoom_mouseloc(ar, 1.2f, mx, my);
}
}
@@ -1233,7 +1233,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
rv3d->camzoom+= 10;
if(rv3d->camzoom > RV3D_CAMZOOM_MAX) rv3d->camzoom= RV3D_CAMZOOM_MAX;
}
- else if(rv3d->dist> 0.001*v3d->grid) {
+ else if(rv3d->dist> 0.001f * v3d->grid) {
view_zoom_mouseloc(ar, .83333f, mx, my);
}
}
@@ -1373,7 +1373,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
sub_v3_v3v3(afm, max, min);
size= 0.7f*MAX3(afm[0], afm[1], afm[2]);
- if(size==0.0) ok= 0;
+ if(size == 0.0f) ok= 0;
if(ok) {
float new_dist;
@@ -1387,7 +1387,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
// correction for window aspect ratio
if(ar->winy>2 && ar->winx>2) {
size= (float)ar->winx/(float)ar->winy;
- if(size<1.0) size= 1.0f/size;
+ if(size < 1.0f) size= 1.0f/size;
new_dist*= size;
}
@@ -1651,15 +1651,15 @@ static int render_border_exec(bContext *C, wmOperator *op)
scene->r.border.ymax= ((float)rect.ymax-vb.ymin)/(vb.ymax-vb.ymin);
/* actually set border */
- CLAMP(scene->r.border.xmin, 0.0, 1.0);
- CLAMP(scene->r.border.ymin, 0.0, 1.0);
- CLAMP(scene->r.border.xmax, 0.0, 1.0);
- CLAMP(scene->r.border.ymax, 0.0, 1.0);
+ CLAMP(scene->r.border.xmin, 0.0f, 1.0f);
+ CLAMP(scene->r.border.ymin, 0.0f, 1.0f);
+ CLAMP(scene->r.border.xmax, 0.0f, 1.0f);
+ CLAMP(scene->r.border.ymax, 0.0f, 1.0f);
/* drawing a border surrounding the entire camera view switches off border rendering
* or the border covers no pixels */
- if ((scene->r.border.xmin <= 0.0 && scene->r.border.xmax >= 1.0 &&
- scene->r.border.ymin <= 0.0 && scene->r.border.ymax >= 1.0) ||
+ if ((scene->r.border.xmin <= 0.0f && scene->r.border.xmax >= 1.0f &&
+ scene->r.border.ymin <= 0.0f && scene->r.border.ymax >= 1.0f) ||
(scene->r.border.xmin == scene->r.border.xmax ||
scene->r.border.ymin == scene->r.border.ymax ))
{
@@ -1767,7 +1767,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
dvec[2] = p[2]-p_corner[2];
new_dist = len_v3(dvec);
- if(new_dist <= v3d->near*1.5) new_dist= v3d->near*1.5;
+ if(new_dist <= v3d->near * 1.5f) new_dist= v3d->near * 1.5f;
new_ofs[0] = -p[0];
new_ofs[1] = -p[1];
@@ -1802,7 +1802,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
scale = (xscale >= yscale)?xscale:yscale;
/* zoom in as required, or as far as we can go */
- new_dist = ((new_dist*scale) >= 0.001*v3d->grid)? new_dist*scale:0.001*v3d->grid;
+ new_dist = ((new_dist*scale) >= 0.001f * v3d->grid)? new_dist*scale:0.001f * v3d->grid;
}
smooth_view(C, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
@@ -1858,7 +1858,7 @@ static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar)
view3d_viewborder_size_get(scene, ar, size);
- rv3d->camzoom= (sqrt(4.0*im_width/size[0]) - M_SQRT2)*50.0;
+ rv3d->camzoom= (sqrtf(4.0f * (float)im_width/size[0]) - (float)M_SQRT2) * 50.0f;
rv3d->camzoom= CLAMPIS(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
}
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index d6dcd67c756..4914020fc02 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -204,10 +204,10 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSE
mouse can move during fly mode without spinning the view */
float x1, x2, y1, y2;
- x1= 0.45*(float)fly->ar->winx;
- y1= 0.45*(float)fly->ar->winy;
- x2= 0.55*(float)fly->ar->winx;
- y2= 0.55*(float)fly->ar->winy;
+ x1= 0.45f * (float)fly->ar->winx;
+ y1= 0.45f * (float)fly->ar->winy;
+ x2= 0.55f * (float)fly->ar->winx;
+ y2= 0.55f * (float)fly->ar->winy;
cpack(0);
@@ -440,14 +440,14 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
fly->time_lastwheel = time_currwheel;
/*printf("Wheel %f\n", time_wheel);*/
/*Mouse wheel delays range from 0.5==slow to 0.01==fast*/
- time_wheel = 1+ (10 - (20*MIN2(time_wheel, 0.5))); /* 0-0.5 -> 0-5.0 */
+ time_wheel = 1.0f + (10.0f - (20.0f * MIN2(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
if (fly->speed<0.0f) fly->speed= 0.0f;
else {
if (event->shift)
- fly->speed+= fly->grid*time_wheel*0.1;
+ fly->speed += fly->grid*time_wheel * 0.1f;
else
- fly->speed+= fly->grid*time_wheel;
+ fly->speed += fly->grid*time_wheel;
}
break;
}
@@ -459,12 +459,12 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
time_currwheel= PIL_check_seconds_timer();
time_wheel = (float)(time_currwheel - fly->time_lastwheel);
fly->time_lastwheel = time_currwheel;
- time_wheel = 1+ (10 - (20*MIN2(time_wheel, 0.5))); /* 0-0.5 -> 0-5.0 */
+ time_wheel = 1.0f + (10.0f - (20.0f * MIN2(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
if (fly->speed>0) fly->speed=0;
else {
if (event->shift)
- fly->speed-= fly->grid*time_wheel*0.1;
+ fly->speed-= fly->grid*time_wheel * 0.1f;
else
fly->speed-= fly->grid*time_wheel;
}
@@ -608,18 +608,19 @@ static int flyApply(bContext *C, FlyInfo *fly)
if(moffset[0]) {
moffset[0] /= ar->winx - (xmargin*2);
- moffset[0] *= fabs(moffset[0]);
+ moffset[0] *= fabsf(moffset[0]);
}
if(moffset[1]) {
moffset[1] /= ar->winy - (ymargin*2);
- moffset[1] *= fabs(moffset[1]);
+ moffset[1] *= fabsf(moffset[1]);
}
/* Should we redraw? */
if(fly->speed != 0.0f || moffset[0] || moffset[1] || fly->zlock || fly->xlock || dvec[0] || dvec[1] || dvec[2] ) {
float dvec_tmp[3];
- double time_current, time_redraw; /*time how fast it takes for us to redraw, this is so simple scenes dont fly too fast */
+ double time_current; /*time how fast it takes for us to redraw, this is so simple scenes dont fly too fast */
+ float time_redraw;
float time_redraw_clamped;
time_current= PIL_check_seconds_timer();
@@ -642,12 +643,12 @@ static int flyApply(bContext *C, FlyInfo *fly)
dvec_tmp[2]= 0;
if (fly->use_precision) {
- dvec_tmp[0] *= 0.1;
- dvec_tmp[1] *= 0.1;
+ dvec_tmp[0] *= 0.1f;
+ dvec_tmp[1] *= 0.1f;
}
mul_m3_v3(mat, dvec_tmp);
- mul_v3_fl(dvec_tmp, time_redraw*200.0 * fly->grid);
+ mul_v3_fl(dvec_tmp, time_redraw * 200.0f * fly->grid);
} else {
float roll; /* similar to the angle between the camera's up and the Z-up, but its very rough so just roll*/
@@ -704,7 +705,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
mul_m3_v3(mat, upvec);
/*make sure we have some z rolling*/
- if (fabs(upvec[2]) > 0.00001f) {
+ if (fabsf(upvec[2]) > 0.00001f) {
roll= upvec[2]*5;
upvec[0]=0; /*rotate the view about this axis*/
upvec[1]=0;
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 9d882f09d02..bd19112f924 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -296,7 +296,7 @@ int lasso_inside(short mcords[][2], short moves, short sx, short sy)
cross= (float)((p1[1]-p2[1])*(p1[0]-sx) + (p2[0]-p1[0])*(p1[1]-sy));
- if(cross<0.0) angletot-= ang;
+ if(cross<0.0f) angletot-= ang;
else angletot+= ang;
/* circulate */
@@ -1926,7 +1926,7 @@ static void mesh_circle_select(ViewContext *vc, int select, short *mval, float r
int bbsel;
struct {ViewContext *vc; short select, mval[2]; float radius; } data;
- bbsel= EM_init_backbuf_circle(vc, mval[0], mval[1], (short)(rad+1.0));
+ bbsel= EM_init_backbuf_circle(vc, mval[0], mval[1], (short)(rad+1.0f));
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
vc->em= ((Mesh *)vc->obedit->data)->edit_mesh;
@@ -1974,7 +1974,7 @@ static void paint_facesel_circle_select(ViewContext *vc, int select, short *mval
if (me) {
em_vertoffs= me->totface+1; /* max index array */
- bbsel= EM_init_backbuf_circle(vc, mval[0], mval[1], (short)(rad+1.0));
+ bbsel= EM_init_backbuf_circle(vc, mval[0], mval[1], (short)(rad+1.0f));
EM_backbuf_checkAndSelectTFaces(me, select==LEFTMOUSE);
EM_free_backbuf();
}
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index b803d49640e..f007b46dd95 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -252,7 +252,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
if(eve->f1) {
VECCOPY(tv->oldloc, eve->co);
tv->loc= eve->co;
- if(eve->no[0]!=0.0 || eve->no[1]!=0.0 ||eve->no[2]!=0.0)
+ if(eve->no[0] != 0.0f || eve->no[1] != 0.0f ||eve->no[2] != 0.0f)
tv->nor= eve->no; // note this is a hackish signal (ton)
tv->flag= eve->f1 & SELECT;
tv++;
@@ -436,11 +436,11 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
for(a=0; a<tottrans; a++, tv++) {
if(tv->flag & SELECT) {
add_v3_v3(centroid, tv->oldloc);
- total+= 1.0;
+ total += 1.0f;
DO_MINMAX(tv->oldloc, min, max);
}
}
- if(total!=0.0) {
+ if(total != 0.0f) {
mul_v3_fl(centroid, 1.0f/total);
}
@@ -478,9 +478,9 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
VECCOPY(vec, tv->loc);
mul_m3_v3(bmat, vec);
add_v3_v3(vec, obedit->obmat[3]);
- vec[0]= gridf*floor(.5+ vec[0]/gridf);
- vec[1]= gridf*floor(.5+ vec[1]/gridf);
- vec[2]= gridf*floor(.5+ vec[2]/gridf);
+ vec[0]= gridf*floorf(0.5f+ vec[0]/gridf);
+ vec[1]= gridf*floorf(0.5f+ vec[1]/gridf);
+ vec[2]= gridf*floorf(0.5f+ vec[2]/gridf);
sub_v3_v3(vec, obedit->obmat[3]);
mul_m3_v3(imat, vec);
@@ -508,9 +508,9 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
/* get nearest grid point to snap to */
VECCOPY(nLoc, pchan->pose_mat[3]);
- vec[0]= gridf * (float)(floor(.5+ nLoc[0]/gridf));
- vec[1]= gridf * (float)(floor(.5+ nLoc[1]/gridf));
- vec[2]= gridf * (float)(floor(.5+ nLoc[2]/gridf));
+ vec[0]= gridf * (float)(floor(0.5f+ nLoc[0]/gridf));
+ vec[1]= gridf * (float)(floor(0.5f+ nLoc[1]/gridf));
+ vec[2]= gridf * (float)(floor(0.5f+ nLoc[2]/gridf));
/* get bone-space location of grid point */
armature_loc_pose_to_bone(pchan, vec, vecN);
@@ -538,9 +538,9 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
else {
ob->recalc |= OB_RECALC_OB;
- vec[0]= -ob->obmat[3][0]+gridf*floor(.5+ ob->obmat[3][0]/gridf);
- vec[1]= -ob->obmat[3][1]+gridf*floor(.5+ ob->obmat[3][1]/gridf);
- vec[2]= -ob->obmat[3][2]+gridf*floor(.5+ ob->obmat[3][2]/gridf);
+ vec[0]= -ob->obmat[3][0]+gridf*floorf(0.5f+ ob->obmat[3][0]/gridf);
+ vec[1]= -ob->obmat[3][1]+gridf*floorf(0.5f+ ob->obmat[3][1]/gridf);
+ vec[2]= -ob->obmat[3][2]+gridf*floorf(0.5f+ ob->obmat[3][2]/gridf);
if(ob->parent) {
where_is_object(scene, ob);
@@ -723,9 +723,9 @@ static int snap_curs_to_grid(bContext *C, wmOperator *UNUSED(op))
gridf= rv3d->gridview;
curs= give_cursor(scene, v3d);
- curs[0]= gridf*floor(.5+curs[0]/gridf);
- curs[1]= gridf*floor(.5+curs[1]/gridf);
- curs[2]= gridf*floor(.5+curs[2]/gridf);
+ curs[0]= gridf*floorf(0.5f+curs[0]/gridf);
+ curs[1]= gridf*floorf(0.5f+curs[1]/gridf);
+ curs[2]= gridf*floorf(0.5f+curs[2]/gridf);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d); // hrm
@@ -784,7 +784,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
}
if(v3d->around==V3D_CENTROID) {
- mul_v3_fl(centroid, 1.0/(float)tottrans);
+ mul_v3_fl(centroid, 1.0f/(float)tottrans);
VECCOPY(curs, centroid);
}
else {
@@ -824,7 +824,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
}
if(count) {
if(v3d->around==V3D_CENTROID) {
- mul_v3_fl(centroid, 1.0/(float)count);
+ mul_v3_fl(centroid, 1.0f/(float)count);
VECCOPY(curs, centroid);
}
else {
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 852801dfc61..d6ed9752d03 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -113,9 +113,9 @@ static void object_lens_clip_settings(Object *ob, float *lens, float *clipsta, f
Lamp *la = ob->data;
if (lens) {
float x1, fac;
- fac= cos( M_PI*la->spotsize/360.0);
+ fac= cosf((float)M_PI*la->spotsize/360.0f);
x1= saacos(fac);
- *lens= 16.0*fac/sin(x1);
+ *lens= 16.0f*fac/sinf(x1);
}
if (clipsta) *clipsta= la->clipsta;
if (clipend) *clipend= la->clipend;
@@ -267,7 +267,7 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo
mul_qt_v3(q2, vec2);
/* scale the time allowed by the rotation */
- sms.time_allowed *= angle_v3v3(vec1, vec2) / M_PI; /* 180deg == 1.0 */
+ sms.time_allowed *= (double)angle_v3v3(vec1, vec2) / M_PI; /* 180deg == 1.0 */
}
/* ensure it shows correct */
@@ -312,14 +312,14 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
struct SmoothViewStore *sms= rv3d->sms;
- double step, step_inv;
+ float step, step_inv;
/* escape if not our timer */
if(rv3d->smooth_timer==NULL || rv3d->smooth_timer!=event->customdata)
return OPERATOR_PASS_THROUGH;
- if(sms->time_allowed != 0.0f)
- step = (rv3d->smooth_timer->duration)/sms->time_allowed;
+ if(sms->time_allowed != 0.0)
+ step = (float)((rv3d->smooth_timer->duration)/sms->time_allowed);
else
step = 1.0f;
@@ -356,18 +356,18 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
int i;
/* ease in/out */
- if (step < 0.5) step = (float)pow(step*2, 2)/2;
- else step = (float)1-(pow(2*(1-step),2)/2);
+ if (step < 0.5f) step = (float)pow(step*2.0f, 2.0)/2.0f;
+ else step = (float)1.0f-(powf(2.0f*(1.0f-step),2.0f)/2.0f);
- step_inv = 1.0-step;
+ step_inv = 1.0f-step;
for (i=0; i<3; i++)
- rv3d->ofs[i] = sms->new_ofs[i]*step + sms->orig_ofs[i]*step_inv;
+ rv3d->ofs[i] = sms->new_ofs[i] * step + sms->orig_ofs[i]*step_inv;
interp_qt_qtqt(rv3d->viewquat, sms->orig_quat, sms->new_quat, step);
- rv3d->dist = sms->new_dist*step + sms->orig_dist*step_inv;
- v3d->lens = sms->new_lens*step + sms->orig_lens*step_inv;
+ rv3d->dist = sms->new_dist * step + sms->orig_dist*step_inv;
+ v3d->lens = sms->new_lens * step + sms->orig_lens*step_inv;
}
if(rv3d->viewlock & RV3D_BOXVIEW)
@@ -787,14 +787,14 @@ void project_short(ARegion *ar, float *vec, short *adr) /* clips */
vec4[3]= 1.0;
mul_m4_v4(rv3d->persmat, vec4);
- if( vec4[3]>BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
+ if( vec4[3] > (float)BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
if( fx>0 && fx<ar->winx) {
fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
- if(fy>0.0 && fy< (float)ar->winy) {
+ if(fy > 0.0f && fy < (float)ar->winy) {
adr[0]= (short)floor(fx);
adr[1]= (short)floor(fy);
}
@@ -813,7 +813,7 @@ void project_int(ARegion *ar, float *vec, int *adr)
mul_m4_v4(rv3d->persmat, vec4);
- if( vec4[3]>BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
+ if( vec4[3] > (float)BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
if( fx>-2140000000.0f && fx<2140000000.0f) {
@@ -862,14 +862,14 @@ void project_short_noclip(ARegion *ar, float *vec, short *adr)
mul_m4_v4(rv3d->persmat, vec4);
- if( vec4[3]>BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
+ if( vec4[3] > (float)BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
if( fx>-32700 && fx<32700) {
fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
- if(fy>-32700.0 && fy<32700.0) {
+ if(fy > -32700.0f && fy < 32700.0f) {
adr[0]= (short)floor(fx);
adr[1]= (short)floor(fy);
}
@@ -888,9 +888,9 @@ void project_float(ARegion *ar, float *vec, float *adr)
mul_m4_v4(rv3d->persmat, vec4);
- if( vec4[3]>BL_NEAR_CLIP ) {
- adr[0] = (float)(ar->winx/2.0)+(ar->winx/2.0)*vec4[0]/vec4[3];
- adr[1] = (float)(ar->winy/2.0)+(ar->winy/2.0)*vec4[1]/vec4[3];
+ if(vec4[3] > (float)BL_NEAR_CLIP) {
+ adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3];
+ adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3];
}
}
@@ -905,8 +905,8 @@ void project_float_noclip(ARegion *ar, float *vec, float *adr)
mul_m4_v4(rv3d->persmat, vec4);
if( fabs(vec4[3]) > BL_NEAR_CLIP ) {
- adr[0] = (float)(ar->winx/2.0)+(ar->winx/2.0)*vec4[0]/vec4[3];
- adr[1] = (float)(ar->winy/2.0)+(ar->winy/2.0)*vec4[1]/vec4[3];
+ adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3];
+ adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3];
}
else
{
@@ -965,7 +965,7 @@ int get_view3d_cliprange(View3D *v3d, RegionView3D *rv3d, float *clipsta, float
}
if(rv3d->persp==RV3D_ORTHO) {
- *clipend *= 0.5; // otherwise too extreme low zbuffer quality
+ *clipend *= 0.5f; // otherwise too extreme low zbuffer quality
*clipsta= - *clipend;
orth= 1;
}
@@ -992,10 +992,10 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
Lamp *la;
la= v3d->camera->data;
- fac= cos( M_PI*la->spotsize/360.0);
+ fac= cosf(((float)M_PI)*la->spotsize/360.0f);
x1= saacos(fac);
- lens= 16.0*fac/sin(x1);
+ lens= 16.0f*fac/sinf(x1);
*clipsta= la->clipsta;
*clipend= la->clipend;
@@ -1018,14 +1018,14 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
else y1= -rv3d->dist;
y2= -y1;
- *clipend *= 0.5; // otherwise too extreme low zbuffer quality
+ *clipend *= 0.5f; // otherwise too extreme low zbuffer quality
*clipsta= - *clipend;
orth= 1;
}
else {
/* fac for zoom, also used for camdx */
if(rv3d->persp==RV3D_CAMOB) {
- fac= (1.41421+( (float)rv3d->camzoom )/50.0);
+ fac= (1.41421f + ( (float)rv3d->camzoom )/50.0f);
fac*= fac;
}
else fac= 2.0;
@@ -1033,7 +1033,7 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
/* viewplane size depends... */
if(cam && cam->type==CAM_ORTHO) {
/* ortho_scale == 1 means exact 1 to 1 mapping */
- float dfac= 2.0*cam->ortho_scale/fac;
+ float dfac= 2.0f*cam->ortho_scale/fac;
if(winx>winy) x1= -dfac;
else x1= -winx*dfac/winy;
@@ -1047,8 +1047,8 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
else {
float dfac;
- if(winx>winy) dfac= 64.0/(fac*winx*lens);
- else dfac= 64.0/(fac*winy*lens);
+ if(winx>winy) dfac= 64.0f/(fac*winx*lens);
+ else dfac= 64.0f/(fac*winy*lens);
x1= - *clipsta * winx*dfac;
x2= -x1;
@@ -1058,8 +1058,8 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
}
/* cam view offset */
if(cam) {
- float dx= 0.5*fac*rv3d->camdx*(x2-x1);
- float dy= 0.5*fac*rv3d->camdy*(y2-y1);
+ float dx= 0.5f*fac*rv3d->camdx*(x2-x1);
+ float dy= 0.5f*fac*rv3d->camdy*(y2-y1);
/* shift offset */
if(cam->type==CAM_ORTHO) {
@@ -1067,8 +1067,8 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
dy += cam->shifty * cam->ortho_scale;
}
else {
- dx += cam->shiftx * (cam->clipsta / cam->lens) * 32.0;
- dy += cam->shifty * (cam->clipsta / cam->lens) * 32.0;
+ dx += cam->shiftx * (cam->clipsta / cam->lens) * 32.0f;
+ dy += cam->shifty * (cam->clipsta / cam->lens) * 32.0f;
}
x1+= dx;
@@ -1086,7 +1086,7 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
*pixsize= 1.0f/viewfac;
}
else {
- viewfac= (((winx >= winy)? winx: winy)*lens)/32.0;
+ viewfac= (((winx >= winy)? winx: winy)*lens)/32.0f;
*pixsize= *clipsta/viewfac;
}
}
@@ -1498,7 +1498,7 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa)
box[1]= (max[1]-min[1]);
box[2]= (max[2]-min[2]);
size= MAX3(box[0], box[1], box[2]);
- if(size<=0.01) size= 0.01;
+ if(size <= 0.01f) size= 0.01f;
}
if(ok) {
@@ -1515,19 +1515,19 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa)
rv3d->localvd= MEM_mallocN(sizeof(RegionView3D), "localview region");
memcpy(rv3d->localvd, rv3d, sizeof(RegionView3D));
- rv3d->ofs[0]= -(min[0]+max[0])/2.0;
- rv3d->ofs[1]= -(min[1]+max[1])/2.0;
- rv3d->ofs[2]= -(min[2]+max[2])/2.0;
+ rv3d->ofs[0]= -(min[0]+max[0])/2.0f;
+ rv3d->ofs[1]= -(min[1]+max[1])/2.0f;
+ rv3d->ofs[2]= -(min[2]+max[2])/2.0f;
rv3d->dist= size;
/* perspective should be a bit farther away to look nice */
if(rv3d->persp==RV3D_ORTHO)
- rv3d->dist*= 0.7;
+ rv3d->dist*= 0.7f;
// correction for window aspect ratio
if(ar->winy>2 && ar->winx>2) {
float asp= (float)ar->winx/(float)ar->winy;
- if(asp<1.0) asp= 1.0/asp;
+ if(asp < 1.0f) asp= 1.0f/asp;
rv3d->dist*= asp;
}