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