Merge branch 'master' into blender2.8
[blender.git] / source / blender / render / intern / source / multires_bake.c
index 9fb7e718b18d01ef315d915c99a32f14906c5bbb..d506028e306b67d72aeb801da58813688e9b05c5 100644 (file)
@@ -784,7 +784,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;
        }
 }
@@ -1158,7 +1158,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;
        }
 }
@@ -1215,7 +1215,7 @@ static void bake_ibuf_normalize_displacement(ImBuf *ibuf, float *displacement, c
 
                        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;
                        }
                }