Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/parenting/src/p_node.cc @ 3248

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

orxonox/branches/parenting: defined all function/variables now will have to implement them

File size: 4.9 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 "p_node.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*/
30PNode::PNode () 
31{
32  this->children = new tList<PNode>();
33}
34
35
36/**
37   \brief standard deconstructor
38
39   \todo this deconstructor is not jet implemented - do it
40*/
41PNode::~PNode () 
42{
43  this->children->destroy();
44  delete this->children;
45}
46
47
48/**
49   \brief get relative coordinates
50   \returns relative coordinates to its parent
51*/
52Vector PNode::getRelCoor ()
53{
54  Vector r = this->relCoordinate; /* return a copy, so it can't be modified */
55  return r;
56}
57
58
59/**
60   \brief set relative coordinates
61   \param relative coordinates to its parent
62
63   it is very importand, that you use this function, if you want to update the
64   relCoordinates. If you don't use this, the PNode won't recognize, that something
65   has changed and won't update the children Nodes.
66*/
67void PNode::setRelCoor (Vector relCoord)
68{}
69
70
71/**
72   \brief get absolute coordinates
73   \returns absolute coordinates from (0,0,0)
74*/
75Vector PNode::getAbsCoor ()
76{}
77
78
79/**
80   \brief get relative coordinates
81   \returns relative coordinates to its parent
82
83   it is very importand, that you use this function, if you want to update the
84   absCoordinates. If you don't use this, the PNode won't recognize, that something
85   has changed and won't update the children Nodes.
86*/
87void PNode::setAbsCoor (Vector absCoord)
88{}
89
90
91/**
92   \brief shift coordinate (abs and rel)
93   \param shift vector
94
95   this function shifts the current coordinates about the vector shift. this is
96   usefull because from some place else you can:
97   PNode* someNode = ...;
98   Vector objectMovement = calculateShift();
99   someNode->shiftCoor(objectMovement);
100
101   elsewhere you would have to:
102   PNode* someNode = ...;
103   Vector objectMovement = calculateShift();
104   Vector currentCoor = someNode->getRelCoor();
105   Vector newCoor = currentCoor + objectMovement;
106   someNode->setRelCoor(newCoor);
107   
108   yea right... shorter...
109
110*/
111void PNode::shiftCoor (Vector shift)
112{}
113
114
115
116/**
117   \brief get relative direction
118   \returns relative direction to its parent
119*/
120Quaternion PNode::getRelDir ()
121{}
122
123
124/**
125   \brief set relative direction
126   \param relative direction to its parent
127
128   it is very importand, that you use this function, if you want to update the
129   relDirection. If you don't use this, the PNode won't recognize, that something
130   has changed and won't update the children Nodes.
131*/
132void PNode::setRelDir (Quaternion relDir)
133{}
134
135
136/**
137   \brief gets the absolute direction (0,0,1)
138   \returns absolute coordinates
139*/
140Quaternion PNode::getAbsDir ()
141{}
142
143
144/**
145   \brief sets the absolute direction (0,0,1)
146   \param absolute coordinates
147
148   it is very importand, that you use this function, if you want to update the
149   absDirection. If you don't use this, the PNode won't recognize, that something
150   has changed and won't update the children Nodes.
151*/
152void PNode::setAbsDir (Quaternion absDir)
153{}
154
155
156/**
157   \brief shift coordinate (abs and rel)
158   \param shift vector
159
160   this function shifts the current coordinates about the vector shift. this is
161   usefull because from some place else you can:
162   PNode* someNode = ...;
163   Quaternion objectMovement = calculateShift();
164   someNode->shiftCoor(objectMovement);
165
166   elsewhere you would have to:
167   PNode* someNode = ...;
168   Quaternion objectMovement = calculateShift();
169   Quaternion currentCoor = someNode->getRelCoor();
170   Quaternion newCoor = currentCoor + objectMovement;
171   someNode->setRelCoor(newCoor);
172   
173   yea right... shorter...
174
175*/
176void PNode::shiftDir (Quaternion shift)
177{}
178
179
180
181/**
182   \brief adds a child and makes this node to a parent
183   \param child reference
184
185   use this to add a child to this node.
186*/
187void PNode::addChild (PNode* pNode)
188{
189  this->addChild(pNode, DEFAULT_MODE);
190}
191
192
193/**
194   \brief adds a child and makes this node to a parent
195   \param child reference
196   \param on which changes the child should also change ist state
197
198   use this to add a child to this node.
199*/
200void PNode::addChild (PNode* pNode, parentingMode mode)
201{
202  pNode->mode = mode;
203  this->children->add (pNode);
204}
205
206
207/**
208   /brief removes a child from the node
209*/
210void PNode::removeChild (PNode* pNode)
211{
212  this->children->remove (pNode);
213}
214
215
216/**
217   \brief sets the parent of this PNode
218*/
219void PNode::setParent (PNode* parent)
220{
221  this->parent = parent;
222}
223
224
225/**
226   \brief updates the absCoordinate/absDirection
227
228   this is used to go through the parent-tree to update all the absolute coordinates
229   and directions. this update should be done by the engine, so you don't have to
230   worry, normaly...
231*/
232void PNode::update()
233{
234 
235}
236
Note: See TracBrowser for help on using the repository browser.