Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3551 was 3551, checked in by patrick, 19 years ago

orxonox/trunk: renamed all timing functions to tick() - cleanede up world

File size: 2.3 KB
Line 
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
18
19#include "null_parent.h"
20
21
22using namespace std;
23
24NullParent* NullParent::singletonRef = 0;
25
26NullParent* NullParent::getInstance ()
27{
28  if(!singletonRef)
29    singletonRef = new NullParent ();
30  return singletonRef;
31}
32
33/**
34   \brief standard constructor
35
36   \todo this constructor is not jet implemented - do it
37*/
38NullParent::NullParent () : PNode("NullParent")
39{
40  printf("NullParent::NullParent() - making new NullParent, there can only be one..\n");
41  this->parent = this;
42  this->mode = ALL;
43  this->setName("NullParent");
44}
45
46
47NullParent::NullParent (Vector* absCoordinate) : PNode("NullParent")
48{
49  this->parent = this;
50  this->mode = ALL;
51  this->absCoordinate = *absCoordinate;
52  this->setName("NullParent");
53}
54
55
56/**
57   \brief standard deconstructor
58
59   \todo this deconstructor is not jet implemented - do it
60*/
61NullParent::~NullParent () 
62{
63  //delete singletonRef;
64  singletonRef = NULL;
65}
66
67/**
68   \brief updates the absCoordinate/absDirection
69
70   this is used to go through the parent-tree to update all the absolute coordinates
71   and directions. this update should be done by the engine, so you don't have to
72   worry, normaly...
73*/
74void NullParent::update ()
75{
76
77  printf ("NullParent::update - (%f, %f, %f)\n", this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
78  this->absCoordinate = this->relCoordinate;
79  this->absDirection = parent->getAbsDir () * this->relDirection;
80 
81  PNode* pn = this->children->enumerate ();
82  while( pn != NULL) 
83    { 
84      /* if this node has changed, make sure, that all children are updated also */
85      if( this->bRelCoorChanged || this->bAbsCoorChanged)
86        pn->parentCoorChanged ();
87      if( this->bRelDirChanged || this->bAbsDirChanged)
88        pn->parentDirChanged ();
89      pn->update ();
90      pn = this->children->nextElement ();
91    }
92
93  this->timeStamp = timeStamp;
94  this->bRelCoorChanged = false;
95  this->bAbsCoorChanged = false;
96  this->bRelDirChanged = false;
97  this->bAbsDirChanged = false;
98}
Note: See TracBrowser for help on using the repository browser.