diff options
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/color.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/math/color.h b/src/math/color.h index 4f3df16..c938708 100644 --- a/src/math/color.h +++ b/src/math/color.h @@ -49,7 +49,22 @@ public: /// multiply rgb values with scalar value. Color & operator*=(const float scalar); - inline float operator[](size_t index) const { return rgba_data[index]; } + /// 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 ) + */ + 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; }; |