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_KEY_FRAME_ANIMATION_HPP
00026 #define __SGL_KEY_FRAME_ANIMATION_HPP
00027
00028 #include <sgl.h>
00029 #include <sglAnimation.hpp>
00030
00031
00032
00063
00064
00065 class SGL_DLL_API sglKeyFrameAnimation : public sglAnimation
00066 {
00067 public:
00069 sglKeyFrameAnimation();
00071 virtual ~sglKeyFrameAnimation();
00072
00073
00074 virtual bool addChild(sglNode *node);
00075 virtual bool insertChild(unsigned int index, sglNode *node);
00076 virtual bool removeChild(sglNode *node);
00077 virtual sglNode *removeChild(unsigned int index);
00078
00079
00086 void setOffsetFrame(unsigned int frame_offset)
00087 { m_frame_offset = frame_offset; }
00088
00092 unsigned int getOffsetFrame() const { return m_frame_offset; }
00093
00102 bool setDuration(sglNode *node, unsigned int num_frames);
00103
00109 unsigned int getDuration(sglNode *node) const;
00110
00118 bool setDuration(unsigned int index, unsigned int num_frames);
00119
00125 unsigned int getDuration(unsigned int index) const;
00126
00127
00128 virtual sglBound::IntersectResultEnum intersect(
00129 sglIntersectf &isector) const;
00130
00131
00132 virtual sglBound::IntersectResultEnum intersect(
00133 sglIntersectd &isector) const;
00134
00135
00136 virtual void pick(sglPickf &pick_state, unsigned int cull_flags) const;
00137
00138
00139 virtual void pick(sglPickd &pick_state, unsigned int cull_flags) const;
00140
00141
00142 virtual void preDraw(const PreDrawStruct &trav_state);
00143
00144
00145 virtual sglNode *clone(unsigned int mode) const;
00146
00147
00148 virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00149
00150 protected:
00151
00152 virtual void cull(sglCull<float> &trav_state,
00153 unsigned int cull_flags) const;
00154
00155
00156 virtual void cull(sglCull<double> &trav_state,
00157 unsigned int cull_flags) const;
00158
00159 virtual void computeValues();
00160 sglNode* computeChild(int frame) const;
00161 sglNode* selectChild(unsigned int current_frame) const;
00162
00163 void copyTo(sglKeyFrameAnimation *dst, unsigned int mode) const;
00164
00165 private:
00166 sglKeyFrameAnimation(const sglKeyFrameAnimation &);
00167 sglKeyFrameAnimation &operator=(const sglKeyFrameAnimation &);
00168
00169 protected:
00170 vector<unsigned int> m_frame_counts;
00171
00172 unsigned int m_start_frame;
00173 unsigned int m_pause_frame;
00174 unsigned int m_frame_offset;
00175
00176
00177 unsigned int m_total_frames;
00178
00179 unsigned int m_total_frames2;
00180 unsigned int m_forward_frames;
00181 unsigned int m_return_frames;
00182 };
00183
00184 #endif