Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9691 in orxonox.OLD for branches/new_class_id/src/lib/coord


Ignore:
Timestamp:
Aug 22, 2006, 11:45:21 PM (18 years ago)
Author:
bensch
Message:

new_class_id: adapted Network

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  
    729729  if (likely(PNode::nullParent == NULL))
    730730  {
    731     PNode::nullParent = new PNode(NULL, PNODE_PARENT_MODE_DEFAULT | PNODE_REPARENT_TO_NULL);
     731    PNode::nullParent = new NullParent();
    732732    //PNode::nullParent->registerObject(, CL_NULL_PARENT);
    733733    PNode::nullParent->setName("NullParent");
     
    11051105}
    11061106
    1107 
     1107NewObjectListDefinition(NullParent);
     1108
     1109NullParent::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  
    5050  PNODE_REPARENT_DELETE_CHILDREN       = 0x0040,    //!< Deletes the Children of the node when This Node is Removed. (Use with care).
    5151  /// FIXME
    52    PNODE_REPARENT_KEEP_POSITION         = 0x0080,    //!< Tries to keep the Position if the Node is reparented.
     52  PNODE_REPARENT_KEEP_POSITION         = 0x0080,    //!< Tries to keep the Position if the Node is reparented.
    5353
    5454
     
    7373
    7474//! 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 {
     75class PNode : virtual public BaseObject, virtual public Synchronizeable
     76{
    7677  NewObjectListDeclaration(PNode);
    7778
    78   public:
     79public:
    7980  PNode (PNode* parent = PNode::getNullParent(), long nodeFlags = PNODE_PARENT_MODE_DEFAULT);
    8081  virtual ~PNode ();
     
    9798  inline const Vector& getRelCoor () const { return this->prevRelCoordinate; };
    9899  /** @returns the Relative Coordinate Destination */
    99   inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)? *this->toCoordinate : this->relCoordinate; };
     100inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)? *this->toCoordinate : this->relCoordinate; };
    100101  void setAbsCoor (const Vector& absCoord);
    101102  void setAbsCoor (float x, float y, float z);
     
    132133  inline const Quaternion& getRelDir () const { return this->prevRelDirection; };
    133134  /** @returns the Relative Directional Destination */
    134   inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)? *this->toDirection : this->relDirection; };
     135inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)? *this->toDirection : this->relDirection; };
    135136  /** @returns a Vector pointing into the relative Direction */
    136137  inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); };
     
    180181  void removeNodeFlags(unsigned short nodeFlags);
    181182
    182   // NULL_PARENT //
    183183  /** @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(); };
     184static PNode* getNullParent()  { return (PNode::nullParent != NULL) ? PNode::nullParent : PNode::createNullParent(); };
    185185
    186186  // UPDATING //
     
    197197  float distance(const PNode* node) const { return (this->getAbsCoor() - node->getAbsCoor()).len(); };
    198198
    199  private:
     199private:
    200200  /** tells the child that the parent's Coordinate has changed */
    201201  inline void parentCoorChanged () { this->bRelCoorChanged = true; }
    202202  /** tells the child that the parent's Direction has changed */
    203203  inline void parentDirChanged () { this->bRelDirChanged = true; }
    204  public:
     204public:
    205205  /** @returns the last calculated coordinate */
    206206  inline Vector getLastAbsCoor() { return this->lastAbsCoordinate; }
    207  private:
     207private:
    208208  static PNode* createNullParent();
    209209  void reparent();
     
    211211  void eraseChild(PNode* child);
    212212
    213  private:
     213private:
    214214  bool               bRelCoorChanged;    //!< If Relative Coordinate has changed since last time we checked
    215215  bool               bRelDirChanged;     //!< If Relative Direction has changed since last time we checked
     
    223223  Vector             lastAbsCoordinate;  //!< this is used for speedcalculation, it stores the last coordinate
    224224  Quaternion         prevRelDirection;   //!< The last Relative Direciton from the last update-Cycle.
    225 //  Quaternion         lastAbsDirection;
     225  //  Quaternion         lastAbsDirection;
    226226
    227227  Vector             velocity;           //!< Saves the velocity.
     
    240240  static PNode*      nullParent;         //!< The ROOT of the main PNode Tree.
    241241
    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 );
     242private:
     243  float coorx;
     244  float coory;
     245  float coorz;
     246
     247  float rotw;
     248  float rotx;
     249  float roty;
     250  float rotz;
     251
     252private:
     253  int relCoordinate_handle;
     254  int relDirection_handle;
     255  Vector relCoordinate_write;
     256  Quaternion relDirection_write;
     257
     258public:
     259  virtual void varChangeHandler( std::list<int> & id );
    260260};
    261261
     262// NULL_PARENT //
     263class NullParent : public PNode
     264{
     265  NewObjectListDeclaration(NullParent);
     266  friend class PNode;
     267  NullParent();
     268};
     269
     270
    262271#endif /* _P_NODE_H */
Note: See TracChangeset for help on using the changeset viewer.