13 #include "ai_constants.h"
50 AtRGB operator+(
float f)
const
59 AtRGB& operator+=(
float f)
84 AtRGB operator-(
float f)
const
93 AtRGB& operator-=(
float f)
101 AtRGB operator-()
const
127 AtRGB operator*(
float f)
const
136 AtRGB operator*=(
float f)
161 AtRGB operator/(
float f)
const
164 float inv = 1.0f / f;
171 AtRGB operator/=(
float f)
173 float inv = 1.0f / f;
180 bool operator==(
const AtRGB& rgb)
const
182 return (r == rgb.r && g == rgb.g && b == rgb.b);
185 bool operator!=(
const AtRGB& rgb)
const
187 return !(*
this == rgb);
190 AtRGB& operator=(
float f)
198 float& operator[](
unsigned int i)
203 const float& operator[](
unsigned int i)
const
208 friend AtRGB operator*(
float f,
const AtRGB& rgb);
209 friend AtRGB operator+(
float f,
const AtRGB& rgb);
210 friend AtRGB operator-(
float f,
const AtRGB& rgb);
213 inline AtRGB operator*(
float f,
const AtRGB& rgb)
218 inline AtRGB operator+(
float f,
const AtRGB& rgb)
223 inline AtRGB operator-(
float f,
const AtRGB& rgb)
246 return *
static_cast<AtRGB*
>(
static_cast<void*
>(
this));
249 const AtRGB& rgb()
const
251 return *
static_cast<const AtRGB*
>(
static_cast<const void*
>(
this));
279 AtRGBA operator+(
float f)
const
289 AtRGBA& operator+=(
float f)
317 AtRGBA operator-(
float f)
const
327 AtRGBA& operator-=(
float f)
365 AtRGBA operator*(
float f)
const
375 AtRGBA operator*=(
float f)
403 AtRGBA operator/(
float f)
const
406 float inv = 1.0f / f;
414 AtRGBA operator/=(
float f)
416 float inv = 1.0f / f;
425 bool operator==(
const AtRGBA& rgba)
const
427 return (r == rgba.r && g == rgba.g && b == rgba.b && a == rgba.a);
430 bool operator!=(
const AtRGBA& rgba)
const
432 return !(*
this == rgba);
435 AtRGBA& operator=(
float f)
444 float& operator[](
unsigned int i)
449 const float& operator[](
unsigned int i)
const
507 AtRGBA out = {r, g, b, a};
539 out.r =
LERP(t, lo.r, hi.r);
540 out.g =
LERP(t, lo.g, hi.g);
541 out.b =
LERP(t, lo.b, hi.b);
552 out.r =
LERP(t, lo.r, hi.r);
553 out.g =
LERP(t, lo.g, hi.g);
554 out.b =
LERP(t, lo.b, hi.b);
555 out.a =
LERP(t, lo.a, hi.a);
566 out.r =
HERP(t, lo.r, hi.r);
567 out.g =
HERP(t, lo.g, hi.g);
568 out.b =
HERP(t, lo.b, hi.b);
579 out.r =
HERP(t, lo.r, hi.r);
580 out.g =
HERP(t, lo.g, hi.g);
581 out.b =
HERP(t, lo.b, hi.b);
582 out.a =
HERP(t, lo.a, hi.a);
593 out.r =
LERP(t, lo.r, hi.r);
594 out.g =
LERP(t, lo.g, hi.g);
595 out.b =
LERP(t, lo.b, hi.b);
596 out.a =
LERP(t, lo.a, hi.a);
607 out.r =
HERP(t, lo.r, hi.r);
608 out.g =
HERP(t, lo.g, hi.g);
609 out.b =
HERP(t, lo.b, hi.b);
610 out.a =
HERP(t, lo.a, hi.a);
660 out.r =
CLAMP(c.r, lo, hi);
661 out.g =
CLAMP(c.g, lo, hi);
662 out.b =
CLAMP(c.b, lo, hi);
672 out.r =
CLAMP(c.r, lo, hi);
673 out.g =
CLAMP(c.g, lo, hi);
674 out.b =
CLAMP(c.b, lo, hi);
675 out.a =
CLAMP(c.a, lo, hi);
684 c.r =
MAX(0.0f, c.r);
685 c.g =
MAX(0.0f, c.g);
686 c.b =
MAX(0.0f, c.b);
694 return ABS(c.r) < epsilon &&
ABS(c.g) < epsilon &&
ABS(c.b) < epsilon;
700 #define AiColorIsZero AiColorIsSmall
707 return (a.r == b.r) && (a.g == b.g) && (a.b == b.b);
715 return (a.r == b.r) && (a.g == b.g) && (a.b == b.b);
748 return MAX3(c.r, c.g, c.b);
756 return MAX3(c.r, c.g, c.b);
764 return ABS(c1.r - c2.r) >= t ||
ABS(c1.g - c2.g) >= t ||
ABS(c1.b - c2.b) >= t;
797 return (c.r + c.g + c.b) / 3;
805 return (rgba.r + rgba.g + rgba.b) / 3;
840 return c*c0 + a*c1 + b*c2;
968 inline AtColor AiColorCreate(
float r,
float g,
float b)
974 inline void AiColorCreate(
AtColor& out,
float r,
float g,
float b)
1024 AI_API
AtRGB AI_RGB_BLACK;
1025 AI_API
AtRGB AI_RGB_RED;
1026 AI_API
AtRGB AI_RGB_GREEN;
1027 AI_API
AtRGB AI_RGB_BLUE;
1028 AI_API
AtRGB AI_RGB_50GREY;
1029 AI_API
AtRGB AI_RGB_WHITE;
1031 AI_API
AtRGBA AI_RGBA_BLACK;
1032 AI_API
AtRGBA AI_RGBA_RED;
1033 AI_API
AtRGBA AI_RGBA_GREEN;
1034 AI_API
AtRGBA AI_RGBA_BLUE;
1035 AI_API
AtRGBA AI_RGBA_50GREY;
1036 AI_API
AtRGBA AI_RGBA_WHITE;