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/Triangles.h" 00019 #include "nvsg/VNVector.h" 00020 00021 namespace nvsg 00022 { 00024 00026 class AnimatedTriangles : public Triangles 00027 { 00028 public: 00030 00032 NVSG_API static const AnimatedTriangles * create( const Animation<VNVector> *pAnimation = NULL 00033 ); 00034 00036 00038 NVSG_API static const AnimatedTriangles * createFromBase( const Triangles &rhs 00039 , const Animation<VNVector> *pAnimation = NULL 00040 ); 00041 00043 00044 NVSG_API virtual const AnimatedTriangles * clone( void ) const; 00045 00047 00048 NVSG_API const Animation<VNVector> * getAnimation( void ) const; 00049 00051 00052 NVSG_API void setAnimation( const Animation<VNVector> *pAnimation 00053 ); 00054 00056 00057 NVSG_API void setAnimationFrame( size_t frame 00058 ); 00059 00060 //-- Functions reimplemented from Drawable -- 00061 NVSG_API virtual size_t getNumberOfFrames( void ) const; 00062 00063 //-- Functions reimplemented from Object -- 00064 NVSG_API virtual DataID getDataID( void ) const; 00065 NVSG_API virtual bool isDataShared( void ) const; 00066 00067 protected: 00069 NVSG_API AnimatedTriangles( const Animation<VNVector> *pAnimation ); 00070 00072 NVSG_API AnimatedTriangles( const Triangles &rhs, const Animation<VNVector> *pAnimation ); 00073 00075 NVSG_API AnimatedTriangles( const AnimatedTriangles &rhs ); 00076 00078 NVSG_API virtual ~AnimatedTriangles(void); 00079 00080 // for some extra work after vertex attribute data has been changed 00081 NVSG_API virtual void onSetVertexAttributeData(void); 00082 00083 private: 00084 AnimatedTriangles(); // private default constructor to prevent use 00085 00086 private: 00088 const Animation<VNVector> * m_animation; 00089 size_t m_currentFrame; 00090 }; 00091 00092 // - - - - - - - - - - - - - - - - - - - - - - - - - 00093 // inlines 00094 // - - - - - - - - - - - - - - - - - - - - - - - - - 00095 00096 inline const Animation<VNVector> * AnimatedTriangles::getAnimation( void ) const 00097 { 00098 __TRACE(); 00099 return( m_animation ); 00100 } 00101 00102 } // namespace nvsg