Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3248 in orxonox.OLD for orxonox/branches/parenting


Ignore:
Timestamp:
Dec 22, 2004, 3:28:14 PM (20 years ago)
Author:
patrick
Message:

orxonox/branches/parenting: defined all function/variables now will have to implement them

Location:
orxonox/branches/parenting/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/parenting/src/list.h

    r3224 r3248  
    7878 
    7979
    80   void add(WorldEntity* entity);
    81   void remove(WorldEntity* entity);
     80  void add(T* entity);
     81  void remove(T* entity);
    8282  void destroy();
    8383  T* firstElement();
     
    104104
    105105template<class T>
    106 void tList<T>::add(WorldEntity* entity)
     106void tList<T>::add(T* entity)
    107107{
    108108  listElement* el = new listElement;
     
    120120
    121121template<class T>
    122 void tList<T>::remove(WorldEntity* entity)
     122void tList<T>::remove(T* entity)
    123123{
    124124  this->currentEl = this->first;
  • orxonox/branches/parenting/src/p_node.cc

    r3247 r3248  
    2828   \todo this constructor is not jet implemented - do it
    2929*/
    30 PNode::PNode () {}
     30PNode::PNode ()
     31{
     32  this->children = new tList<PNode>();
     33}
    3134
    3235
     
    3639   \todo this deconstructor is not jet implemented - do it
    3740*/
    38 PNode::~PNode () {}
     41PNode::~PNode ()
     42{
     43  this->children->destroy();
     44  delete this->children;
     45}
    3946
    4047
     
    4451*/
    4552Vector PNode::getRelCoor ()
    46 {}
     53{
     54  Vector r = this->relCoordinate; /* return a copy, so it can't be modified */
     55  return r;
     56}
    4757
    4858
     
    8090
    8191/**
     92   \brief shift coordinate (abs and rel)
     93   \param shift vector
     94
     95   this function shifts the current coordinates about the vector shift. this is
     96   usefull because from some place else you can:
     97   PNode* someNode = ...;
     98   Vector objectMovement = calculateShift();
     99   someNode->shiftCoor(objectMovement);
     100
     101   elsewhere you would have to:
     102   PNode* someNode = ...;
     103   Vector objectMovement = calculateShift();
     104   Vector currentCoor = someNode->getRelCoor();
     105   Vector newCoor = currentCoor + objectMovement;
     106   someNode->setRelCoor(newCoor);
     107   
     108   yea right... shorter...
     109
     110*/
     111void PNode::shiftCoor (Vector shift)
     112{}
     113
     114
     115
     116/**
    82117   \brief get relative direction
    83118   \returns relative direction to its parent
     
    120155
    121156/**
     157   \brief shift coordinate (abs and rel)
     158   \param shift vector
     159
     160   this function shifts the current coordinates about the vector shift. this is
     161   usefull because from some place else you can:
     162   PNode* someNode = ...;
     163   Quaternion objectMovement = calculateShift();
     164   someNode->shiftCoor(objectMovement);
     165
     166   elsewhere you would have to:
     167   PNode* someNode = ...;
     168   Quaternion objectMovement = calculateShift();
     169   Quaternion currentCoor = someNode->getRelCoor();
     170   Quaternion newCoor = currentCoor + objectMovement;
     171   someNode->setRelCoor(newCoor);
     172   
     173   yea right... shorter...
     174
     175*/
     176void PNode::shiftDir (Quaternion shift)
     177{}
     178
     179
     180
     181/**
    122182   \brief adds a child and makes this node to a parent
    123183   \param child reference
     
    126186*/
    127187void PNode::addChild (PNode* pNode)
    128 {}
    129 
    130 
     188{
     189  this->addChild(pNode, DEFAULT_MODE);
     190}
     191
     192
     193/**
     194   \brief adds a child and makes this node to a parent
     195   \param child reference
     196   \param on which changes the child should also change ist state
     197
     198   use this to add a child to this node.
     199*/
     200void PNode::addChild (PNode* pNode, parentingMode mode)
     201{
     202  pNode->mode = mode;
     203  this->children->add (pNode);
     204}
     205
     206
     207/**
     208   /brief removes a child from the node
     209*/
    131210void PNode::removeChild (PNode* pNode)
    132 {}
    133 
    134 
     211{
     212  this->children->remove (pNode);
     213}
     214
     215
     216/**
     217   \brief sets the parent of this PNode
     218*/
    135219void PNode::setParent (PNode* parent)
    136 {}
    137 
     220{
     221  this->parent = parent;
     222}
     223
     224
     225/**
     226   \brief updates the absCoordinate/absDirection
     227
     228   this is used to go through the parent-tree to update all the absolute coordinates
     229   and directions. this update should be done by the engine, so you don't have to
     230   worry, normaly...
     231*/
     232void PNode::update()
     233{
     234 
     235}
     236
  • orxonox/branches/parenting/src/p_node.h

    r3247 r3248  
    2424#include "stdincl.h"
    2525
    26 typedef enum parentingMode {};
     26class PNode; /* forward decleration, so that parentEntry has access to PNode */
     27
     28typedef enum parentingMode {MOVEMENT = 0, ROTATION, ALL};
     29#define DEFAULT_MODE ALL
    2730
    2831class PNode {
     
    3235  ~PNode ();
    3336
     37  parentingMode mode;
     38
    3439  Vector getRelCoor ();
    3540  void setRelCoor (Vector relCoord);
    3641  Vector getAbsCoor ();
    3742  void setAbsCoor (Vector absCoord);
     43  void shiftCoor (Vector shift);
    3844
    3945  Quaternion getRelDir ();
     
    4147  Quaternion getAbsDir ();
    4248  void setAbsDir (Quaternion absDir);
     49  void shiftDir (Quaternion shift);
    4350
    4451  void addChild (PNode* pNode);
     52  void addChild (PNode* pNode, parentingMode mode);
    4553  void removeChild (PNode* pNode);
    4654  void setParent (PNode* parent);
     55  void update ();
    4756
    4857 private:
Note: See TracChangeset for help on using the changeset viewer.