Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/coord/null_parent.cc @ 3966

Last change on this file since 3966 was 3966, checked in by bensch, 19 years ago

orxonox/trunk: merged branches/particleEngine into the trunk, because of the new vector class
merged with command:
svn merge -r 3922:HEAD particleEngine/ ../trunk/

not merged src/story_entities/world.cc. will do this at a later time (do not forget)

File size: 2.6 KB
RevLine 
[3276]1
2
3/*
4   orxonox - the future of 3D-vertical-scrollers
5
6   Copyright (C) 2004 orx
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
12
13   ### File Specific:
14   main-programmer: Patrick Boenzli
15   co-programmer: ...
16*/
17
[3591]18#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_NULL_PARENT
[3276]19
20#include "null_parent.h"
[3607]21#include "stdincl.h"
[3608]22#include "vector.h"
23#include "list.h"
[3276]24
25
26using namespace std;
27
[3311]28NullParent* NullParent::singletonRef = 0;
[3276]29
[3311]30NullParent* NullParent::getInstance ()
31{
[3543]32  if(!singletonRef)
[3311]33    singletonRef = new NullParent ();
34  return singletonRef;
35}
36
[3276]37/**
38   \brief standard constructor
39
40   \todo this constructor is not jet implemented - do it
41*/
[3809]42NullParent::NullParent () : PNode (Vector(0,0,0), NULL)
[3276]43{
[3591]44  PRINTF(4)("NullParent::NullParent() - making new NullParent, there can only be one..\n");
[3276]45  this->parent = this;
[3565]46  this->mode = PNODE_ALL;
[3529]47  this->setName("NullParent");
[3276]48}
49
50
[3809]51NullParent::NullParent (const Vector& absCoordinate) : PNode (Vector(0,0,0), NULL)
[3276]52{
[3554]53  singletonRef = this;
[3276]54  this->parent = this;
[3565]55  this->mode = PNODE_ALL;
[3966]56  this->absCoordinate = absCoordinate;
[3529]57  this->setName("NullParent");
[3276]58}
59
60
61/**
62   \brief standard deconstructor
63
64   \todo this deconstructor is not jet implemented - do it
65*/
[3311]66NullParent::~NullParent () 
67{
[3529]68  //delete singletonRef;
[3311]69  singletonRef = NULL;
70}
[3276]71
72/**
73   \brief updates the absCoordinate/absDirection
74
75   this is used to go through the parent-tree to update all the absolute coordinates
76   and directions. this update should be done by the engine, so you don't have to
77   worry, normaly...
78*/
[3644]79void NullParent::update (float dt)
[3276]80{
[3545]81
[3966]82  PRINTF(4)("NullParent::update - (%f, %f, %f)\n", this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
83  this->absCoordinate = this->relCoordinate;
84  this->absDirection = parent->getAbsDir () * this->relDirection;
[3669]85
86  tIterator<PNode>* iterator = this->children->getIterator();
87  //PNode* pn = this->children->enumerate ();
88  PNode* pn = iterator->nextElement();
[3276]89  while( pn != NULL) 
90    { 
91      /* if this node has changed, make sure, that all children are updated also */
92      if( this->bRelCoorChanged || this->bAbsCoorChanged)
93        pn->parentCoorChanged ();
94      if( this->bRelDirChanged || this->bAbsDirChanged)
95        pn->parentDirChanged ();
[3644]96      pn->update (dt);
[3669]97      //pn = this->children->nextElement ();
98      pn = iterator->nextElement();
[3276]99    }
100
101  this->timeStamp = timeStamp;
102  this->bRelCoorChanged = false;
103  this->bAbsCoorChanged = false;
104  this->bRelDirChanged = false;
105  this->bAbsDirChanged = false;
106}
Note: See TracBrowser for help on using the repository browser.