From cc906e0e2a1de9b19c6cefa1167332f348bb9e0f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 5 Sep 2011 05:43:01 +0000 Subject: correct float -> double promotion warnings --- .../blender/modifiers/intern/MOD_weightvg_util.c | 24 +++++++++++----------- source/blender/modifiers/intern/MOD_weightvgmix.c | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index 8952d70d323..93e1899ad60 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -69,7 +69,7 @@ void weightvg_do_mask(int num, int *indices, float *org_w, float *new_w, Object int i; /* If influence factor is null, nothing to do! */ - if (fact == 0.0) return; + if (fact == 0.0f) return; /* If we want to mask vgroup weights from a texture. */ if (texture) { @@ -105,34 +105,34 @@ void weightvg_do_mask(int num, int *indices, float *org_w, float *new_w, Object /* Get the good channel value… */ switch(tex_use_channel) { case MOD_WVG_MASK_TEX_USE_INT: - org_w[i] = (new_w[i] * texres.tin * fact) + (org_w[i] * (1.0 - (texres.tin*fact))); + org_w[i] = (new_w[i] * texres.tin * fact) + (org_w[i] * (1.0f - (texres.tin*fact))); break; case MOD_WVG_MASK_TEX_USE_RED: - org_w[i] = (new_w[i] * texres.tr * fact) + (org_w[i] * (1.0 - (texres.tr*fact))); + org_w[i] = (new_w[i] * texres.tr * fact) + (org_w[i] * (1.0f - (texres.tr*fact))); break; case MOD_WVG_MASK_TEX_USE_GREEN: - org_w[i] = (new_w[i] * texres.tg * fact) + (org_w[i] * (1.0 - (texres.tg*fact))); + org_w[i] = (new_w[i] * texres.tg * fact) + (org_w[i] * (1.0f - (texres.tg*fact))); break; case MOD_WVG_MASK_TEX_USE_BLUE: - org_w[i] = (new_w[i] * texres.tb * fact) + (org_w[i] * (1.0 - (texres.tb*fact))); + org_w[i] = (new_w[i] * texres.tb * fact) + (org_w[i] * (1.0f - (texres.tb*fact))); break; case MOD_WVG_MASK_TEX_USE_HUE: rgb_to_hsv(texres.tr, texres.tg, texres.tb, &h, &s, &v); - org_w[i] = (new_w[i] * h * fact) + (org_w[i] * (1.0 - (h*fact))); + org_w[i] = (new_w[i] * h * fact) + (org_w[i] * (1.0f - (h*fact))); break; case MOD_WVG_MASK_TEX_USE_SAT: rgb_to_hsv(texres.tr, texres.tg, texres.tb, &h, &s, &v); - org_w[i] = (new_w[i] * s * fact) + (org_w[i] * (1.0 - (s*fact))); + org_w[i] = (new_w[i] * s * fact) + (org_w[i] * (1.0f - (s*fact))); break; case MOD_WVG_MASK_TEX_USE_VAL: rgb_to_hsv(texres.tr, texres.tg, texres.tb, &h, &s, &v); - org_w[i] = (new_w[i] * v * fact) + (org_w[i] * (1.0 - (v*fact))); + org_w[i] = (new_w[i] * v * fact) + (org_w[i] * (1.0f - (v*fact))); break; case MOD_WVG_MASK_TEX_USE_ALPHA: - org_w[i] = (new_w[i] * texres.ta * fact) + (org_w[i] * (1.0 - (texres.ta*fact))); + org_w[i] = (new_w[i] * texres.ta * fact) + (org_w[i] * (1.0f - (texres.ta*fact))); break; default: - org_w[i] = (new_w[i] * texres.tin * fact) + (org_w[i] * (1.0 - (texres.tin*fact))); + org_w[i] = (new_w[i] * texres.tin * fact) + (org_w[i] * (1.0f - (texres.tin*fact))); break; } } @@ -164,7 +164,7 @@ void weightvg_do_mask(int num, int *indices, float *org_w, float *new_w, Object else { /* Default "influence" behavior. */ /* For each weight (vertex), make the mix between org and new weights. */ - const float ifact= 1.0-fact; + const float ifact= 1.0f - fact; for (i = 0; i < num; i++) { org_w[i] = (new_w[i] * fact) + (org_w[i] * ifact); } @@ -189,7 +189,7 @@ void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, int num, MDeformWeight *newdw; /* Never allow weights out of [0.0, 1.0] range. */ - CLAMP(w, 0.0, 1.0); + CLAMP(w, 0.0f, 1.0f); /* Let's first check to see if this vert is already in the weight group – if so * let's update it, or remove it if needed. diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index a30afcb230f..7543b085b51 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -98,16 +98,16 @@ static float mix_weight(float weight, float weight2, char mix_mode) return (weight * weight2); else if (mix_mode == MOD_WVG_MIX_DIV) { /* Avoid dividing by zero (or really small values). */ - if (weight2 < 0.0 && weight2 > -MOD_WVG_ZEROFLOOR) + if (weight2 < 0.0f && weight2 > -MOD_WVG_ZEROFLOOR) weight2 = -MOD_WVG_ZEROFLOOR; - else if (weight2 >= 0.0 && weight2 < MOD_WVG_ZEROFLOOR) + else if (weight2 >= 0.0f && weight2 < MOD_WVG_ZEROFLOOR) weight2 = MOD_WVG_ZEROFLOOR; return (weight / weight2); } else if (mix_mode == MOD_WVG_MIX_DIF) return (weight < weight2 ? weight2 - weight : weight - weight2); else if (mix_mode == MOD_WVG_MIX_AVG) - return (weight + weight2) / 2.0; + return (weight + weight2) * 0.5f; else return weight2; } -- cgit v1.2.3