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>2018-05-07 18:31:28 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-07 18:51:40 +0300
commitf74d85ffc8232a859b1419f5dc25b244ae04375f (patch)
treef74928d7681488c044ea65249eaaa5b6900d246b /source/blender/render
parent905eeb0bc7f46efb95cb5450cc6c2ec27f02730c (diff)
Cleanup: rename char/float conversion functions
- FTOCHAR -> unit_float_to_uchar_clamp - F3TOCHAR3 -> unit_float_to_uchar_clamp_v3 (swap args) - F4TOCHAR4 -> unit_float_to_uchar_clamp_v4 (swap args) - FTOUSHORT -> unit_float_to_ushort_clamp - USHORTTOUCHAR -> unit_ushort_to_uchar
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/intern/source/bake.c10
-rw-r--r--source/blender/render/intern/source/multires_bake.c4
2 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/render/intern/source/bake.c b/source/blender/render/intern/source/bake.c
index b5a37d1d42b..12be60d5171 100644
--- a/source/blender/render/intern/source/bake.c
+++ b/source/blender/render/intern/source/bake.c
@@ -305,7 +305,7 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
}
if (ELEM(bs->type, RE_BAKE_ALL, RE_BAKE_TEXTURE, RE_BAKE_VERTEX_COLORS)) {
- col[3] = FTOCHAR(shr.alpha);
+ col[3] = unit_float_to_uchar_clamp(shr.alpha);
}
else {
col[3] = 255;
@@ -364,7 +364,7 @@ static void bake_displacement(void *handle, ShadeInput *UNUSED(shi), float dist,
else {
/* Target is char (LDR). */
unsigned char col[4];
- col[0] = col[1] = col[2] = FTOCHAR(disp);
+ col[0] = col[1] = col[2] = unit_float_to_uchar_clamp(disp);
col[3] = 255;
if (bs->vcol) {
@@ -972,7 +972,7 @@ void RE_bake_ibuf_normalize_displacement(ImBuf *ibuf, float *displacement, char
if (ibuf->rect) {
unsigned char *cp = (unsigned char *) (ibuf->rect + i);
- cp[0] = cp[1] = cp[2] = FTOCHAR(normalized_displacement);
+ cp[0] = cp[1] = cp[2] = unit_float_to_uchar_clamp(normalized_displacement);
cp[3] = 255;
}
}
@@ -1329,8 +1329,8 @@ float RE_bake_make_derivative(ImBuf *ibuf, float *heights_buffer, const char *ma
else {
char *rrgb = (char *)ibuf->rect + index * 4;
- rrgb[0] = FTOCHAR(deriv_x);
- rrgb[1] = FTOCHAR(deriv_y);
+ rrgb[0] = unit_float_to_uchar_clamp(deriv_x);
+ rrgb[1] = unit_float_to_uchar_clamp(deriv_y);
rrgb[2] = 0;
rrgb[3] = 255;
}
diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/source/multires_bake.c
index 9e0685d55f1..d85cc87dfe3 100644
--- a/source/blender/render/intern/source/multires_bake.c
+++ b/source/blender/render/intern/source/multires_bake.c
@@ -797,7 +797,7 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
}
else {
char *rrgb = (char *)ibuf->rect + pixel * 4;
- rrgb[0] = rrgb[1] = rrgb[2] = FTOCHAR(len);
+ rrgb[0] = rrgb[1] = rrgb[2] = unit_float_to_uchar_clamp(len);
rrgb[3] = 255;
}
}
@@ -1169,7 +1169,7 @@ static void apply_ao_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, void
}
else {
unsigned char *rrgb = (unsigned char *) ibuf->rect + pixel * 4;
- rrgb[0] = rrgb[1] = rrgb[2] = FTOCHAR(value);
+ rrgb[0] = rrgb[1] = rrgb[2] = unit_float_to_uchar_clamp(value);
rrgb[3] = 255;
}
}