From 54f4da87923465a5387e2e854b58616647deb7af Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sun, 15 Jul 2012 19:17:49 +0200 Subject: 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 --- src/graphics/common/color.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/graphics/common/color.h') 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 + + 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 -- cgit v1.2.3-1-g7c22