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

sglTimedAnimation.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: sglTimedAnimation.hpp
00021  *  Created: 29 May 2001
00022  *  Summary: animation based on frame.
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    // ======== members from sglGroup that need to be augmented =========
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    // see sglNode::intersect(f) for details.
00129    virtual sglBound::IntersectResultEnum intersect(
00130       sglIntersectf &isector) const;
00131 
00132    // see sglNode::intersect(d) for details.
00133    virtual sglBound::IntersectResultEnum intersect(
00134       sglIntersectd &isector) const;
00135 
00136    // see sglNode::pick(f) for details.
00137    virtual void pick(sglPickf &pick_state, unsigned int cull_flags) const;
00138 
00139    // see sglNode::pick(d) for details.
00140    virtual void pick(sglPickd &pick_state, unsigned int cull_flags) const;
00141 
00142    // See sglNode::preDraw() for details
00143    virtual void preDraw(const PreDrawStruct &trav_state);
00144 
00145    // see sglNode::clone() for details.
00146    virtual sglNode *clone(unsigned int mode) const;
00147 
00148    // see sglObject::printInfo() for details.
00149    virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00150 
00151 protected:
00152    // sglNode::cull(f) for details
00153    virtual void cull(sglCull<float> &trav_state,
00154                      unsigned int cull_flags) const;
00155 
00156    // sglNode::cull(d) for details
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 &current_time) const;
00163 
00164    void copyTo(sglTimedAnimation *dst, unsigned int mode) const;
00165 
00166 private:     // not implemented
00167    sglTimedAnimation(const sglTimedAnimation &);
00168    sglTimedAnimation &operator=(const sglTimedAnimation &);
00169 
00170 protected:
00171    vector<float> m_durations;
00172 
00173    sglTimespec   m_start_time;      // time this node was started on
00174    sglTimespec   m_pause_time;      // time this node was paused on
00175    sglTimespec   m_offset_time;     // initial time offset when starting the
00176                                     //   animation
00177    double        m_pause_diff;
00178 
00179    float         m_total_time;
00180 
00181    float         m_total_time2;
00182    float         m_forward_time;    // for internal use during eSWING
00183    float         m_return_time;
00184 };
00185 
00186 #endif

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