- Timestamp:
- Dec 12, 2005, 11:34:02 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 2 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/Makefile.am
r5944 r6074 34 34 35 35 libORXlibs_a_SOURCES = coord/p_node.cc \ 36 coord/null_parent.cc \37 36 lang/base_object.cc \ 38 37 lang/class_list.cc \ … … 47 46 48 47 noinst_HEADERS = coord/p_node.h \ 49 coord/null_parent.h \50 48 lang/base_object.h \ 51 49 graphics/render2D/element_2d.h \ -
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 -
trunk/src/lib/sound/sound_engine.cc
r6073 r6074 290 290 // INITIALIZING THE DEVICE: 291 291 292 #if def AL_VERSION_1_1292 #ifndef AL_VERSION_1_1 293 293 ALubyte deviceName[] = 294 294 #else -
trunk/src/story_entities/world.cc
r6054 r6074 24 24 25 25 #include "p_node.h" 26 #include "null_parent.h"27 26 #include "pilot_node.h" 28 27 #include "world_entity.h" … … 144 143 145 144 // erease everything that is left. 146 delete NullParent::getInstance();145 delete PNode::getNullParent(); 147 146 148 147 //secondary cleanup of PNodes; … … 222 221 223 222 LightManager::getInstance(); 224 NullParent::getInstance();223 PNode::getNullParent(); 225 224 226 225 AnimationPlayer::getInstance(); // initializes the animationPlayer … … 508 507 509 508 /* update the object position before game start - so there are no wrong coordinates used in the first processing */ 510 NullParent::getInstance()->updateNode (0.001f);511 NullParent::getInstance()->updateNode (0.001f);509 PNode::getNullParent()->updateNode (0.001f); 510 PNode::getNullParent()->updateNode (0.001f); 512 511 513 512 } … … 766 765 GarbageCollector::getInstance()->update(); 767 766 GraphicsEngine::getInstance()->update(this->dtS); 768 NullParent::getInstance()->updateNode (this->dtS);767 PNode::getNullParent()->updateNode (this->dtS); 769 768 770 769 SoundEngine::getInstance()->update(); … … 823 822 824 823 if (unlikely(this->showPNodes)) 825 NullParent::getInstance()->debugDraw(0);824 PNode::getNullParent()->debugDraw(0); 826 825 827 826 GraphicsEngine::getInstance()->draw(); -
trunk/src/subprojects/framework.cc
r5944 r6074 18 18 19 19 #include "p_node.h" 20 #include "null_parent.h"21 20 #include "state.h" 22 21 #include "debug.h" … … 80 79 float dt = framework->tick(); 81 80 82 NullParent::getInstance()->updateNode(dt);81 PNode::getNullParent()->updateNode(dt); 83 82 84 83 // Draw the scene -
trunk/src/util/garbage_collector.cc
r5355 r6074 20 20 #include "state.h" 21 21 #include "world_entity.h" 22 #include "null_parent.h"23 22 #include "fast_factory.h" 24 23 -
trunk/src/util/track/track_node.cc
r4836 r6074 19 19 #include "track_node.h" 20 20 21 #include "null_parent.h"22 23 21 #include "track_manager.h" 24 22 … … 33 31 this->setName("TrackNode"); 34 32 35 NullParent::getInstance()->addChild(this);33 PNode::getNullParent()->addChild(this); 36 34 this->trackManager = TrackManager::getInstance(); 37 35 this->setParentMode(PNODE_ALL); -
trunk/src/world_entities/weapons/aiming_turret.cc
r5994 r6074 22 22 23 23 #include "model.h" 24 25 #include "null_parent.h"26 24 27 25 #include "animation3d.h" … … 145 143 146 144 pj->setTarget(this->target->getParent()); 147 pj->setParent( NullParent::getInstance());145 pj->setParent(PNode::getNullParent()); 148 146 pj->setAbsCoor(this->getEmissionPoint()); 149 147 pj->setAbsDir(this->getAbsDir()); -
trunk/src/world_entities/weapons/cannon.cc
r5994 r6074 32 32 #include "list.h" 33 33 #include "animation3d.h" 34 35 #include "null_parent.h"36 34 37 35 #include "fast_factory.h" … … 161 159 return; 162 160 163 pj->setParent( NullParent::getInstance());161 pj->setParent(PNode::getNullParent()); 164 162 165 163 pj->setVelocity(this->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))*15+VECTOR_RAND(5)); -
trunk/src/world_entities/weapons/guided_missile.cc
r6056 r6074 28 28 #include "particle_emitter.h" 29 29 #include "particle_system.h" 30 31 32 #include "null_parent.h"33 30 34 31 using namespace std; … … 153 150 { 154 151 //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1); 155 if (target.getParent() != NullParent::getInstance())152 if (target.getParent() != PNode::getNullParent()) 156 153 { 157 154 velocity += ((target.getAbsCoor() - this->getAbsCoor()).getNormalized())*agility; -
trunk/src/world_entities/weapons/projectile.cc
r6056 r6074 21 21 #include "world_entity.h" 22 22 #include "weapon.h" 23 #include "null_parent.h"24 23 #include "model.h" 25 24 -
trunk/src/world_entities/weapons/test_gun.cc
r6022 r6074 32 32 #include "list.h" 33 33 #include "animation3d.h" 34 35 #include "null_parent.h"36 34 37 35 #include "fast_factory.h" … … 184 182 return; 185 183 186 pj->setParent( NullParent::getInstance());184 pj->setParent(PNode::getNullParent()); 187 185 188 186 pj->setVelocity(this->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))*50+VECTOR_RAND(5)); -
trunk/src/world_entities/weapons/turret.cc
r5994 r6074 22 22 #include "model.h" 23 23 24 #include "null_parent.h"25 24 #include "state.h" 26 25 #include "list.h" … … 139 138 140 139 141 pj->setParent( NullParent::getInstance());140 pj->setParent(PNode::getNullParent()); 142 141 pj->setAbsCoor(this->getEmissionPoint()); 143 142 pj->setAbsDir(this->getAbsDir()); -
trunk/src/world_entities/weapons/weapon_manager.cc
r6056 r6074 27 27 28 28 #include "t_animation.h" 29 #include "null_parent.h"30 31 29 32 30 using namespace std; … … 160 158 { 161 159 if (parent == NULL) 162 parent = NullParent::getInstance();160 parent = PNode::getNullParent(); 163 161 this->parent = parent; 164 162 if (this->parent != NULL)
Note: See TracChangeset
for help on using the changeset viewer.