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

sglAnimation.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: sglAnimation.hpp
00021  *  Created: 29 May 2001
00022  *  Summary: abstract base class for all animation classes.
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    // see sglObject::printInfo() for details
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:    // not implemented
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;  // need separate 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

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