Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6074 in orxonox.OLD for trunk/src


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
Files:
2 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/Makefile.am

    r5944 r6074  
    3434
    3535libORXlibs_a_SOURCES =  coord/p_node.cc \
    36                         coord/null_parent.cc \
    3736                        lang/base_object.cc \
    3837                        lang/class_list.cc \
     
    4746
    4847noinst_HEADERS =        coord/p_node.h \
    49                         coord/null_parent.h \
    5048                        lang/base_object.h \
    5149                        graphics/render2D/element_2d.h \
  • 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
  • trunk/src/lib/sound/sound_engine.cc

    r6073 r6074  
    290290  // INITIALIZING THE DEVICE:
    291291
    292 #ifdef AL_VERSION_1_1
     292#ifndef AL_VERSION_1_1
    293293  ALubyte deviceName[] =
    294294#else
  • trunk/src/story_entities/world.cc

    r6054 r6074  
    2424
    2525#include "p_node.h"
    26 #include "null_parent.h"
    2726#include "pilot_node.h"
    2827#include "world_entity.h"
     
    144143
    145144  // erease everything that is left.
    146   delete NullParent::getInstance();
     145  delete PNode::getNullParent();
    147146
    148147  //secondary cleanup of PNodes;
     
    222221
    223222  LightManager::getInstance();
    224   NullParent::getInstance ();
     223  PNode::getNullParent();
    225224
    226225  AnimationPlayer::getInstance(); // initializes the animationPlayer
     
    508507
    509508  /* 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);
    512511
    513512}
     
    766765  GarbageCollector::getInstance()->update();
    767766  GraphicsEngine::getInstance()->update(this->dtS);
    768   NullParent::getInstance()->updateNode (this->dtS);
     767  PNode::getNullParent()->updateNode (this->dtS);
    769768
    770769  SoundEngine::getInstance()->update();
     
    823822
    824823  if (unlikely(this->showPNodes))
    825     NullParent::getInstance()->debugDraw(0);
     824    PNode::getNullParent()->debugDraw(0);
    826825
    827826  GraphicsEngine::getInstance()->draw();
  • trunk/src/subprojects/framework.cc

    r5944 r6074  
    1818
    1919#include "p_node.h"
    20 #include "null_parent.h"
    2120#include "state.h"
    2221#include "debug.h"
     
    8079      float dt = framework->tick();
    8180
    82       NullParent::getInstance()->updateNode(dt);
     81      PNode::getNullParent()->updateNode(dt);
    8382
    8483      // Draw the scene
  • trunk/src/util/garbage_collector.cc

    r5355 r6074  
    2020#include "state.h"
    2121#include "world_entity.h"
    22 #include "null_parent.h"
    2322#include "fast_factory.h"
    2423
  • trunk/src/util/track/track_node.cc

    r4836 r6074  
    1919#include "track_node.h"
    2020
    21 #include "null_parent.h"
    22 
    2321#include "track_manager.h"
    2422
     
    3331  this->setName("TrackNode");
    3432
    35   NullParent::getInstance()->addChild(this);
     33  PNode::getNullParent()->addChild(this);
    3634  this->trackManager = TrackManager::getInstance();
    3735  this->setParentMode(PNODE_ALL);
  • trunk/src/world_entities/weapons/aiming_turret.cc

    r5994 r6074  
    2222
    2323#include "model.h"
    24 
    25 #include "null_parent.h"
    2624
    2725#include "animation3d.h"
     
    145143
    146144  pj->setTarget(this->target->getParent());
    147   pj->setParent(NullParent::getInstance());
     145  pj->setParent(PNode::getNullParent());
    148146  pj->setAbsCoor(this->getEmissionPoint());
    149147  pj->setAbsDir(this->getAbsDir());
  • trunk/src/world_entities/weapons/cannon.cc

    r5994 r6074  
    3232#include "list.h"
    3333#include "animation3d.h"
    34 
    35 #include "null_parent.h"
    3634
    3735#include "fast_factory.h"
     
    161159    return;
    162160
    163   pj->setParent(NullParent::getInstance());
     161  pj->setParent(PNode::getNullParent());
    164162
    165163  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  
    2828#include "particle_emitter.h"
    2929#include "particle_system.h"
    30 
    31 
    32 #include "null_parent.h"
    3330
    3431using namespace std;
     
    153150{
    154151  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
    155   if (target.getParent() != NullParent::getInstance())
     152  if (target.getParent() != PNode::getNullParent())
    156153   {
    157154     velocity += ((target.getAbsCoor() - this->getAbsCoor()).getNormalized())*agility;
  • trunk/src/world_entities/weapons/projectile.cc

    r6056 r6074  
    2121#include "world_entity.h"
    2222#include "weapon.h"
    23 #include "null_parent.h"
    2423#include "model.h"
    2524
  • trunk/src/world_entities/weapons/test_gun.cc

    r6022 r6074  
    3232#include "list.h"
    3333#include "animation3d.h"
    34 
    35 #include "null_parent.h"
    3634
    3735#include "fast_factory.h"
     
    184182    return;
    185183
    186   pj->setParent(NullParent::getInstance());
     184  pj->setParent(PNode::getNullParent());
    187185
    188186  pj->setVelocity(this->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))*50+VECTOR_RAND(5));
  • trunk/src/world_entities/weapons/turret.cc

    r5994 r6074  
    2222#include "model.h"
    2323
    24 #include "null_parent.h"
    2524#include "state.h"
    2625#include "list.h"
     
    139138
    140139
    141   pj->setParent(NullParent::getInstance());
     140  pj->setParent(PNode::getNullParent());
    142141  pj->setAbsCoor(this->getEmissionPoint());
    143142  pj->setAbsDir(this->getAbsDir());
  • trunk/src/world_entities/weapons/weapon_manager.cc

    r6056 r6074  
    2727
    2828#include "t_animation.h"
    29 #include "null_parent.h"
    30 
    3129
    3230using namespace std;
     
    160158{
    161159  if (parent == NULL)
    162     parent = NullParent::getInstance();
     160    parent = PNode::getNullParent();
    163161  this->parent = parent;
    164162  if (this->parent != NULL)
Note: See TracChangeset for help on using the changeset viewer.