Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-10-12 11:14:22 +0000
committerStijn Buys <ingar@osirion.org>2008-10-12 11:14:22 +0000
commit18383a5fc596bf9546f14d7393ee66c57720b116 (patch)
tree5382c3b380a72149eabbc4f75a2c5744b895e48a /src/math/color.h
parent0d831968949b1119db48530a86c2d1651c6cbfc6 (diff)
libmath API cleanup
Diffstat (limited to 'src/math/color.h')
-rw-r--r--src/math/color.h28
1 files changed, 15 insertions, 13 deletions
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];