Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/simple_animation.cc @ 3655

Last change on this file since 3655 was 3573, checked in by patrick, 20 years ago

orxonox/trunk: implemented skeleton for animatino player. added classes weapon and projectile, the base classes for future guns and rocket lunchers or whatever you will be wanting to implement. PS: animation player rules…

File size: 4.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 "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{
113  KeyFrame* frame = this->frames->enumerate(); 
114  while( frame != NULL) 
115    { 
116      delete frame;
117      frame = frames->nextElement();
118    }
119  delete this->frames;
120}
121
122
123
124/**
125   \brief adds a keyframe with properties
126   \param the point of the object
127   \param and the orientation of it
128   \param at this time
129*/
130void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time)
131{
132  KeyFrame* frame = new KeyFrame(point, orientation, time);
133  this->frames->add(frame);
134}
135
136
137/**
138   \brief adds a keyframe with properties
139   \param the point of the object
140   \param and the orientation of it
141   \param at this time
142   \param function of the velocity of the movement
143*/
144void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode)
145{
146  KeyFrame* frame = new KeyFrame(point, orientation, time, mode);
147  this->frames->add(frame);
148}
149
150/**
151   \brief adds a already defined keyframe
152   \param the keyframe to add
153*/
154void SimpleAnimation::addKeyFrame(KeyFrame* frame)
155{
156  this->frames->add(frame);
157}
158
159
160/**
161   \brief clear the list of keyframes, deleting all keyframes included
162*/
163void SimpleAnimation::reset()
164{
165  KeyFrame* frame = this->frames->enumerate(); 
166  while( frame != NULL) 
167    { 
168      delete frame;
169      frame = frames->nextElement();
170    }
171  delete this->frames;
172
173  this->frames = new tList<KeyFrame>();
174  this->localTime = 0;
175  this->bPause = false;
176
177}
178
179/**
180   \brief starts the animation, therefore listens to tick signals
181*/
182void SimpleAnimation::start()
183{}
184
185
186/**
187   \brief stops the animation, immune to tick signals
188*/
189void SimpleAnimation::stop()
190{}
191
192/**
193   \brief stops and then starts the animation from begining
194*/
195void SimpleAnimation::restart()
196{
197  this->localTime = 0;
198  this->bPause = false;
199}
200
201/**
202   \brief pauses the animation until resumed
203*/
204void SimpleAnimation::pause()
205{
206  this->bPause = true;
207}
208
209/**
210   \brief resumes a pause, if not paused, no effect
211*/
212void SimpleAnimation::resume()
213{
214  this->bPause = false;
215}
216
217
218/**
219   \brief heart beat, next animation step
220*/
221void SimpleAnimation::tick(float time)
222{
223  if(!this->bPause)
224    {
225
226
227
228    }
229}
Note: See TracBrowser for help on using the repository browser.