Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/color.cc')
-rw-r--r--src/math/color.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/math/color.cc b/src/math/color.cc
index b807b96..70a48e5 100644
--- a/src/math/color.cc
+++ b/src/math/color.cc
@@ -131,6 +131,12 @@ Color & Color::operator*=(const float scalar)
return (*this);
}
+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)
{
@@ -143,6 +149,11 @@ std::istream &operator>>(std::istream & is, Color & color)
is >> color.r;
is >> color.g;
is >> color.b;
+
+ if ((color.r > 1.0f) || (color.g > 1.0f) || (color.b > 1.0f)) {
+ color /= 255.0f;
+ }
+
//is >> color.a;
color.a = 1.0;
return (is);