00001 // Copyright NVIDIA Corporation 2002-2004 00002 // TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED 00003 // *AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS 00004 // OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY 00005 // AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS 00006 // BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES 00007 // WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, 00008 // BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) 00009 // ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS 00010 // BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 00011 00012 #pragma once 00013 00015 #include "nvsgcommon.h" 00016 00017 #include "nvsg/Animation.h" 00018 #include "nvsg/Transform.h" 00019 00020 namespace nvsg 00021 { 00023 00026 class AnimatedTransform : public Transform 00027 { 00028 public: 00030 00032 NVSG_API static const AnimatedTransform * create( const Animation<nvmath::Trafo> *pAnimation = NULL 00033 ); 00034 00036 00038 NVSG_API static const AnimatedTransform * createFromBase( const Transform &rhs 00039 , const Animation<nvmath::Trafo> *pAnimation = NULL 00040 ); 00041 00043 00044 NVSG_API virtual AnimatedTransform * clone( void ) const; 00045 00047 00048 NVSG_API const Animation<nvmath::Trafo> * getAnimation( void ) const; 00049 00051 00052 NVSG_API void setAnimation( const Animation<nvmath::Trafo> *pAnimation 00053 ); 00054 00056 00057 NVSG_API void setAnimationFrame( size_t frame 00058 ); 00059 00060 //-- Functions reimplemented from Transform -- 00061 NVSG_API virtual void setCenter( const nvmath::Vec3f ¢er ); 00062 NVSG_API virtual void setIdentity( void ); 00063 NVSG_API virtual void setOrientation( const nvmath::Quatf &orientation ); 00064 NVSG_API virtual void setScaling( const nvmath::Vec3f &scaling ); 00065 NVSG_API virtual void setTranslation( const nvmath::Vec3f &translation ); 00066 00067 //-- Functions reimplemented from Node -- 00068 NVSG_API virtual size_t getNumberOfFrames( void ) const; 00069 00070 //-- Functions reimplemented from Object -- 00071 NVSG_API virtual DataID getDataID( void ) const; 00072 NVSG_API virtual bool isDataShared( void ) const; 00073 00074 protected: 00076 NVSG_API AnimatedTransform( const Animation<nvmath::Trafo> *pAnimation ); 00077 00079 NVSG_API AnimatedTransform( const Transform &rhs, const Animation<nvmath::Trafo> *pAnimation ); 00080 00082 NVSG_API AnimatedTransform( const AnimatedTransform& rhs ); 00083 00085 NVSG_API virtual ~AnimatedTransform(void); 00086 00087 private: 00088 AnimatedTransform(); // private default constructor to prevent use 00089 00090 private: 00091 const Animation<nvmath::Trafo> * m_animation; 00092 size_t m_currentFrame; 00093 }; 00094 00095 // - - - - - - - - - - - - - - - - - - - - - - - - - 00096 // inlines 00097 // - - - - - - - - - - - - - - - - - - - - - - - - - 00098 00099 inline const Animation<nvmath::Trafo> * AnimatedTransform::getAnimation( void ) const 00100 { 00101 __TRACE(); 00102 return( m_animation ); 00103 } 00104 00105 } // namespace nvsg