diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-10-03 07:05:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-10-03 07:05:41 +0400 |
commit | 58fe3435b4ab33698c2239aaa8969e234710c00e (patch) | |
tree | 3ff28dcdf71f84273e38637bd96e5c1253e2c358 /source | |
parent | 6ff35258c046565589cc5a9d4f3c74a6f13f0388 (diff) |
adjustments to sculpt cache scaling code, (float/double promotion)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 9b999ce0474..53357b2616b 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3795,30 +3795,27 @@ static void sculpt_update_cache_invariants(bContext *C, Sculpt *sd, SculptSessio Object *ob = CTX_data_active_object(C); float mat[3][3]; float viewDir[3] = {0.0f, 0.0f, 1.0f}; + float max_scale; int i; int mode; ss->cache = cache; /* Set scaling adjustment */ - if (brush->sculpt_tool == SCULPT_TOOL_LAYER) { - cache->scale[0] = 1.0f / ob->size[0]; - cache->scale[1] = 1.0f / ob->size[1]; - cache->scale[2] = 1.0f / ob->size[2]; + max_scale = 1.0f; } else { - float max_scale = 0.0f; - + max_scale = 0.0f; for (i = 0; i < 3; i ++) { - if (fabs(ob->size[i]) > max_scale) - max_scale = fabs(ob->size[i]); + max_scale = max_ff(max_scale, fabsf(ob->size[i])); } - - cache->scale[0] = max_scale / ob->size[0]; - cache->scale[1] = max_scale / ob->size[1]; - cache->scale[2] = max_scale / ob->size[2]; } + cache->scale[0] = max_scale / ob->size[0]; + cache->scale[1] = max_scale / ob->size[1]; + cache->scale[2] = max_scale / ob->size[2]; + + cache->plane_trim_squared = brush->plane_trim * brush->plane_trim; cache->flag = 0; |