Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/parenting/src/null_parent.cc @ 3308

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

orxonox/branches/parenting: modified function passing routines - now having two lists: parenting list (tree) and entity list (array), that coexist - this is the only possibility to keep oversight.

File size: 1.8 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
24
25/**
26   \brief standard constructor
27
28   \todo this constructor is not jet implemented - do it
29*/
30NullParent::NullParent () 
31{
32  this->parent = this;
33  this->mode = ALL;
34}
35
36
37NullParent::NullParent (Vector* absCoordinate)
38{
39  this->parent = this;
40  this->mode = ALL;
41  this->absCoordinate = *absCoordinate;
42}
43
44
45/**
46   \brief standard deconstructor
47
48   \todo this deconstructor is not jet implemented - do it
49*/
50NullParent::~NullParent () {}
51
52
53
54
55/**
56   \brief updates the absCoordinate/absDirection
57
58   this is used to go through the parent-tree to update all the absolute coordinates
59   and directions. this update should be done by the engine, so you don't have to
60   worry, normaly...
61*/
62void NullParent::update (float timeStamp)
63{
64  this->absCoordinate = this->relCoordinate;
65  this->absDirection = parent->getAbsDir () * this->relDirection;
66 
67  PNode* pn = this->children->enumerate ();
68  while( pn != NULL) 
69    { 
70      /* if this node has changed, make sure, that all children are updated also */
71      if( this->bRelCoorChanged || this->bAbsCoorChanged)
72        pn->parentCoorChanged ();
73      if( this->bRelDirChanged || this->bAbsDirChanged)
74        pn->parentDirChanged ();
75      pn->update (timeStamp);
76      pn = this->children->nextElement ();
77    }
78
79  this->timeStamp = timeStamp;
80  this->bRelCoorChanged = false;
81  this->bAbsCoorChanged = false;
82  this->bRelDirChanged = false;
83  this->bAbsDirChanged = false;
84}
Note: See TracBrowser for help on using the repository browser.