00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __SGL_ANIMATION_HPP
00026 #define __SGL_ANIMATION_HPP
00027
00028 #include <sgl.h>
00029 #include <sglGroup.hpp>
00030
00031
00032
00096
00097
00098 class SGL_DLL_API sglAnimation : public sglGroup
00099 {
00100 public:
00102 enum ModeEnum
00103 {
00105 eCYCLE,
00107 eSWING
00108 };
00109
00111 enum StateEnum
00112 {
00114 eSTART,
00116 ePAUSE,
00118 eRESUME,
00120 eSTOP
00121 };
00122
00123 public:
00125 sglAnimation();
00127 virtual ~sglAnimation();
00128
00139 void setMode(ModeEnum mode) { m_mode = mode; }
00140
00144 ModeEnum getMode() const { return m_mode; }
00145
00155 bool setState(StateEnum state);
00156
00160 StateEnum getState() const { return m_state; }
00161
00177 void setRange(int first_node = 0, int last_node = -1);
00178
00185 void getRange(unsigned int &first_node, unsigned int &last_node) const;
00186
00196 void setSpeed(float speed);
00197
00201 float getSpeed() const;
00202
00212 void setNumCycles(unsigned int num_cycles);
00213
00217 unsigned int getNumCycles() const { return m_num_cycles; }
00218
00219
00220 virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00221
00222 protected:
00223 virtual void computeValues() = 0;
00224
00225 void copyTo(sglAnimation *dst, unsigned int mode) const;
00226
00227 private:
00228 sglAnimation(const sglAnimation &);
00229 sglAnimation &operator=(const sglAnimation &);
00230
00231 protected:
00232 ModeEnum m_mode;
00233 StateEnum m_state;
00234 bool m_state_dirty_flag;
00235
00236 bool m_range_flag;
00237 unsigned int m_first;
00238 unsigned int m_last;
00239
00240 bool m_reverse_flag;
00241 float m_speed;
00242 unsigned int m_num_cycles;
00243 };
00244
00245 #endif