Changeset 8376 in orxonox.OLD for trunk/src/lib/util
- Timestamp:
- Jun 14, 2006, 12:13:16 PM (19 years ago)
- Location:
- trunk/src/lib/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/color.cc
r7919 r8376 18 18 #include "color.h" 19 19 #include <stdio.h> 20 21 using namespace std;22 23 20 24 21 /** -
trunk/src/lib/util/color.h
r8145 r8376 16 16 { 17 17 public: 18 Color(float r , float g, float b, float a) :_r(r), _g(g), _b(b), _a(a) {};19 Color(const Color& c) { _r = c._r; _g = c._g; _b = c._b; _a = c._a; };18 Color(float r = 0.0f, float g = 0.0f, float b = 0.0f, float a = 0.0f) { _rgba[0] = r; _rgba[1] = g; _rgba[2] = b; _rgba[3] = a; }; 19 Color(const Color& c) { _rgba[0] = c.r(); _rgba[1] = c.g(); _rgba[2] = c.b(); _rgba[3] = c.a(); } 20 20 21 float r() const { return _r; } 22 float& r() { return _r; } 23 float g() const { return _g; } 24 float& g() { return _g; } 25 float b() const { return _b; } 26 float& b() { return _b; } 27 float a() const { return _a; } 28 float& a() { return _a; } 21 float& operator[](unsigned int i) { return _rgba[i]; } 22 const float& operator[](unsigned int i) const { return _rgba[i]; } 29 23 24 float r() const { return _rgba[0]; } 25 float& r() { return _rgba[0]; } 26 float g() const { return _rgba[1]; } 27 float& g() { return _rgba[1]; } 28 float b() const { return _rgba[2]; } 29 float& b() { return _rgba[2]; } 30 float a() const { return _rgba[3]; } 31 float& a() { return _rgba[3]; } 32 33 34 /// STATIC TRANSFORMATIONS 30 35 public: 31 36 static Vector RGBtoHSV (const Vector& RGB); … … 38 43 static float maxrgb(float r, float g, float b); 39 44 40 float _r; //!< Red Value. 45 private: 46 float _rgba[4]; //!< Color Values 47 48 /* float _r; //!< Red Value. 41 49 float _g; //!< Green Value. 42 50 float _b; //!< Blue Value. 43 float _a; //!< Alpha Value. 44 51 float _a; //!< Alpha Value.*/ 45 52 }; 46 53
Note: See TracChangeset
for help on using the changeset viewer.