summaryrefslogtreecommitdiffstats
path: root/src/graphics/common/color.h
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-07-15 19:17:49 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-07-15 19:17:49 +0200
commit54f4da87923465a5387e2e854b58616647deb7af (patch)
treefc52b1866b29393be7d61a2341f04d430c078fdd /src/graphics/common/color.h
parenteca6d26459200d2956d64ccf8a2713d96a82c989 (diff)
downloadcolobot-54f4da87923465a5387e2e854b58616647deb7af.tar.gz
colobot-54f4da87923465a5387e2e854b58616647deb7af.tar.bz2
colobot-54f4da87923465a5387e2e854b58616647deb7af.zip
Fix in model loading; simple model viewer
- fixed model loading code - added simple model viewer (model_test) in src/graphics/opengl/test - added system time stamp code - split the code in app/system modules to separate headers - added debug messages in model loading - minor fixes in OpenGL engine
Diffstat (limited to 'src/graphics/common/color.h')
-rw-r--r--src/graphics/common/color.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/graphics/common/color.h b/src/graphics/common/color.h
index 3b19cf2..68421c7 100644
--- a/src/graphics/common/color.h
+++ b/src/graphics/common/color.h
@@ -19,6 +19,9 @@
#pragma once
+#include <sstream>
+
+
namespace Gfx {
/**
@@ -38,6 +41,15 @@ struct Color
{
return (float*)this;
}
+
+ //! Returns a string (r, g, b, a)
+ inline std::string ToString() const
+ {
+ std::stringstream s;
+ s.precision(3);
+ s << "(" << r << ", " << g << ", " << b << ", " << a << ")";
+ return s.str();
+ }
};
/**
@@ -49,6 +61,15 @@ struct ColorHSV
ColorHSV(float aH = 0.0f, float aS = 0.0f, float aV = 0.0f)
: h(aH), s(aS), v(aV) {}
+
+ //! Returns a string "(h, s, v)"
+ inline std::string ToString() const
+ {
+ std::stringstream s;
+ s.precision(3);
+ s << "(" << h << ", " << s << ", " << v << ")";
+ return s.str();
+ }
};
//! Converts a RGB color to HSV color