Changeset 5081 in orxonox.OLD for trunk/src/lib/graphics/render2D
- Timestamp:
- Aug 19, 2005, 12:49:21 PM (19 years ago)
- Location:
- trunk/src/lib/graphics/render2D
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/render2D/element_2d.cc
r5068 r5081 177 177 } 178 178 179 180 void Element2D::setRelCoor2D (const Vector& relCoord) 181 { 182 } 183 184 185 void Element2D::setRelCoor2D (float x, float y, float z) 186 { 187 } 188 189 void Element2D::setRelCoorSoft2D(const Vector& relCoordSoft, float bias) 190 { 191 } 192 193 void Element2D::setRelCoorSoft2D(float x, float y, float dontCare, float bias) 194 { 195 } 196 197 void Element2D::setAbsCoor2D (const Vector& absCoord) 198 { 199 } 200 201 void Element2D::setAbsCoor2D (float x, float y, float depth) 202 { 203 } 204 205 void Element2D::shiftCoor (const Vector& shift) 206 { 207 } 208 209 210 void Element2D::setRelDir2D (float relDir) 211 { 212 } 213 214 void Element2D::setRelDirSoft2D(float relDirSoft, float bias) 215 { 216 } 217 218 void Element2D::setAbsDir2D (float absDir) 219 { 220 } 221 222 void Element2D::shiftDir (float shiftDir) 223 { 224 } 225 226 227 void Element2D::addChild2D (Element2D* child, int parentingMod) 228 { 229 } 230 231 void Element2D::addChild2D (const char* childName) 232 { 233 } 234 235 void Element2D::removeChild2D (Element2D* child) 236 { 237 } 238 239 void Element2D::remove2D() 240 { 241 } 242 243 244 void Element2D::setParent2D (Element2D* parent) 245 { 246 } 247 248 void Element2D::setParent2D (const char* parentName) 249 { 250 } 251 252 253 void Element2D::softReparent(PNode* parentNode, float bias) 254 { 255 } 256 257 void Element2D::softReparent(const char* parentName, float bias) 258 { 259 } 260 261 262 void Element2D::setParentMode2D (const char* parentingMode) 263 { 264 } 265 266 267 void Element2D::update2D (float dt) 268 { 269 } 270 271 272 void Element2D::debug (unsigned int depth, unsigned int level) const 273 { 274 } 275 276 void Element2D::debugDraw2D(unsigned int depth, float size, Vector color) const 277 { 278 } 279 280 281 // helper functions // 282 const char* Element2D::parentingModeToChar(int parentingMode) 283 { 284 } 285 286 E2D_PARENT_MODE Element2D::charToParentingMode(const char* parentingMode) 287 { 288 } 289 290 291 292 293 294 179 295 /** 180 296 * ticks the 2d-Element -
trunk/src/lib/graphics/render2D/element_2d.h
r5068 r5081 1 1 /*! 2 2 * @file element_2d.h 3 * @brief Definition of the 2D elements rendered on top through the GraphicsEngine 3 * Definition of the 2D elements rendered on top through the GraphicsEngine 4 * @todo reimplement it, so it looks just like PNode. 4 5 */ 5 6 … … 8 9 9 10 #include "base_object.h" 11 #include "vector.h" 10 12 11 13 // FORWARD DECLARATION 12 14 class PNode; 13 15 class TiXmlElement; 16 template<class T> class tList; 14 17 15 18 //!< An enumerator defining the Depth of a 2D-element. … … 35 38 } E2D_ALIGNMENT; 36 39 40 typedef enum 41 { 42 E2D_LOCAL_ROTATE = 1, //!< Rotates all the children around their centers. 43 E2D_ROTATE_MOVEMENT = 2, //!< Moves all the children around the center of their parent, without the rotation around their own centers. 44 45 E2D_MOVEMENT = 4, //!< Moves all children along with the parent. 46 // special linkage modes 47 E2D_ALL = 3, //!< Moves all children around the center of their parent, and also rotates their centers 48 E2D_ROTATE_AND_MOVE = 5 //!< Rotates all children around their axis, and moves them as the Parent Moves, but does not rotate around the center of their parent. 49 } E2D_PARENT_MODE; 50 #define E2D_DEFAULT_PARENTING_MODE E2D_ALL 51 37 52 //! A Struct defining the Position of an Element in 2D-space 38 53 struct Position2D … … 82 97 inline bool isActive() { return this->active; }; 83 98 99 100 // LIKE PNODE 101 public: 102 void setRelCoor2D (const Vector& relCoord); 103 void setRelCoor2D (float x, float y, float dontCare); 104 void setRelCoorSoft2D(const Vector& relCoordSoft, float bias = 1.0); 105 void setRelCoorSoft2D(float x, float y, float dontCare, float bias = 1.0); 106 /** @returns the relative position */ 107 inline const Vector& getRelCoor2D () const { return this->prevRelCoordinate; }; 108 void setAbsCoor2D (const Vector& absCoord); 109 void setAbsCoor2D (float x, float y, float depth); 110 /** @returns the absolute position */ 111 inline const Vector& getAbsCoor2D () const { return this->absCoordinate; }; 112 void shiftCoor (const Vector& shift); 113 114 void setRelDir2D (float relDir); 115 void setRelDirSoft2D(float relDirSoft, float bias = 1.0); 116 /** @returns the relative Direction */ 117 inline float getRelDir2D () const { return this->prevRelDirection; }; 118 void setAbsDir2D (float absDir); 119 /** @returns the absolute Direction */ 120 inline float getAbsDir2D () const { return this->absDirection; }; 121 void shiftDir (float shiftDir); 122 123 /** @returns the Speed of the Node */ 124 inline float getSpeed() const { return 0; }; 125 /** @returns the Velocity of the Node */ 126 inline const Vector& getVelocity() const { return this->velocity; }; 127 128 129 void addChild2D (Element2D* child, int parentingMode = E2D_DEFAULT_PARENTING_MODE); 130 void addChild2D (const char* childName); 131 void removeChild2D (Element2D* child); 132 void remove2D(); 133 134 void setParent2D (Element2D* parent); 135 void setParent2D (const char* parentName); 136 /** @returns the parent of this Element2D */ 137 Element2D* getParent () const { return this->parent; }; 138 139 void softReparent(PNode* parentNode, float bias = 1.0); 140 void softReparent(const char* parentName, float bias = 1.0); 141 142 /** @param parentMode sets the parentingMode of this Node */ 143 void setParentMode2D (E2D_PARENT_MODE parentMode) { this->parentMode = parentMode; }; 144 void setParentMode2D (const char* parentingMode); 145 /** @returns the Parenting mode of this node */ 146 int getParentMode2D() const { return this->parentMode; }; 147 148 void update2D (float dt); 149 150 void debug (unsigned int depth = 1, unsigned int level = 0) const; 151 void debugDraw2D(unsigned int depth = 1, float size = 1.0, Vector color = Vector(1,1,1)) const; 152 153 // helper functions // 154 static const char* parentingModeToChar(int parentingMode); 155 static E2D_PARENT_MODE charToParentingMode(const char* parentingMode); 156 157 private: 158 void init(Element2D* parent); 159 /** tells the child that the parent's Coordinate has changed */ 160 inline void parentCoorChanged () { this->bRelCoorChanged = true; } 161 /** tells the child that the parent's Direction has changed */ 162 inline void parentDirChanged () { this->bRelDirChanged = true; } 163 /** @returns the last calculated coordinate */ 164 inline Vector getLastAbsCoor() { return this->lastAbsCoordinate; } 165 166 public: 84 167 virtual void tick(float dt); 85 168 virtual void draw() const = NULL; … … 99 182 bool active; //!< If the given Element2D is active. 100 183 E2D_LAYER layer; //!< What layer this Element2D is on. 184 185 186 187 188 189 private: 190 bool bRelCoorChanged; //!< If Relative Coordinate has changed since last time we checked 191 bool bRelDirChanged; //!< If Relative Direction has changed since last time we checked 192 193 Vector relCoordinate; //!< coordinates relative to the parent 194 Vector absCoordinate; //!< absolute coordinates in the world ( from (0,0,0) ) 195 float relDirection; //!< direction relative to the parent 196 float absDirection; //!< absolute direvtion in the world ( from (0,0,1) ) 197 198 Vector prevRelCoordinate; //!< The last Relative Coordinate from the last update-Cycle. 199 Vector lastAbsCoordinate; //!< this is used for speedcalculation, it stores the last coordinate 200 float prevRelDirection; //!< The last Relative Direciton from the last update-Cycle. 201 // Quaternion lastAbsDirection; 202 203 Vector velocity; //!< Saves the velocity. 204 205 Vector* toCoordinate; //!< a position to which to iterate. (This is used in conjunction with softReparent.and set*CoorSoft) 206 float* toDirection; //!< a direction to which to iterate. (This is used in conjunction with softReparent and set*DirSoft) 207 float bias; //!< how fast to iterate to the given position (default is 1) 208 209 Element2D* parent; //!< a pointer to the parent node 210 tList<Element2D>* children; //!< list of the children of this Element2D 211 212 unsigned int parentMode; //!< the mode of the binding 101 213 }; 102 214
Note: See TracChangeset
for help on using the changeset viewer.