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_TIMED_ANIMATION_HPP
00026 #define __SGL_TIMED_ANIMATION_HPP
00027
00028 #include <sgl.h>
00029 #include <sglTimespec.hpp>
00030 #include <sglAnimation.hpp>
00031
00032
00033
00065
00066
00067 class SGL_DLL_API sglTimedAnimation : public sglAnimation
00068 {
00069 public:
00071 sglTimedAnimation();
00073 virtual ~sglTimedAnimation();
00074
00075
00076 virtual bool addChild(sglNode *node);
00077 virtual bool insertChild(unsigned int index, sglNode *node);
00078 virtual bool removeChild(sglNode *node);
00079 virtual sglNode *removeChild(unsigned int index);
00080
00081
00088 void setOffsetTime(const sglTimespec &offset_time);
00089
00093 const sglTimespec &getOffsetTime() const { return m_offset_time; }
00094
00103 bool setDuration(sglNode *node, float sec);
00104
00110 float getDuration(sglNode *node) const;
00111
00119 bool setDuration(unsigned int index, float sec);
00120
00126 float getDuration(unsigned int index) const;
00127
00128
00129 virtual sglBound::IntersectResultEnum intersect(
00130 sglIntersectf &isector) const;
00131
00132
00133 virtual sglBound::IntersectResultEnum intersect(
00134 sglIntersectd &isector) const;
00135
00136
00137 virtual void pick(sglPickf &pick_state, unsigned int cull_flags) const;
00138
00139
00140 virtual void pick(sglPickd &pick_state, unsigned int cull_flags) const;
00141
00142
00143 virtual void preDraw(const PreDrawStruct &trav_state);
00144
00145
00146 virtual sglNode *clone(unsigned int mode) const;
00147
00148
00149 virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00150
00151 protected:
00152
00153 virtual void cull(sglCull<float> &trav_state,
00154 unsigned int cull_flags) const;
00155
00156
00157 virtual void cull(sglCull<double> &trav_state,
00158 unsigned int cull_flags) const;
00159
00160 virtual void computeValues();
00161 sglNode* computeChild(double atime) const;
00162 sglNode* selectChild(const sglTimespec ¤t_time) const;
00163
00164 void copyTo(sglTimedAnimation *dst, unsigned int mode) const;
00165
00166 private:
00167 sglTimedAnimation(const sglTimedAnimation &);
00168 sglTimedAnimation &operator=(const sglTimedAnimation &);
00169
00170 protected:
00171 vector<float> m_durations;
00172
00173 sglTimespec m_start_time;
00174 sglTimespec m_pause_time;
00175 sglTimespec m_offset_time;
00176
00177 double m_pause_diff;
00178
00179 float m_total_time;
00180
00181 float m_total_time2;
00182 float m_forward_time;
00183 float m_return_time;
00184 };
00185
00186 #endif