Changeset 9869 in orxonox.OLD for trunk/src/lib/coord/p_node.h
- Timestamp:
- Oct 3, 2006, 12:19:30 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/coord/p_node.h
r9406 r9869 50 50 PNODE_REPARENT_DELETE_CHILDREN = 0x0040, //!< Deletes the Children of the node when This Node is Removed. (Use with care). 51 51 /// FIXME 52 52 PNODE_REPARENT_KEEP_POSITION = 0x0080, //!< Tries to keep the Position if the Node is reparented. 53 53 54 54 … … 73 73 74 74 //! Patent Node is a Engine to calculate the position of an Object in respect to the position of its parent. 75 class PNode : virtual public BaseObject, virtual public Synchronizeable { 76 public: 75 class PNode : virtual public BaseObject, virtual public Synchronizeable 76 { 77 ObjectListDeclaration(PNode); 78 79 public: 77 80 PNode (PNode* parent = PNode::getNullParent(), long nodeFlags = PNODE_PARENT_MODE_DEFAULT); 78 81 virtual ~PNode (); … … 95 98 inline const Vector& getRelCoor () const { return this->prevRelCoordinate; }; 96 99 /** @returns the Relative Coordinate Destination */ 97 100 inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)? *this->toCoordinate : this->relCoordinate; }; 98 101 void setAbsCoor (const Vector& absCoord); 99 102 void setAbsCoor (float x, float y, float z); … … 130 133 inline const Quaternion& getRelDir () const { return this->prevRelDirection; }; 131 134 /** @returns the Relative Directional Destination */ 132 135 inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)? *this->toDirection : this->relDirection; }; 133 136 /** @returns a Vector pointing into the relative Direction */ 134 137 inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); }; … … 178 181 void removeNodeFlags(unsigned short nodeFlags); 179 182 180 // NULL_PARENT //181 183 /** @returns the NullParent, the (main) ROOT of the PNode Tree. If it does not yet exist, it will be created. */ 182 static PNode* getNullParent() { return (PNode::nullParent != NULL)? PNode::nullParent : PNode::createNullParent(); };184 static PNode* getNullParent() { return (PNode::nullParent != NULL) ? PNode::nullParent : PNode::createNullParent(); }; 183 185 184 186 // UPDATING // … … 195 197 float distance(const PNode* node) const { return (this->getAbsCoor() - node->getAbsCoor()).len(); }; 196 198 197 199 private: 198 200 /** tells the child that the parent's Coordinate has changed */ 199 201 inline void parentCoorChanged () { this->bRelCoorChanged = true; } 200 202 /** tells the child that the parent's Direction has changed */ 201 203 inline void parentDirChanged () { this->bRelDirChanged = true; } 202 204 public: 203 205 /** @returns the last calculated coordinate */ 204 206 inline Vector getLastAbsCoor() { return this->lastAbsCoordinate; } 205 207 private: 206 208 static PNode* createNullParent(); 207 209 void reparent(); … … 209 211 void eraseChild(PNode* child); 210 212 211 213 private: 212 214 bool bRelCoorChanged; //!< If Relative Coordinate has changed since last time we checked 213 215 bool bRelDirChanged; //!< If Relative Direction has changed since last time we checked … … 221 223 Vector lastAbsCoordinate; //!< this is used for speedcalculation, it stores the last coordinate 222 224 Quaternion prevRelDirection; //!< The last Relative Direciton from the last update-Cycle. 223 // Quaternion lastAbsDirection;225 // Quaternion lastAbsDirection; 224 226 225 227 Vector velocity; //!< Saves the velocity. … … 238 240 static PNode* nullParent; //!< The ROOT of the main PNode Tree. 239 241 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 242 private: 243 float coorx; 244 float coory; 245 float coorz; 246 247 float rotw; 248 float rotx; 249 float roty; 250 float rotz; 251 252 private: 253 int relCoordinate_handle; 254 int relDirection_handle; 255 Vector relCoordinate_write; 256 Quaternion relDirection_write; 257 258 public: 259 virtual void varChangeHandler( std::list<int> & id ); 258 260 }; 259 261 262 // NULL_PARENT // 263 class NullParent : public PNode 264 { 265 ObjectListDeclaration(NullParent); 266 friend class PNode; 267 NullParent(); 268 }; 269 270 260 271 #endif /* _P_NODE_H */
Note: See TracChangeset
for help on using the changeset viewer.