Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6074 in orxonox.OLD for trunk/src/lib/coord


Ignore:
Timestamp:
Dec 12, 2005, 11:34:02 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: taken out NullParent.
THE TRUNK IS NOT RUNNING FOR THE TIME BEING. DO NOT BE ALARMED, THIS IS TEMPORARY

Location:
trunk/src/lib/coord
Files:
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/coord/p_node.cc

    r6073 r6074  
    1717
    1818#include "p_node.h"
    19 #include "null_parent.h"
    2019
    2120#include "load_param.h"
     
    3433 * @brief standard constructor
    3534 */
    36 PNode::PNode ()
     35PNode::PNode (PNode* parent)
    3736{
    3837  init();
    39 
    40   NullParent::getInstance()->addChild(this);
    41 }
    42 
    43 
    44 /**
    45  * @brief constructor with coodinates
    46  * @param absCoordinate the Absolute coordinate of the Object
    47  * @param parent The parent-node of this node.
    48  */
    49 PNode::PNode (const Vector& absCoor, PNode* parent )
    50 {
    51   this->init();
    52 
    53   if (likely(parent != NULL))
    54     parent->addChild (this);
    55 
    56   this->setAbsCoor(absCoor);
    57 }
    58 
     38  if (parent != NULL)
     39    parent->addChild(this);
     40}
     41
     42/**
     43 * @brief initializes a PNode
     44 * @param parent the parent for this PNode
     45 */
     46void PNode::init()
     47{
     48  this->setClassID(CL_PARENT_NODE, "PNode");
     49
     50  this->bRelCoorChanged = true;
     51  this->bRelDirChanged = true;
     52  this->parent = NULL;
     53  this->parentMode = PNODE_PARENT_MODE_DEFAULT;
     54  this->bActive = true;
     55
     56  // smooth-movers
     57  this->toCoordinate = NULL;
     58  this->toDirection = NULL;
     59  this->bias = 1.0;
     60}
     61
     62// NullParent Reference
     63PNode* PNode::nullParent = NULL;
    5964
    6065/**
     
    8691          ((*deleteNode)->parentMode & PNODE_PROHIBIT_DELETE_WITH_PARENT))
    8792      {
    88         if (this == NullParent::getInstance() && (*deleteNode)->parentMode & PNODE_REPARENT_TO_NULLPARENT)
     93        if (this == PNode::getNullParent() && (*deleteNode)->parentMode & PNODE_REPARENT_TO_NULLPARENT)
    8994          delete (*deleteNode);
    9095        else
     
    110115
    111116/**
    112  * @brief initializes a PNode
    113  * @param parent the parent for this PNode
    114  */
    115 void PNode::init()
    116 {
    117   this->setClassID(CL_PARENT_NODE, "PNode");
    118 
    119   this->bRelCoorChanged = true;
    120   this->bRelDirChanged = true;
    121   this->parent = NULL;
    122   this->parentMode = PNODE_PARENT_MODE_DEFAULT;
    123   this->bActive = true;
    124 
    125   // smooth-movers
    126   this->toCoordinate = NULL;
    127   this->toDirection = NULL;
    128   this->bias = 1.0;
    129 }
    130 
    131 /**
    132117 * @brief loads parameters of the PNode
    133118 * @param root the XML-element to load the properties of
     
    160145    LOAD_PARAM_START_CYCLE(root, element);
    161146    {
    162       LoadParam_CYCLE(element, "parent", this, PNode, addChild)
     147      LoadParam_CYCLE(element, "child", this, PNode, addChild)
    163148          .describe("adds a new Child to the current Node.");
    164149
     
    506491{
    507492  if (child != NULL)
    508   {
    509493   child->removeNode();
    510 //   this->children->remove(child);
    511 //   child->parent = NULL;
    512   }
    513494}
    514495
     
    624605{
    625606  if (this->parentMode & PNODE_REPARENT_TO_NULLPARENT)
    626     this->setParent(NullParent::getInstance());
     607    this->setParent(PNode::getNullParent());
    627608  else if (this->parentMode & PNODE_REPARENT_TO_PARENTS_PARENT && this->parent != NULL)
    628609    this->setParent(this->parent->getParent());
     
    881862    {
    882863      // drawing the Dependency graph
    883      if (this != NullParent::getInstance())
     864     if (this != PNode::getNullParent())
    884865      {
    885866       glBegin(GL_LINES);
  • trunk/src/lib/coord/p_node.h

    r6073 r6074  
    7272class PNode : virtual public BaseObject {
    7373 public:
    74   PNode ();
    75   PNode (const Vector& absCoor, PNode* pNode);
     74  PNode (PNode* parent = PNode::getNullParent());
    7675  virtual ~PNode ();
    7776
     
    155154  void removeNodeModeFlags(unsigned short nodeFlags);
    156155
     156  /** @returns the NullParent, the (main) ROOT of the PNode Tree. If it does not yet exist, it will be created. */
     157  static PNode* getNullParent()  { return (PNode::nullParent != NULL || (PNode::nullParent = new PNode(NULL)) != NULL)? PNode::nullParent : NULL; };
    157158
    158159  void updateNode (float dt);
     
    204205  bool               bActive;            //!< If the Node is Active (for cutting off the rest of the tree in update).
    205206  unsigned short     parentMode;         //!< the mode of the binding
     207
     208
     209  static PNode*      nullParent;         //!< The ROOT of the main PNode Tree.
    206210};
    207211
Note: See TracChangeset for help on using the changeset viewer.