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-02-02 19:46:45 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-02 19:46:45 +0400
commitfed1b8b16d2d6a56aeea496677f24b286672bb74 (patch)
tree542e5f6bcfef3491e61f745b4aa1cee769dff63c /source/blender/editors/sculpt_paint
parentdda63375b2fa581197e909c45116ac17b5f8782c (diff)
Code cleanup: suffix vars to make obvious they are squared
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_proj.c16
3 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 9f3743cf28f..2e8a8a32ce9 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -3814,7 +3814,7 @@ static void *do_projectpaint_thread(void *ph_v)
ProjPaintImage *last_projIma = NULL;
ImagePaintPartialRedraw *last_partial_redraw_cell;
- float dist_nosqrt, dist;
+ float dist_sq, dist;
float falloff;
int bucket_index;
@@ -3914,11 +3914,11 @@ static void *do_projectpaint_thread(void *ph_v)
projPixel = (ProjPixel *)node->link;
- dist_nosqrt = len_squared_v2v2(projPixel->projCoSS, pos);
+ dist_sq = len_squared_v2v2(projPixel->projCoSS, pos);
/*if (dist < radius) {*/ /* correct but uses a sqrtf */
- if (dist_nosqrt <= brush_radius_sq) {
- dist = sqrtf(dist_nosqrt);
+ if (dist_sq <= brush_radius_sq) {
+ dist = sqrtf(dist_sq);
falloff = BKE_brush_curve_strength_clamp(ps->brush, dist, brush_radius);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index f04e94719c0..d6d13decf4d 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -917,11 +917,11 @@ static float calc_vp_strength_col_dl(VPaint *vp, ViewContext *vc, const float co
co, co_ss,
V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
{
- const float dist_squared = len_squared_v2v2(mval, co_ss);
+ const float dist_sq = len_squared_v2v2(mval, co_ss);
- if (dist_squared <= brush_size_pressure * brush_size_pressure) {
+ if (dist_sq <= brush_size_pressure * brush_size_pressure) {
Brush *brush = BKE_paint_brush(&vp->paint);
- const float dist = sqrtf(dist_squared);
+ const float dist = sqrtf(dist_sq);
float factor;
if (brush->mtex.tex && rgba) {
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_proj.c b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
index 4c06cb8ea0d..cf15fc3b2db 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
@@ -56,7 +56,7 @@ struct VertProjHandle {
bool use_update;
/* use for update */
- float *dists;
+ float *dists_sq;
Object *ob;
Scene *scene;
@@ -144,13 +144,13 @@ static void vpaint_proj_dm_map_cosnos_update__map_cb(void *userData, int index,
co, co_ss,
V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
{
- const float dist = len_squared_v2v2(vp_update->mval_fl, co_ss);
- if (dist > vp_handle->dists[index]) {
+ const float dist_sq = len_squared_v2v2(vp_update->mval_fl, co_ss);
+ if (dist_sq > vp_handle->dists_sq[index]) {
/* bail out! */
return;
}
- vp_handle->dists[index] = dist;
+ vp_handle->dists_sq[index] = dist_sq;
}
}
/* continue with regular functionality */
@@ -181,7 +181,7 @@ static void vpaint_proj_dm_map_cosnos_update(struct VertProjHandle *vp_handle,
/* highly unlikely this will become unavailable once painting starts (perhaps with animated modifiers) */
if (LIKELY(dm->foreachMappedVert)) {
- fill_vn_fl(vp_handle->dists, me->totvert, FLT_MAX);
+ fill_vn_fl(vp_handle->dists_sq, me->totvert, FLT_MAX);
dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_update__map_cb, &vp_update, DM_FOREACH_USE_NORMAL);
}
@@ -207,13 +207,13 @@ struct VertProjHandle *ED_vpaint_proj_handle_create(Scene *scene, Object *ob,
vpaint_proj_dm_map_cosnos_init(scene, ob, vp_handle);
if (vp_handle->use_update) {
- vp_handle->dists = MEM_mallocN(sizeof(float) * me->totvert, __func__);
+ vp_handle->dists_sq = MEM_mallocN(sizeof(float) * me->totvert, __func__);
vp_handle->ob = ob;
vp_handle->scene = scene;
}
else {
- vp_handle->dists = NULL;
+ vp_handle->dists_sq = NULL;
vp_handle->ob = NULL;
vp_handle->scene = NULL;
@@ -234,7 +234,7 @@ void ED_vpaint_proj_handle_update(struct VertProjHandle *vp_handle,
void ED_vpaint_proj_handle_free(struct VertProjHandle *vp_handle)
{
if (vp_handle->use_update) {
- MEM_freeN(vp_handle->dists);
+ MEM_freeN(vp_handle->dists_sq);
}
MEM_freeN(vp_handle->vcosnos);