Changeset 6074 in orxonox.OLD for trunk/src/lib/coord
- Timestamp:
- Dec 12, 2005, 11:34:02 PM (19 years ago)
- Location:
- trunk/src/lib/coord
- Files:
-
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/coord/p_node.cc
r6073 r6074 17 17 18 18 #include "p_node.h" 19 #include "null_parent.h"20 19 21 20 #include "load_param.h" … … 34 33 * @brief standard constructor 35 34 */ 36 PNode::PNode ( )35 PNode::PNode (PNode* parent) 37 36 { 38 37 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 */ 46 void 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 63 PNode* PNode::nullParent = NULL; 59 64 60 65 /** … … 86 91 ((*deleteNode)->parentMode & PNODE_PROHIBIT_DELETE_WITH_PARENT)) 87 92 { 88 if (this == NullParent::getInstance() && (*deleteNode)->parentMode & PNODE_REPARENT_TO_NULLPARENT)93 if (this == PNode::getNullParent() && (*deleteNode)->parentMode & PNODE_REPARENT_TO_NULLPARENT) 89 94 delete (*deleteNode); 90 95 else … … 110 115 111 116 /** 112 * @brief initializes a PNode113 * @param parent the parent for this PNode114 */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-movers126 this->toCoordinate = NULL;127 this->toDirection = NULL;128 this->bias = 1.0;129 }130 131 /**132 117 * @brief loads parameters of the PNode 133 118 * @param root the XML-element to load the properties of … … 160 145 LOAD_PARAM_START_CYCLE(root, element); 161 146 { 162 LoadParam_CYCLE(element, " parent", this, PNode, addChild)147 LoadParam_CYCLE(element, "child", this, PNode, addChild) 163 148 .describe("adds a new Child to the current Node."); 164 149 … … 506 491 { 507 492 if (child != NULL) 508 {509 493 child->removeNode(); 510 // this->children->remove(child);511 // child->parent = NULL;512 }513 494 } 514 495 … … 624 605 { 625 606 if (this->parentMode & PNODE_REPARENT_TO_NULLPARENT) 626 this->setParent( NullParent::getInstance());607 this->setParent(PNode::getNullParent()); 627 608 else if (this->parentMode & PNODE_REPARENT_TO_PARENTS_PARENT && this->parent != NULL) 628 609 this->setParent(this->parent->getParent()); … … 881 862 { 882 863 // drawing the Dependency graph 883 if (this != NullParent::getInstance())864 if (this != PNode::getNullParent()) 884 865 { 885 866 glBegin(GL_LINES); -
trunk/src/lib/coord/p_node.h
r6073 r6074 72 72 class PNode : virtual public BaseObject { 73 73 public: 74 PNode (); 75 PNode (const Vector& absCoor, PNode* pNode); 74 PNode (PNode* parent = PNode::getNullParent()); 76 75 virtual ~PNode (); 77 76 … … 155 154 void removeNodeModeFlags(unsigned short nodeFlags); 156 155 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; }; 157 158 158 159 void updateNode (float dt); … … 204 205 bool bActive; //!< If the Node is Active (for cutting off the rest of the tree in update). 205 206 unsigned short parentMode; //!< the mode of the binding 207 208 209 static PNode* nullParent; //!< The ROOT of the main PNode Tree. 206 210 }; 207 211
Note: See TracChangeset
for help on using the changeset viewer.