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>2014-09-17 08:11:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-09-24 08:55:02 +0400
commit3a40aed3d52aeb24973385d3aa8e0c2234bf0435 (patch)
treea4a51efdc304420f0163ea40e1a14a4e206e3828 /source/blender/editors/sculpt_paint
parente7f495d8a076c35d2088d73fac0ed2eeb5ea1fbb (diff)
Cleanup: use float versions of functions when in/output are floats
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c6
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c12
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_uv.c16
6 files changed, 22 insertions, 22 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 165888b3c09..5530f947b8c 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -1564,7 +1564,7 @@ void paint_2d_gradient_fill(
sub_v2_v2v2(tangent, image_final, image_init);
line_len = len_squared_v2(tangent);
line_len_sq_inv = 1.0f / line_len;
- line_len = sqrt(line_len);
+ line_len = sqrtf(line_len);
do_float = (ibuf->rect_float != NULL);
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index e9d1d5487a0..ee9181b7d3f 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -4077,7 +4077,7 @@ static void *do_projectpaint_thread(void *ph_v)
sub_v2_v2v2(tangent, pos, lastpos);
line_len = len_squared_v2(tangent);
line_len_sq_inv = 1.0f / line_len;
- line_len = sqrt(line_len);
+ line_len = sqrtf(line_len);
switch (brush->gradient_fill_mode) {
case BRUSH_GRADIENT_LINEAR:
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 9eaaf5fe122..dc6be9caa53 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -667,7 +667,7 @@ static void stencil_set_target(StencilControlData *scd)
scd->lenorig = len_v2(mdiff);
- scd->init_angle = atan2(mdiff[1], mdiff[0]);
+ scd->init_angle = atan2f(mdiff[1], mdiff[0]);
}
static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -763,7 +763,7 @@ static void stencil_control_calculate(StencilControlData *scd, const int mval[2]
{
float angle;
sub_v2_v2v2(mdiff, mvalf, scd->pos_target);
- angle = atan2(mdiff[1], mdiff[0]);
+ angle = atan2f(mdiff[1], mdiff[0]);
angle = scd->init_rot + angle - scd->init_angle;
if (angle < 0.0f)
angle += (float)(2 * M_PI);
@@ -916,7 +916,7 @@ static int stencil_fit_image_aspect_exec(bContext *C, wmOperator *op)
stencil_area = br->stencil_dimension[0] * br->stencil_dimension[1];
}
- factor = sqrt(stencil_area / orig_area);
+ factor = sqrtf(stencil_area / orig_area);
if (do_mask) {
br->mask_stencil_dimension[0] = factor * aspx;
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 8f189b49aa6..1ed5ad8160c 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -283,9 +283,9 @@ static bool paint_brush_update(bContext *C,
const float dx = mouse[0] - stroke->initial_mouse[0];
const float dy = mouse[1] - stroke->initial_mouse[1];
- ups->anchored_size = ups->pixel_radius = sqrt(dx * dx + dy * dy);
+ ups->anchored_size = ups->pixel_radius = sqrtf(dx * dx + dy * dy);
- ups->brush_rotation = atan2(dx, dy) + M_PI;
+ ups->brush_rotation = atan2f(dx, dy) + M_PI;
if (brush->flag & BRUSH_EDGE_TO_EDGE) {
halfway[0] = dx * 0.5f + stroke->initial_mouse[0];
@@ -498,7 +498,7 @@ static float paint_stroke_overlapped_curve(Brush *br, float x, float spacing)
for (i = 0; i < n; i++) {
float xx;
- xx = fabs(x0 + i * h);
+ xx = fabsf(x0 + i * h);
if (xx < 1.0f)
sum += BKE_brush_curve_strength(br, xx, 1);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 33d0510c08a..7e518242b00 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -550,7 +550,7 @@ static bool sculpt_brush_test(SculptBrushTest *test, const float co[3])
if (sculpt_brush_test_clipping(test, co)) {
return 0;
}
- test->dist = sqrt(distsq);
+ test->dist = sqrtf(distsq);
return 1;
}
else {
@@ -2553,7 +2553,7 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
sub_v3_v3v3(val, intr, vd.co);
if (plane_trim(ss->cache, brush, val)) {
- const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrt(test.dist),
+ const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrtf(test.dist),
vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f);
mul_v3_v3fl(proxy[vd.i], val, fade);
@@ -2626,7 +2626,7 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
sub_v3_v3v3(val, intr, vd.co);
if (plane_trim(ss->cache, brush, val)) {
- const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrt(test.dist),
+ const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrtf(test.dist),
vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f);
mul_v3_v3fl(proxy[vd.i], val, fade);
@@ -2792,7 +2792,7 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
if (plane_trim(ss->cache, brush, val)) {
const float fade = bstrength * tex_strength(ss, brush, vd.co,
- sqrt(test.dist),
+ sqrtf(test.dist),
vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f);
mul_v3_v3fl(proxy[vd.i], val, fade);
@@ -2856,7 +2856,7 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
if (plane_trim(ss->cache, brush, val)) {
const float fade = bstrength * tex_strength(ss, brush, vd.co,
- sqrt(test.dist),
+ sqrtf(test.dist),
vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f);
mul_v3_v3fl(proxy[vd.i], val, fade);
@@ -2899,7 +2899,7 @@ static void do_gravity(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, fl
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if (sculpt_brush_test_sq(&test, vd.co)) {
- const float fade = tex_strength(ss, brush, vd.co, sqrt(test.dist), vd.no,
+ const float fade = tex_strength(ss, brush, vd.co, sqrtf(test.dist), vd.no,
vd.fno, vd.mask ? *vd.mask : 0.0f);
mul_v3_v3fl(proxy[vd.i], offset, fade);
diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c
index 292d6236bab..5b46e5c3a59 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -273,7 +273,7 @@ static void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata,
Temp_UVData *tmp_uvdata;
float diff[2];
int i;
- float radius_root = sqrt(radius);
+ float radius_root = sqrtf(radius);
Brush *brush = BKE_paint_brush(sculptdata->uvsculpt);
tmp_uvdata = (Temp_UVData *)MEM_callocN(sculptdata->totalUniqueUvs * sizeof(Temp_UVData), "Temporal data");
@@ -316,7 +316,7 @@ static void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata,
if ((dist = dot_v2v2(diff, diff)) <= radius) {
UvElement *element;
float strength;
- strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root);
+ strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root);
sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * (tmp_uvdata[i].p[0] - 0.5f * (tmp_uvdata[i].b[0] + tmp_uvdata[i].sum_b[0] / tmp_uvdata[i].ncounter));
sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * (tmp_uvdata[i].p[1] - 0.5f * (tmp_uvdata[i].b[1] + tmp_uvdata[i].sum_b[1] / tmp_uvdata[i].ncounter));
@@ -345,7 +345,7 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *scul
Temp_UVData *tmp_uvdata;
float diff[2];
int i;
- float radius_root = sqrt(radius);
+ float radius_root = sqrtf(radius);
Brush *brush = BKE_paint_brush(sculptdata->uvsculpt);
tmp_uvdata = (Temp_UVData *)MEM_callocN(sculptdata->totalUniqueUvs * sizeof(Temp_UVData), "Temporal data");
@@ -380,7 +380,7 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *scul
if ((dist = dot_v2v2(diff, diff)) <= radius) {
UvElement *element;
float strength;
- strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root);
+ strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root);
sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * tmp_uvdata[i].p[0];
sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * tmp_uvdata[i].p[1];
@@ -434,7 +434,7 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, const wmEvent *e
/* We will compare squares to save some computation */
radius = radius * radius;
- radius_root = sqrt(radius);
+ radius_root = sqrtf(radius);
/*
* Pinch Tool
@@ -455,7 +455,7 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, const wmEvent *e
if ((dist = dot_v2v2(diff, diff)) <= radius) {
UvElement *element;
float strength;
- strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root);
+ strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root);
normalize_v2(diff);
sculptdata->uv[i].uv[0] -= strength * diff[0] * 0.001f;
@@ -803,7 +803,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
aspectRatio = width / (float)height;
radius /= (width * zoomx);
radius = radius * radius;
- radius_root = sqrt(radius);
+ radius_root = sqrtf(radius);
/* Allocate selection stack */
data->initial_stroke = MEM_mallocN(sizeof(*data->initial_stroke), "uv_sculpt_initial_stroke");
@@ -829,7 +829,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
diff[1] /= aspectRatio;
if ((dist = dot_v2v2(diff, diff)) <= radius) {
float strength;
- strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root);
+ strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root);
data->initial_stroke->initialSelection[counter].uv = i;
data->initial_stroke->initialSelection[counter].strength = strength;