Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/textEngine/src/simple_animation.cc @ 3682

Last change on this file since 3682 was 3681, checked in by bensch, 20 years ago

orxonox/branches/textEngine: merged trunk here.
merged with command:
svn merge ../trunk textEngine -r 3467:HEAD
no conflicts

File size: 4.5 KB
RevLine 
[3573]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 "simple_animation.h"
20#include "stdincl.h"
21#include "p_node.h"
22
23using namespace std;
24
25/**
26   \brief standard constructor
27   \param the point of the object
28   \param and the orientation of it
29   \param at this time
30*/
31KeyFrame::KeyFrame(Vector* point, Quaternion* orientation, float time)
32{
33  this->setRelCoor(point);
34  this->setRelDir(orientation);
35  this->time = time;
36}
37
38
39/**
40   \brief standard constructor
41   \param the point of the object
42   \param and the orientation of it
43   \param at this time
44   \param function of the velocity of the movement
45*/
46KeyFrame::KeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode)
47{
48  this->setRelCoor(point);
49  this->setRelDir(orientation);
50  this->time = time;
51  this->mode = mode;
52}
53
54
55/**
56   \brief standard deconstructor
57*/
58KeyFrame::~KeyFrame()
59{
60}
61
62
63/**
64   \brief sets the important properties of a Keyframe
65   \param the point of the object
66   \param and the orientation of it
67   \param at this time
68*/
69void KeyFrame::set(Vector* point, Quaternion* orientation, float time)
70{
71  this->setRelCoor(point);
72  this->setRelDir(orientation);
73  this->time = time;
74}
75
76
77/**
78   \brief sets the important properties of a Keyframe
79   \param the point of the object
80   \param and the orientation of it
81   \param at this time
82   \param function of the velocity of the movement
83*/
84void KeyFrame::set(Vector* point, Quaternion* orientation, float time, movementMode mode)
85{
86  this->setRelCoor(point);
87  this->setRelDir(orientation);
88  this->time = time;
89  this->mode = mode;
90}
91
92
93
94/**
95   \brief standard constructor
96*/
97SimpleAnimation::SimpleAnimation (PNode* parent) 
98{
99   this->setClassName ("SimpleAnimation");
100   this->frames = new tList<KeyFrame>();
101   this->localTime = 0;
102   this->bPause = false;
103   this->parent = parent;
104}
105
106
107/**
108   \brief standard deconstructor
109
110*/
111SimpleAnimation::~SimpleAnimation () 
112{
[3661]113  tIterator<KeyFrame>* iterator = this->frames->getIterator();
114  KeyFrame* frame = iterator->nextElement(); 
[3573]115  while( frame != NULL) 
116    { 
117      delete frame;
[3661]118      frame = iterator->nextElement();
[3573]119    }
[3661]120  delete iterator;
[3573]121  delete this->frames;
122}
123
124
125
126/**
127   \brief adds a keyframe with properties
128   \param the point of the object
129   \param and the orientation of it
130   \param at this time
131*/
132void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time)
133{
134  KeyFrame* frame = new KeyFrame(point, orientation, time);
135  this->frames->add(frame);
136}
137
138
139/**
140   \brief adds a keyframe with properties
141   \param the point of the object
142   \param and the orientation of it
143   \param at this time
144   \param function of the velocity of the movement
145*/
146void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode)
147{
148  KeyFrame* frame = new KeyFrame(point, orientation, time, mode);
149  this->frames->add(frame);
150}
151
152/**
153   \brief adds a already defined keyframe
154   \param the keyframe to add
155*/
156void SimpleAnimation::addKeyFrame(KeyFrame* frame)
157{
158  this->frames->add(frame);
159}
160
161
162/**
163   \brief clear the list of keyframes, deleting all keyframes included
164*/
165void SimpleAnimation::reset()
166{
[3661]167  tIterator<KeyFrame>* iterator = this->frames->getIterator();
168  KeyFrame* frame = iterator->nextElement(); 
[3573]169  while( frame != NULL) 
170    { 
171      delete frame;
[3661]172      frame = iterator->nextElement();
[3573]173    }
[3661]174  delete iterator;
[3573]175  delete this->frames;
176
177  this->frames = new tList<KeyFrame>();
178  this->localTime = 0;
179  this->bPause = false;
180
181}
182
183/**
184   \brief starts the animation, therefore listens to tick signals
185*/
186void SimpleAnimation::start()
187{}
188
189
190/**
191   \brief stops the animation, immune to tick signals
192*/
193void SimpleAnimation::stop()
194{}
195
196/**
197   \brief stops and then starts the animation from begining
198*/
199void SimpleAnimation::restart()
200{
201  this->localTime = 0;
202  this->bPause = false;
203}
204
205/**
206   \brief pauses the animation until resumed
207*/
208void SimpleAnimation::pause()
209{
210  this->bPause = true;
211}
212
213/**
214   \brief resumes a pause, if not paused, no effect
215*/
216void SimpleAnimation::resume()
217{
218  this->bPause = false;
219}
220
221
222/**
223   \brief heart beat, next animation step
224*/
225void SimpleAnimation::tick(float time)
226{
227  if(!this->bPause)
228    {
229
230
231
232    }
233}
Note: See TracBrowser for help on using the repository browser.