From 18383a5fc596bf9546f14d7393ee66c57720b116 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 12 Oct 2008 11:14:22 +0000 Subject: libmath API cleanup --- src/math/color.h | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src/math/color.h') diff --git a/src/math/color.h b/src/math/color.h index c938708..762ac94 100644 --- a/src/math/color.h +++ b/src/math/color.h @@ -24,7 +24,7 @@ public: Color(const float grey, const float=1.0f); /// create a copy from an existing color Color(Color const & other); - + /// red channel value float red() const; /// green channel value @@ -33,7 +33,7 @@ public: float blue() const; /// alpha channel value float alpha() const; - + /// assignment void assign(Color const & other); /// assignment @@ -42,21 +42,21 @@ public: void assign(float grey, float alpha=1.0f); /// assignment operator Color const &operator=(Color const & other); - + /// multiply rgb values with scalar value. Color operator*(const float scalar) const; - + /// multiply rgb values with scalar value. Color & operator*=(const float scalar); - - /// assign a value to an element of this color + + /// assign a value to an element of this color /*! WARNING: range is not checked * @param index the index of the element to assign to ( 0 <= index < 4 ) */ inline float& operator[](const size_t index) { return rgba_data[index]; } - + /// returns the value of an element of this color /*! WARNING: range is not checked * @param index the index of the element to return ( 0 <= index < 4 ) @@ -64,19 +64,21 @@ public: inline float operator[](const size_t index) const { return rgba_data[index]; } - - + + /// pointer to the internal data - inline float *ptr() const { return (float *) rgba_data; }; - + inline float *ptr() const { + return (float *) rgba_data; + } + /// clamp color values to the 0-1 range void clamp(); - + float &r; float &g; float &b; float &a; - + private: float rgba_data[4]; -- cgit v1.2.3