Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/math
diff options
context:
space:
mode:
Diffstat (limited to 'src/math')
-rw-r--r--src/math/color.cc9
-rw-r--r--src/math/color.h3
2 files changed, 12 insertions, 0 deletions
diff --git a/src/math/color.cc b/src/math/color.cc
index 1e52ec5..0cf2ea8 100644
--- a/src/math/color.cc
+++ b/src/math/color.cc
@@ -123,6 +123,15 @@ Color const operator*(float scalar, Color const & color)
{
return color * scalar;
}
+
+Color & Color::operator*=(const float scalar)
+{
+ for (int i=0; i < 3; i++)
+ rgba_data[i] *= scalar;
+ return (*this);
+}
+
+
std::ostream &operator<<(std::ostream &os, Color const & color)
{
os << color.red() << " " << color.green() << " " << color.blue(); // << " " << c.alpha();
diff --git a/src/math/color.h b/src/math/color.h
index ea6fe1c..4f3df16 100644
--- a/src/math/color.h
+++ b/src/math/color.h
@@ -46,6 +46,9 @@ public:
/// multiply rgb values with scalar value.
Color operator*(const float scalar) const;
+ /// multiply rgb values with scalar value.
+ Color & operator*=(const float scalar);
+
inline float operator[](size_t index) const { return rgba_data[index]; }
/// pointer to the internal data