diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 736578361b3..f318ae0e39f 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -335,6 +335,60 @@ if ((a) < (b)) (a) = (b); \ } (void)0 +#define CLAMP2(vec, b, c) { \ + CLAMP((vec)[0], b, c); \ + CLAMP((vec)[1], b, c); \ +} (void)0 + +#define CLAMP2_MIN(vec, b) { \ + CLAMP_MIN((vec)[0], b); \ + CLAMP_MIN((vec)[1], b); \ +} (void)0 + +#define CLAMP2_MAX(vec, b) { \ + CLAMP_MAX((vec)[0], b); \ + CLAMP_MAX((vec)[1], b); \ +} (void)0 + +#define CLAMP3(vec, b, c) { \ + CLAMP((vec)[0], b, c); \ + CLAMP((vec)[1], b, c); \ + CLAMP((vec)[2], b, c); \ +} (void)0 + +#define CLAMP3_MIN(vec, b) { \ + CLAMP_MIN((vec)[0], b); \ + CLAMP_MIN((vec)[1], b); \ + CLAMP_MIN((vec)[2], b); \ +} (void)0 + +#define CLAMP3_MAX(vec, b) { \ + CLAMP_MAX((vec)[0], b); \ + CLAMP_MAX((vec)[1], b); \ + CLAMP_MAX((vec)[2], b); \ +} (void)0 + +#define CLAMP4(vec, b, c) { \ + CLAMP((vec)[0], b, c); \ + CLAMP((vec)[1], b, c); \ + CLAMP((vec)[2], b, c); \ + CLAMP((vec)[3], b, c); \ +} (void)0 + +#define CLAMP4_MIN(vec, b) { \ + CLAMP_MIN((vec)[0], b); \ + CLAMP_MIN((vec)[1], b); \ + CLAMP_MIN((vec)[2], b); \ + CLAMP_MIN((vec)[3], b); \ +} (void)0 + +#define CLAMP4_MAX(vec, b) { \ + CLAMP_MAX((vec)[0], b); \ + CLAMP_MAX((vec)[1], b); \ + CLAMP_MAX((vec)[2], b); \ + CLAMP_MAX((vec)[3], b); \ +} (void)0 + #define IS_EQ(a, b) ( \ CHECK_TYPE_INLINE(a, double), CHECK_TYPE_INLINE(b, double), \ ((fabs((double)((a) - (b))) >= (double) FLT_EPSILON) ? false : true)) |