Changeset 9691 in orxonox.OLD for branches/new_class_id/src/lib/coord
- Timestamp:
- Aug 22, 2006, 11:45:21 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/coord
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/coord/p_node.cc
r9684 r9691 729 729 if (likely(PNode::nullParent == NULL)) 730 730 { 731 PNode::nullParent = new PNode(NULL, PNODE_PARENT_MODE_DEFAULT | PNODE_REPARENT_TO_NULL);731 PNode::nullParent = new NullParent(); 732 732 //PNode::nullParent->registerObject(, CL_NULL_PARENT); 733 733 PNode::nullParent->setName("NullParent"); … … 1105 1105 } 1106 1106 1107 1107 NewObjectListDefinition(NullParent); 1108 1109 NullParent::NullParent() 1110 : PNode(NULL, PNODE_PARENT_MODE_DEFAULT | PNODE_REPARENT_TO_NULL) 1111 { 1112 this->registerObject(this, NullParent::_objectList); 1113 } -
branches/new_class_id/src/lib/coord/p_node.h
r9684 r9691 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 { 75 class PNode : virtual public BaseObject, virtual public Synchronizeable 76 { 76 77 NewObjectListDeclaration(PNode); 77 78 78 79 public: 79 80 PNode (PNode* parent = PNode::getNullParent(), long nodeFlags = PNODE_PARENT_MODE_DEFAULT); 80 81 virtual ~PNode (); … … 97 98 inline const Vector& getRelCoor () const { return this->prevRelCoordinate; }; 98 99 /** @returns the Relative Coordinate Destination */ 99 100 inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)? *this->toCoordinate : this->relCoordinate; }; 100 101 void setAbsCoor (const Vector& absCoord); 101 102 void setAbsCoor (float x, float y, float z); … … 132 133 inline const Quaternion& getRelDir () const { return this->prevRelDirection; }; 133 134 /** @returns the Relative Directional Destination */ 134 135 inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)? *this->toDirection : this->relDirection; }; 135 136 /** @returns a Vector pointing into the relative Direction */ 136 137 inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); }; … … 180 181 void removeNodeFlags(unsigned short nodeFlags); 181 182 182 // NULL_PARENT //183 183 /** @returns the NullParent, the (main) ROOT of the PNode Tree. If it does not yet exist, it will be created. */ 184 static PNode* getNullParent() { return (PNode::nullParent != NULL)? PNode::nullParent : PNode::createNullParent(); };184 static PNode* getNullParent() { return (PNode::nullParent != NULL) ? PNode::nullParent : PNode::createNullParent(); }; 185 185 186 186 // UPDATING // … … 197 197 float distance(const PNode* node) const { return (this->getAbsCoor() - node->getAbsCoor()).len(); }; 198 198 199 199 private: 200 200 /** tells the child that the parent's Coordinate has changed */ 201 201 inline void parentCoorChanged () { this->bRelCoorChanged = true; } 202 202 /** tells the child that the parent's Direction has changed */ 203 203 inline void parentDirChanged () { this->bRelDirChanged = true; } 204 204 public: 205 205 /** @returns the last calculated coordinate */ 206 206 inline Vector getLastAbsCoor() { return this->lastAbsCoordinate; } 207 207 private: 208 208 static PNode* createNullParent(); 209 209 void reparent(); … … 211 211 void eraseChild(PNode* child); 212 212 213 213 private: 214 214 bool bRelCoorChanged; //!< If Relative Coordinate has changed since last time we checked 215 215 bool bRelDirChanged; //!< If Relative Direction has changed since last time we checked … … 223 223 Vector lastAbsCoordinate; //!< this is used for speedcalculation, it stores the last coordinate 224 224 Quaternion prevRelDirection; //!< The last Relative Direciton from the last update-Cycle. 225 // Quaternion lastAbsDirection;225 // Quaternion lastAbsDirection; 226 226 227 227 Vector velocity; //!< Saves the velocity. … … 240 240 static PNode* nullParent; //!< The ROOT of the main PNode Tree. 241 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 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 ); 260 260 }; 261 261 262 // NULL_PARENT // 263 class NullParent : public PNode 264 { 265 NewObjectListDeclaration(NullParent); 266 friend class PNode; 267 NullParent(); 268 }; 269 270 262 271 #endif /* _P_NODE_H */
Note: See TracChangeset
for help on using the changeset viewer.