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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-03-27 18:59:55 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-03-27 18:59:55 +0400
commit617e6a83bc89ca36e18bd06d851a31c010e11db2 (patch)
treed1347daa3d9a7bf51a0168048247cfe1ce13a4ee /source/blender/editors/sculpt_paint
parent8d7c3f8a7e6de7625b3631cd91242fbefa98cf3a (diff)
object/paint/misc-files: floats were being implicitly promoted to doubles, adjust to use floats.
- also UV angle stretching was using radians->deg which wasn't needed.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c28
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c30
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c4
6 files changed, 34 insertions, 34 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 83f3661ac31..27fc13a0a0a 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -866,7 +866,7 @@ static int line_isect_x(const float p1[2], const float p2[2], const float x_leve
x_diff= fabsf(p1[0]-p2[0]); /* yuck, horizontal line, we cant do much here */
- if (x_diff < 0.000001) { /* yuck, vertical line, we cant do much here */
+ if (x_diff < 0.000001f) { /* yuck, vertical line, we cant do much here */
*y_isect = (p1[0]+p2[0]) * 0.5f;
return ISECT_TRUE;
}
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index e3b92975383..eb9fbea22f4 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -111,7 +111,7 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op)
{
float unprojected_radius= scalar*brush_unprojected_radius(brush);
- if (unprojected_radius < 0.001) // XXX magic number
+ if (unprojected_radius < 0.001f) // XXX magic number
unprojected_radius= 0.001f;
brush_set_unprojected_radius(brush, unprojected_radius);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 1e3aa4fca1b..b63c2973758 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -265,11 +265,11 @@ static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
/* it is probably worth optimizing for those cases where
the texture is not rotated by skipping the calls to
atan2, sqrtf, sin, and cos. */
- if (br->mtex.tex && (rotation > 0.001 || rotation < -0.001)) {
- const float angle = atan2(y, x) + rotation;
+ if (br->mtex.tex && (rotation > 0.001f || rotation < -0.001f)) {
+ const float angle = atan2f(y, x) + rotation;
- x = len * cos(angle);
- y = len * sin(angle);
+ x = len * cosf(angle);
+ y = len * sinf(angle);
}
x *= br->mtex.size[0];
@@ -337,20 +337,20 @@ static int project_brush_radius(RegionView3D* rv3d, float radius, float location
// create a vector that is not orthogonal to view
- if (fabsf(view[0]) < 0.1) {
- nonortho[0] = view[0] + 1;
+ if (fabsf(view[0]) < 0.1f) {
+ nonortho[0] = view[0] + 1.0f;
nonortho[1] = view[1];
nonortho[2] = view[2];
}
- else if (fabsf(view[1]) < 0.1) {
+ else if (fabsf(view[1]) < 0.1f) {
nonortho[0] = view[0];
- nonortho[1] = view[1] + 1;
+ nonortho[1] = view[1] + 1.0f;
nonortho[2] = view[2];
}
else {
nonortho[0] = view[0];
nonortho[1] = view[1];
- nonortho[2] = view[2] + 1;
+ nonortho[2] = view[2] + 1.0f;
}
// get a vector in the plane of the view
@@ -446,10 +446,10 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush,
if(brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) {
/* brush rotation */
- glTranslatef(0.5f, 0.5f, 0);
- glRotatef(((brush->flag & BRUSH_RAKE) ?
- sd->last_angle : sd->special_rotation) * (180.0f/M_PI),
- 0, 0, 1);
+ glTranslatef(0.5, 0.5, 0);
+ glRotatef((double)((brush->flag & BRUSH_RAKE) ?
+ sd->last_angle : sd->special_rotation) * (180.0/M_PI),
+ 0.0, 0.0, 1.0);
glTranslatef(-0.5f, -0.5f, 0);
/* scale based on tablet pressure */
@@ -730,7 +730,7 @@ static int paint_smooth_stroke(PaintStroke *stroke, float output[2], wmEvent *ev
!(stroke->brush->flag & BRUSH_ANCHORED) &&
!(stroke->brush->flag & BRUSH_RESTORE_MESH))
{
- float u = stroke->brush->smooth_stroke_factor, v = 1.0 - u;
+ float u = stroke->brush->smooth_stroke_factor, v = 1.0f - u;
float dx = stroke->last_mouse_position[0] - event->x, dy = stroke->last_mouse_position[1] - event->y;
/* If the mouse is moving within the radius of the last move,
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 73b6d170a92..ad85a4bf29b 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -84,7 +84,7 @@ float paint_get_tex_pixel(Brush* br, float u, float v)
hasrgb = multitex_ext(br->mtex.tex, co, NULL, NULL, 0, &texres);
if (hasrgb & TEX_RGB)
- texres.tin = (0.35*texres.tr + 0.45*texres.tg + 0.2*texres.tb)*texres.ta;
+ texres.tin = (0.35f*texres.tr + 0.45f*texres.tg + 0.2f*texres.tb)*texres.ta;
return texres.tin;
}
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 6859fd333bc..7d8c3c70708 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -171,13 +171,13 @@ static unsigned int rgba_to_mcol(float r, float g, float b, float a)
unsigned int col;
char *cp;
- ir= floor(255.0*r);
+ ir= floor(255.0f * r);
if(ir<0) ir= 0; else if(ir>255) ir= 255;
- ig= floor(255.0*g);
+ ig= floor(255.0f * g);
if(ig<0) ig= 0; else if(ig>255) ig= 255;
- ib= floor(255.0*b);
+ ib= floor(255.0f * b);
if(ib<0) ib= 0; else if(ib>255) ib= 255;
- ia= floor(255.0*a);
+ ia= floor(255.0f * a);
if(ia<0) ia= 0; else if(ia>255) ia= 255;
cp= (char *)&col;
@@ -667,7 +667,7 @@ static void vpaint_blend(VPaint *vp, unsigned int *col, unsigned int *colorig, u
unsigned int testcol=0, a;
char *cp, *ct, *co;
- alpha= (int)(255.0*brush_alpha(brush));
+ alpha= (int)(255.0f*brush_alpha(brush));
if(brush->vertexpaint_tool==VP_MIX || brush->vertexpaint_tool==VP_BLUR) testcol= mcol_blend( *colorig, paintcol, alpha);
else if(brush->vertexpaint_tool==VP_ADD) testcol= mcol_add( *colorig, paintcol, alpha);
@@ -762,7 +762,7 @@ static float calc_vp_alpha_dl(VPaint *vp, ViewContext *vc, float vpimat[][3], fl
/* transpose ! */
fac= vpimat[2][0]*no[0]+vpimat[2][1]*no[1]+vpimat[2][2]*no[2];
- if(fac>0.0) {
+ if(fac > 0.0f) {
dx= vpimat[0][0]*no[0]+vpimat[0][1]*no[1]+vpimat[0][2]*no[2];
dy= vpimat[1][0]*no[0]+vpimat[1][1]*no[1]+vpimat[1][2]*no[2];
@@ -797,20 +797,20 @@ static void wpaint_blend(VPaint *wp, MDeformWeight *dw, MDeformWeight *uw, float
}
if(tool==VP_MIX || tool==VP_BLUR)
- dw->weight = paintval*alpha + dw->weight*(1.0-alpha);
+ dw->weight = paintval*alpha + dw->weight*(1.0f-alpha);
else if(tool==VP_ADD)
dw->weight += paintval*alpha;
else if(tool==VP_SUB)
dw->weight -= paintval*alpha;
else if(tool==VP_MUL)
/* first mul, then blend the fac */
- dw->weight = ((1.0-alpha) + alpha*paintval)*dw->weight;
+ dw->weight = ((1.0f-alpha) + alpha*paintval)*dw->weight;
else if(tool==VP_LIGHTEN) {
if (dw->weight < paintval)
- dw->weight = paintval*alpha + dw->weight*(1.0-alpha);
+ dw->weight = paintval*alpha + dw->weight*(1.0f-alpha);
} else if(tool==VP_DARKEN) {
if (dw->weight > paintval)
- dw->weight = paintval*alpha + dw->weight*(1.0-alpha);
+ dw->weight = paintval*alpha + dw->weight*(1.0f-alpha);
}
CLAMP(dw->weight, 0.0f, 1.0f);
@@ -820,22 +820,22 @@ static void wpaint_blend(VPaint *wp, MDeformWeight *dw, MDeformWeight *uw, float
alpha= brush_alpha(brush);
if(tool==VP_MIX || tool==VP_BLUR)
- testw = paintval*alpha + uw->weight*(1.0-alpha);
+ testw = paintval*alpha + uw->weight*(1.0f-alpha);
else if(tool==VP_ADD)
testw = uw->weight + paintval*alpha;
else if(tool==VP_SUB)
testw = uw->weight - paintval*alpha;
else if(tool==VP_MUL)
/* first mul, then blend the fac */
- testw = ((1.0-alpha) + alpha*paintval)*uw->weight;
+ testw = ((1.0f-alpha) + alpha*paintval)*uw->weight;
else if(tool==VP_LIGHTEN) {
if (uw->weight < paintval)
- testw = paintval*alpha + uw->weight*(1.0-alpha);
+ testw = paintval*alpha + uw->weight*(1.0f-alpha);
else
testw = uw->weight;
} else if(tool==VP_DARKEN) {
if (uw->weight > paintval)
- testw = paintval*alpha + uw->weight*(1.0-alpha);
+ testw = paintval*alpha + uw->weight*(1.0f-alpha);
else
testw = uw->weight;
}
@@ -1858,7 +1858,7 @@ static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob, int index
for(i = 0; i < (mface->v4 ? 4 : 3); ++i) {
alpha= calc_vp_alpha_dl(vp, vc, vpd->vpimat, vpd->vertexcosnos+6*(&mface->v1)[i], mval, pressure);
if(alpha)
- vpaint_blend(vp, mcol+i, mcolorig+i, vpd->paintcol, (int)(alpha*255.0));
+ vpaint_blend(vp, mcol+i, mcolorig+i, vpd->paintcol, (int)(alpha*255.0f));
}
}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index c82b7ffdafa..1428a9a9075 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3153,8 +3153,8 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, st
float halfway[2];
float out[3];
- halfway[0] = dx*0.5 + cache->initial_mouse[0];
- halfway[1] = dy*0.5 + cache->initial_mouse[1];
+ halfway[0] = (float)dx * 0.5f + cache->initial_mouse[0];
+ halfway[1] = (float)dy * 0.5f + cache->initial_mouse[1];
if (sculpt_stroke_get_location(C, stroke, out, halfway)) {
copy_v3_v3(sd->anchored_location, out);