summaryrefslogtreecommitdiffstats
path: root/src/graphics/common/color.h
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-07-01 22:59:22 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-07-01 22:59:22 +0200
commitd9c5a439d09211ec210195709d275596c6c3c9ba (patch)
treeb536721f8ac5f42649345eeb836259bbf6a887e3 /src/graphics/common/color.h
parent9bd4ec03b272e7925b11c3efc2bd8460894ea589 (diff)
downloadcolobot-d9c5a439d09211ec210195709d275596c6c3c9ba.tar.gz
colobot-d9c5a439d09211ec210195709d275596c6c3c9ba.tar.bz2
colobot-d9c5a439d09211ec210195709d275596c6c3c9ba.zip
CGLDevice implementation
- extended Gfx::CDevice interface - written OpenGL implementation in Gfx::CGLDevice - rewrote color and light module - added Gfx::VertexCol - added array casts to Math::Vector, Math::Matrix and Gfx::Color
Diffstat (limited to 'src/graphics/common/color.h')
-rw-r--r--src/graphics/common/color.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/graphics/common/color.h b/src/graphics/common/color.h
index 12f008f..3b19cf2 100644
--- a/src/graphics/common/color.h
+++ b/src/graphics/common/color.h
@@ -21,15 +21,28 @@
namespace Gfx {
+/**
+ \struct Color
+ \brief RGBA color */
struct Color
{
+ //! Red, green, blue and alpha components
float r, g, b, a;
+ //! Constructor; default values are (0,0,0,0) = black
Color(float aR = 0.0f, float aG = 0.0f, float aB = 0.0f, float aA = 0.0f)
: r(aR), g(aG), b(aB), a(aA) {}
-};
+ //! Returns the struct cast to \c float* array; use with care!
+ inline float* Array()
+ {
+ return (float*)this;
+ }
+};
+/**
+ \struct ColorHSV
+ \brief HSV color */
struct ColorHSV
{
float h, s, v;
@@ -38,13 +51,11 @@ struct ColorHSV
: h(aH), s(aS), v(aV) {}
};
+//! Converts a RGB color to HSV color
+Gfx::ColorHSV RGB2HSV(Gfx::Color color);
-long RetColor(float intensity);
-long RetColor(Color intensity);
-Color RetColor(long intensity);
-
-void RGB2HSV(Color src, ColorHSV &dest);
-void HSV2RGB(ColorHSV src, Color &dest);
+//! Converts a HSV color to RGB color
+Gfx::Color HSV2RGB(Gfx::ColorHSV color);
}; // namespace Gfx