forked from bartvdbraak/blender
Fix unreported: inaccuracy of interpolation of custom color layers due to float truncation
Same solution from rBd23459f51640 but now in `layerInterp_mcol` Also a cleaning was done in the includes
This commit is contained in:
parent
f68145011f
commit
a6f74453b6
@ -33,14 +33,10 @@
|
|||||||
/** \file blender/blenkernel/intern/customdata.c
|
/** \file blender/blenkernel/intern/customdata.c
|
||||||
* \ingroup bke
|
* \ingroup bke
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
|
#include "DNA_customdata_types.h"
|
||||||
#include "DNA_meshdata_types.h"
|
#include "DNA_meshdata_types.h"
|
||||||
#include "DNA_ID.h"
|
#include "DNA_ID.h"
|
||||||
|
|
||||||
@ -48,7 +44,6 @@
|
|||||||
#include "BLI_path_util.h"
|
#include "BLI_path_util.h"
|
||||||
#include "BLI_string.h"
|
#include "BLI_string.h"
|
||||||
#include "BLI_string_utils.h"
|
#include "BLI_string_utils.h"
|
||||||
#include "BLI_math.h"
|
|
||||||
#include "BLI_math_color_blend.h"
|
#include "BLI_math_color_blend.h"
|
||||||
#include "BLI_mempool.h"
|
#include "BLI_mempool.h"
|
||||||
|
|
||||||
@ -66,16 +61,11 @@
|
|||||||
|
|
||||||
#include "bmesh.h"
|
#include "bmesh.h"
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/* number of layers to add when growing a CustomData object */
|
/* number of layers to add when growing a CustomData object */
|
||||||
#define CUSTOMDATA_GROW 5
|
#define CUSTOMDATA_GROW 5
|
||||||
|
|
||||||
/* ensure typemap size is ok */
|
/* ensure typemap size is ok */
|
||||||
BLI_STATIC_ASSERT(sizeof(((CustomData *)NULL)->typemap) /
|
BLI_STATIC_ASSERT(ARRAY_SIZE(((CustomData *)NULL)->typemap) == CD_NUMTYPES, "size mismatch");
|
||||||
sizeof(((CustomData *)NULL)->typemap[0]) == CD_NUMTYPES,
|
|
||||||
"size mismatch");
|
|
||||||
|
|
||||||
|
|
||||||
/********************* Layer type information **********************/
|
/********************* Layer type information **********************/
|
||||||
@ -1062,15 +1052,10 @@ static void layerInterp_mcol(
|
|||||||
|
|
||||||
/* Subdivide smooth or fractal can cause problems without clamping
|
/* Subdivide smooth or fractal can cause problems without clamping
|
||||||
* although weights should also not cause this situation */
|
* although weights should also not cause this situation */
|
||||||
CLAMP(col[j].a, 0.0f, 255.0f);
|
mc[j].a = CLAMPIS(iroundf(col[j].a), 0, 255);
|
||||||
CLAMP(col[j].r, 0.0f, 255.0f);
|
mc[j].r = CLAMPIS(iroundf(col[j].r), 0, 255);
|
||||||
CLAMP(col[j].g, 0.0f, 255.0f);
|
mc[j].g = CLAMPIS(iroundf(col[j].g), 0, 255);
|
||||||
CLAMP(col[j].b, 0.0f, 255.0f);
|
mc[j].b = CLAMPIS(iroundf(col[j].b), 0, 255);
|
||||||
|
|
||||||
mc[j].a = (int)col[j].a;
|
|
||||||
mc[j].r = (int)col[j].r;
|
|
||||||
mc[j].g = (int)col[j].g;
|
|
||||||
mc[j].b = (int)col[j].b;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user