Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/p_node.h @ 3465

Last change on this file since 3465 was 3450, checked in by bensch, 20 years ago

orxonox/trunk: doxygen-tags: player.cc/h p_node.cc/h base_entity.h skysphere.cc/h

File size: 3.3 KB
RevLine 
[3246]1/*!
2    \file p_node.h
3    \brief Definition of a parenting node
4
5    parenting is how coordinates are handled in orxonox, meaning, that all coordinates
6    are representet relative to another parent node. this nodes build a parenting
7    tree of one-sided references (from up to down referenced).
8    Every node manages itself a list of childrens (of whos it is parent - easy...)
9
10    absCoordinate, absDirection have to be recalculated as soon as there was a change in
11    place or ortientation. this is only the case if
12    o bDirChanged is true (so changed) AND timeStamp != now
13    o bCoorChanged is true (so moved) AND timeStamp != now
14    this conditions make it cheaper to recalculate the tree (reduces redundant work).
15
[3365]16    remember: if you have to change the coordinates or the directions, use the functions
17    that are defined to execute this operation - otherwhise there will be big problems...
[3246]18*/
19
20
21#ifndef _P_NODE_H
22#define _P_NODE_H
23
24#include "stdincl.h"
25
[3365]26class PNode; /* forward decleration, so that parentEntry has access to PNode */
[3246]27
[3450]28//! enumeration for the different translation-binding-types
[3365]29typedef enum parentingMode {MOVEMENT = 0, ROTATION, ALL};
[3450]30//! The default mode of the translation-binding.
[3365]31#define DEFAULT_MODE ALL
[3246]32
[3450]33//! Patent Node is a Engine to calculate the position of an Object in respect to the position of its parent.
[3365]34class PNode : public BaseObject {
35
[3246]36 public:
37  PNode ();
[3365]38  PNode (Vector* absCoordinate, PNode* pNode);
39  virtual ~PNode ();
[3246]40
[3365]41  void destroy ();
42
[3450]43  PNode* parent;            //!< a pointer to the parent node
44  tList<PNode>* children;   //!< list of the children
[3365]45
[3450]46  parentingMode mode;       //!< the mode of the binding
[3365]47
[3246]48  Vector getRelCoor ();
[3365]49  void setRelCoor (Vector* relCoord);
50  //void setRelCoor (Vector relCoord);
[3246]51  Vector getAbsCoor ();
[3365]52  void setAbsCoor (Vector* absCoord);
53  //void setAbsCoor (Vector absCoord);
54  void shiftCoor (Vector* shift);
55  //void shiftCoor (Vector shift);
[3246]56
57  Quaternion getRelDir ();
[3365]58  void setRelDir (Quaternion* relDir);
[3246]59  Quaternion getAbsDir ();
[3365]60  void setAbsDir (Quaternion* absDir);
61  void shiftDir (Quaternion* shift);
[3246]62
63  void addChild (PNode* pNode);
[3365]64  void addChild (PNode* pNode, parentingMode mode);
[3246]65  void removeChild (PNode* pNode);
[3365]66  void setParent (PNode* parent);
67  void parentCoorChanged ();
68  void parentDirChanged ();
69  void setMode (parentingMode mode);
[3246]70
[3365]71  virtual void update (float timeStamp);
72  void processTick (float dt);
73  virtual void tick (float dt);
[3246]74
[3365]75  void setName (char* newName);
76  char* getName ();
77
78
79  void debug ();
80
[3450]81  float timeStamp;         //!< this the timeStamp of when the abs{Coordinat, Direction} has been calculated
82  char* objectName;        //!< The name of the Object
83  bool bAbsCoorChanged;    //!< If Absolute Coordinate has changed since last time we checked
84  bool bRelCoorChanged;    //!< If Relative Coordinate has changed since last time we checked
85  bool bAbsDirChanged;     //!< If Absolute Direction has changed since last time we checked
86  bool bRelDirChanged;     //!< If Relative Direction has changed since last time we checked
[3365]87
[3450]88  Vector relCoordinate;    //!< coordinates relative to the parent
89  Vector absCoordinate;    //!< absolute coordinates in the world ( from (0,0,0) )
90  Quaternion relDirection; //!< direction relative to the parent
91  Quaternion absDirection; //!< absolute direvtion in the world ( from (0,0,1) )
[3246]92
93};
94
95#endif /* _P_NODE_H */
Note: See TracBrowser for help on using the repository browser.