diff options
Diffstat (limited to 'indra/llmath/v3colorutil.h')
| -rw-r--r-- | indra/llmath/v3colorutil.h | 68 | 
1 files changed, 27 insertions, 41 deletions
diff --git a/indra/llmath/v3colorutil.h b/indra/llmath/v3colorutil.h index af8799e42a..4dc3100443 100644 --- a/indra/llmath/v3colorutil.h +++ b/indra/llmath/v3colorutil.h @@ -30,59 +30,46 @@  #include "v3color.h"  #include "v4color.h" -inline LLColor3 componentDiv(LLColor3 const &left, LLColor3 const & right) +inline LLColor3 componentDiv(const LLColor3& left, const LLColor3& right)  { -    return LLColor3(left.mV[0] / right.mV[0], -        left.mV[1] / right.mV[1], -        left.mV[2] / right.mV[2]); +    return LLColor3(left.mV[VRED] / right.mV[VRED], left.mV[VGREEN] / right.mV[VGREEN], left.mV[VBLUE] / right.mV[VBLUE]);  } - -inline LLColor3 componentMult(LLColor3 const &left, LLColor3 const & right) +inline LLColor3 componentMult(const LLColor3& left, const LLColor3& right)  { -    return LLColor3(left.mV[0] * right.mV[0], -        left.mV[1] * right.mV[1], -        left.mV[2] * right.mV[2]); +    return LLColor3(left.mV[VRED] * right.mV[VRED], left.mV[VGREEN] * right.mV[VGREEN], left.mV[VBLUE] * right.mV[VBLUE]);  } - -inline LLColor3 componentExp(LLColor3 const &v) +inline LLColor3 componentExp(const LLColor3& v)  { -    return LLColor3(exp(v.mV[0]), -        exp(v.mV[1]), -        exp(v.mV[2])); +    return LLColor3(exp(v.mV[VRED]), exp(v.mV[VGREEN]), exp(v.mV[VBLUE]));  } -inline LLColor3 componentPow(LLColor3 const &v, F32 exponent) +inline LLColor3 componentPow(const LLColor3& v, F32 exponent)  { -    return LLColor3(pow(v.mV[0], exponent), -        pow(v.mV[1], exponent), -        pow(v.mV[2], exponent)); +    return LLColor3(pow(v.mV[VRED], exponent), pow(v.mV[VGREEN], exponent), pow(v.mV[VBLUE], exponent));  } -inline LLColor3 componentSaturate(LLColor3 const &v) +inline LLColor3 componentSaturate(const LLColor3& v)  { -    return LLColor3(std::max(std::min(v.mV[0], 1.f), 0.f), -        std::max(std::min(v.mV[1], 1.f), 0.f), -        std::max(std::min(v.mV[2], 1.f), 0.f)); +    return LLColor3(std::max(std::min(v.mV[VRED], 1.f), 0.f), +                    std::max(std::min(v.mV[VGREEN], 1.f), 0.f), +                    std::max(std::min(v.mV[VBLUE], 1.f), 0.f));  } - -inline LLColor3 componentSqrt(LLColor3 const &v) +inline LLColor3 componentSqrt(const LLColor3& v)  { -    return LLColor3(sqrt(v.mV[0]), -        sqrt(v.mV[1]), -        sqrt(v.mV[2])); +    return LLColor3(sqrt(v.mV[VRED]), sqrt(v.mV[VGREEN]), sqrt(v.mV[VBLUE]));  } -inline void componentMultBy(LLColor3 & left, LLColor3 const & right) +inline void componentMultBy(LLColor3& left, const LLColor3& right)  { -    left.mV[0] *= right.mV[0]; -    left.mV[1] *= right.mV[1]; -    left.mV[2] *= right.mV[2]; +    left.mV[VRED] *= right.mV[VRED]; +    left.mV[VGREEN] *= right.mV[VGREEN]; +    left.mV[VBLUE] *= right.mV[VBLUE];  } -inline LLColor3 colorMix(LLColor3 const & left, LLColor3 const & right, F32 amount) +inline LLColor3 colorMix(const LLColor3& left, const LLColor3& right, F32 amount)  {      return (left + ((right - left) * amount));  } @@ -92,25 +79,24 @@ inline LLColor3 smear(F32 val)      return LLColor3(val, val, val);  } -inline F32 color_intens(const LLColor3 &col) +inline F32 color_intens(const LLColor3& col)  { -    return col.mV[0] + col.mV[1] + col.mV[2]; +    return col.mV[VRED] + col.mV[VGREEN] + col.mV[VBLUE];  } -inline F32 color_max(const LLColor3 &col) +inline F32 color_max(const LLColor3& col)  { -    return llmax(col.mV[0], col.mV[1], col.mV[2]); +    return llmax(col.mV[VRED], col.mV[VGREEN], col.mV[VBLUE]);  } -inline F32 color_max(const LLColor4 &col) +inline F32 color_max(const LLColor4& col)  { -    return llmax(col.mV[0], col.mV[1], col.mV[2]); +    return llmax(col.mV[VRED], col.mV[VGREEN], col.mV[VBLUE]);  } - -inline F32 color_min(const LLColor3 &col) +inline F32 color_min(const LLColor3& col)  { -    return llmin(col.mV[0], col.mV[1], col.mV[2]); +    return llmin(col.mV[VRED], col.mV[VGREEN], col.mV[VBLUE]);  }  #endif  | 
