Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglKeyFrameAnimation.hpp

00001 /*****************************************************************************
00002  * SGL: A Scene Graph Library
00003  *
00004  * Copyright (C) 1997-2001  Scott McMillan   All Rights Reserved.
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the Free
00018  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  *****************************************************************************
00020  *     File: sglKeyFrameAnimation.hpp
00021  *  Created: 29 May 2001
00022  *  Summary: animation based on frame.
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    // ======== members from sglGroup that need to be augmented =========
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    // see sglNode::intersect(f) for details.
00128    virtual sglBound::IntersectResultEnum intersect(
00129       sglIntersectf &isector) const;
00130 
00131    // see sglNode::intersect(d) for details.
00132    virtual sglBound::IntersectResultEnum intersect(
00133       sglIntersectd &isector) const;
00134 
00135    // see sglNode::pick(f) for details.
00136    virtual void pick(sglPickf &pick_state, unsigned int cull_flags) const;
00137 
00138    // see sglNode::pick(d) for details.
00139    virtual void pick(sglPickd &pick_state, unsigned int cull_flags) const;
00140 
00141    // See sglNode::preDraw() for details
00142    virtual void preDraw(const PreDrawStruct &trav_state);
00143 
00144    // see sglNode::clone() for details.
00145    virtual sglNode *clone(unsigned int mode) const;
00146 
00147    // see sglObject::printInfo() for details.
00148    virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00149 
00150 protected:
00151    // sglNode::cull(f) for details
00152    virtual void cull(sglCull<float> &trav_state,
00153                      unsigned int cull_flags) const;
00154 
00155    // sglNode::cull(d) for details
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:     // not implemented
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;      // index of frame this node was started on
00173    unsigned int m_pause_frame;      // index of frame this node was paused on
00174    unsigned int m_frame_offset;     // initial frame offset when starting the
00175                                     //   animation
00176 
00177    unsigned int m_total_frames;     // for internal use during eCYCLE
00178 
00179    unsigned int m_total_frames2;
00180    unsigned int m_forward_frames;   // for internal use during eSWING
00181    unsigned int m_return_frames;
00182 };
00183 
00184 #endif

Generated at Mon Jul 1 18:00:04 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001