Changeset 9755 in orxonox.OLD for branches/new_class_id/src/lib
- Timestamp:
- Sep 17, 2006, 11:33:22 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/coord/p_node.cc
r9715 r9755 78 78 PNode::~PNode () 79 79 { 80 PRINTF(4)("delete %s::%s\n", this->getClassCName(), this->getCName()); 80 PRINTF(0)("delete %s::%s\n", this->getClassCName(), this->getCName()); 81 this->debugNode(0); 81 82 // remove the Node, delete it's children (if required). 82 std::list<PNode*>::iterator deleteNode;83 unsigned int size;84 83 while(!this->children.empty()) 85 84 { 86 deleteNode = this->children.begin(); 87 size = this->children.size(); 85 PNode* deleteNode = this->children.front(); 88 86 if ((this->parentMode & PNODE_PROHIBIT_CHILD_DELETE) || 89 ( (*deleteNode)->parentMode & PNODE_PROHIBIT_DELETE_WITH_PARENT))87 (deleteNode->parentMode & PNODE_PROHIBIT_DELETE_WITH_PARENT)) 90 88 { 91 if (this == PNode::nullParent && (*deleteNode)->parentMode & PNODE_REPARENT_TO_NULL)89 if (this == PNode::nullParent && deleteNode->parentMode & PNODE_REPARENT_TO_NULL) 92 90 { 93 91 PRINTF(4)("%s::%s deletes %s::%s\n", 94 92 this->getClassCName(), this->getCName(), 95 (*deleteNode)->getClassCName(), (*deleteNode)->getCName());96 delete (*deleteNode);93 deleteNode->getClassCName(), deleteNode->getCName()); 94 delete deleteNode; 97 95 } 98 96 else … … 100 98 PRINTF(4)("%s::%s reparents %s::%s\n", 101 99 this->getClassCName(), this->getCName(), 102 (*deleteNode)->getClassCName(), (*deleteNode)->getCName());103 (*deleteNode)->reparent();100 deleteNode->getClassCName(), deleteNode->getCName()); 101 deleteNode->reparent(); 104 102 } 105 103 } … … 108 106 PRINTF(4)("%s::%s deletes PNode: %s::%s\n", 109 107 this->getClassCName(), this->getCName(), 110 (*deleteNode)->getClassCName(), (*deleteNode)->getCName());111 delete (*deleteNode);108 deleteNode->getClassCName(), deleteNode->getCName()); 109 delete deleteNode; 112 110 } 113 111 } -
branches/new_class_id/src/lib/util/color.cc
r8986 r9755 30 30 //! Black Color 31 31 const Color Color::black(0,0,0,1); 32 //! Orx Color 33 const Color Color::orx(.2, .5, .7, .8); //!< TODO Define the ORX-color :) 34 35 32 33 /** 34 * @brief slerps the Color in the HSV color space into the direction of c 35 * @param c the Color to slerp to 36 * @param v the Value to slerp 0 means stay at *this, 1 means at c. 37 */ 36 38 void Color::slerpHSV(const Color& c, float v) 37 39 { … … 52 54 } 53 55 56 /** 57 * @brief simple slerp wrapper. 58 * @param from from this color 59 * @param to to this one 60 * @param v how much 61 * @see void Color::slerpHSV(const Color& c, float v) 62 */ 54 63 Color Color::slerpHSVColor(const Color& from, const Color& to, float v) 55 64 { … … 59 68 } 60 69 61 70 /** 71 * @brief nice and simple debug output for the colors (colorless :) ) 72 */ 62 73 void Color::debug() const 63 74 { … … 214 225 215 226 216 // Needed by rgb2hsv() 227 /** 228 * @returns the maximum of r g and a. 229 * @param r Red. 230 * @param g Green 231 * @param b Blue 232 */ 217 233 float Color::maxrgb(float r, float g, float b) 218 234 { … … 227 243 } 228 244 229 230 // Needed by rgb2hsv() 245 /** 246 * @returns the minimum of r g and a. 247 * @param r Red. 248 * @param g Green 249 * @param b Blue 250 */ 231 251 float Color::minrgb(float r,float g,float b) 232 252 { -
branches/new_class_id/src/lib/util/color.h
r9656 r9755 14 14 #include "vector.h" 15 15 16 //! a very abstract Class that helps transforming Colors into different Systems 16 //! A Class that handles Colors. 17 /** 18 * A Color is a collection of 4 values: 19 * <ul> 20 * <li>Red</li> 21 * <li>Green</li> 22 * <li>Blue</li> 23 * <li>Alpha</li> 24 * </ul> 25 * With these four values any color of the entire spectrum can be defined. 26 * 27 * By default a Color lies between 0 and 1 for each component. 28 * for example [1,0,0,.5] means red and half visible. 29 */ 17 30 class Color 18 31 { 19 32 public: 33 /** @param r red, @param g green @param b blue @param a alpha @brief constructs a Color. */ 20 34 Color(float r = 0.0f, float g = 0.0f, float b = 0.0f, float a = 1.0f) { _rgba[0] = r; _rgba[1] = g; _rgba[2] = b; _rgba[3] = a; }; 35 /** @param c Color @brief copy constructor */ 21 36 Color(const Color& c) { _rgba[0] = c.r(); _rgba[1] = c.g(); _rgba[2] = c.b(); _rgba[3] = c.a(); } 22 37 38 /** @param c the Color to set to this color @returns the copied color */ 23 39 inline const Color& operator=(const Color& c) { _rgba[0] = c.r(); _rgba[1] = c.g(); _rgba[2] = c.b(); _rgba[3] = c.a(); return *this; }; 40 /** @param c the color to compare @returns true on match. @brief compares two colors */ 24 41 inline bool operator==(const Color& c) const { return (r() == c.r() && g() == c.g() && b() == c.b() && a() == c.a()); }; 25 42 43 /** @returns the i'th Value of the Color @param i part of the color 0:r, 1:g, 2:b, 3:a */ 26 44 inline float& operator[](unsigned int i) { return _rgba[i]; } 45 /** @returns a Constant Value of the color. @param i part of the color 0:r, 1:g, 2:b, 3:a */ 27 46 inline const float& operator[](unsigned int i) const { return _rgba[i]; } 28 47 48 /** @returns the red part. */ 29 49 inline float r() const { return _rgba[0]; } 50 /** @returns the reference to the red part */ 30 51 inline float& r() { return _rgba[0]; } 52 /** @returns the green part. */ 31 53 inline float g() const { return _rgba[1]; } 54 /** @returns the reference to the green part */ 32 55 inline float& g() { return _rgba[1]; } 56 /** @returns the blue part */ 33 57 inline float b() const { return _rgba[2]; } 58 /** @returns the reference to the blue part */ 34 59 inline float& b() { return _rgba[2]; } 60 /** @returns the alpha part */ 35 61 inline float a() const { return _rgba[3]; } 62 /** @returns the reference to the alpha part */ 36 63 inline float& a() { return _rgba[3]; } 37 64 38 65 39 40 66 /** @param r red, @param g green @param b blue @param a alpha @brief sets the color. */ 41 67 void setColor(float r = 0.0f, float g = 0.0f, float b = 0.0f, float a = 1.0f) { _rgba[0] = r; _rgba[1] = g; _rgba[2] = b; _rgba[3] = a; }; 68 /** @param c the color to set. @brief sets the color. */ 42 69 void setColor(const Color& c) { r() = c.r(); g()= c.g(); b() = c.b(); a() = c.a(); }; 43 70 71 /** @returns the distance to the color @param c the color to calculate the distance to. */ 44 72 inline float dist(const Color& c) const { return (sqrt((r()-c.r())*(r()-c.r()) + (g()-c.g())*(g()-c.g()) + (b()-c.b())*(b()-c.b()) + (a()-c.a())*(a()-c.a()))); } 45 73 /// Maths 74 /** @param c the color to add to this one @returns the two added colors */ 46 75 inline const Color& operator+=(const Color& c) { r()+=c.r(); g()+=c.g(); b()+=c.b(); a()+=c.a(); return *this; }; 76 /** @returns the result of the added colors @param c the color to add */ 47 77 inline Color operator+(const Color& c) const { return Color(r()+c.r(), g()+c.g(), b()+c.b(), a()+c.a()); }; 78 /** @param c the color to substract to this one @returns the two substracted colors */ 48 79 inline const Color& operator-=(const Color& c) { r()-=c.r(); g()-=c.g(); b()-=c.b(); a()-=c.a(); return *this; }; 80 /** @returns the result of the substracted colors @param c the color to substract */ 49 81 inline Color operator-(const Color& c) const { return Color(r()-c.r(), g()-c.g(), b()-c.b(), a()-c.a()); }; 82 /** @param v the multiplier @returns the Color multiplied by v */ 50 83 inline const Color& operator*=(float v) { r()*=v, g()*=v, b()*=v, a()*=v; return *this; }; 84 /** @param v the multiplier @returns a multiplied color */ 51 85 inline Color operator*(float v) const { return Color(r()*v, g()*v, b()*v, a()*v); }; 52 86 87 /** @param c the color to slerp to @param v how much to slerp [0:1] @brief moves the color into the direction of another color */ 53 88 void slerp(const Color& c, float v) { *this += (c - *this) * v; }; 54 89 void slerpHSV(const Color& c, float v); 55 56 90 static Color slerpHSVColor(const Color& from, const Color& to, float v); 57 91 … … 75 109 static const Color white; 76 110 static const Color black; 77 static const Color orx;78 111 79 112 private: 80 float _rgba[4]; //!< Color Values 81 82 /* float _r; //!< Red Value. 83 float _g; //!< Green Value. 84 float _b; //!< Blue Value. 85 float _a; //!< Alpha Value.*/ 113 float _rgba[4]; //!< Color Values [r,g,b,a] (red green blue alpha) 86 114 }; 87 115
Note: See TracChangeset
for help on using the changeset viewer.