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 "nvmath/Trafo.h" 00018 #include "nvsg/Group.h" 00019 00020 namespace nvsg 00021 { 00022 00024 00027 class Transform : public Group 00028 { 00029 public: 00031 00032 NVSG_API static const Transform * create( void ); 00033 00035 00036 NVSG_API static const Transform * createFromBase( const Group &rhs ); 00037 00039 00040 NVSG_API virtual const Transform * clone( void ) const; 00041 00043 00044 NVSG_API virtual bool isDataShared( void ) const; 00045 00047 00048 NVSG_API virtual DataID getDataID( void ) const; 00049 00051 00052 nvmath::Mat44f getInverse( void ) const; 00053 00055 00056 const nvmath::Vec3f & getCenter( void ) const; 00057 00059 00060 const nvmath::Quatf & getOrientation( void ) const; 00061 00063 00064 const nvmath::Vec3f & getScaling( void ) const; 00065 00067 00068 nvmath::Mat44f getMatrix( void ) const; 00069 00071 00072 const nvmath::Vec3f & getTranslation( void ) const; 00073 00075 00076 NVSG_API bool isIdentity( void ) const; 00077 00079 NVSG_API virtual void setCenter( const nvmath::Vec3f ¢er 00080 ); 00081 00083 NVSG_API virtual void setIdentity( void ); 00084 00086 NVSG_API virtual void setOrientation( const nvmath::Quatf &orientation 00087 ); 00088 00090 NVSG_API virtual void setScaling( const nvmath::Vec3f &scaling 00091 ); 00092 00094 NVSG_API virtual void setTranslation( const nvmath::Vec3f &translation 00095 00096 ); 00097 00098 protected: 00100 NVSG_API Transform(void); 00101 00103 NVSG_API Transform( const Group &rhs ); 00104 00106 NVSG_API Transform( const Transform &rhs ); 00107 00109 NVSG_API virtual ~Transform(void); 00110 00112 00114 NVSG_API virtual bool calcBoundingSphere( void ) const; 00115 00116 private: 00117 nvmath::Trafo m_trafo; 00118 }; 00119 00120 inline nvmath::Mat44f Transform::getInverse( void ) const 00121 { 00122 return( m_trafo.getInverse() ); 00123 } 00124 00125 inline const nvmath::Vec3f & Transform::getCenter( void ) const 00126 { 00127 return( m_trafo.getCenter() ); 00128 } 00129 00130 inline const nvmath::Quatf & Transform::getOrientation( void ) const 00131 { 00132 return( m_trafo.getOrientation() ); 00133 } 00134 00135 inline const nvmath::Vec3f & Transform::getScaling( void ) const 00136 { 00137 return( m_trafo.getScaling() ); 00138 } 00139 00140 inline nvmath::Mat44f Transform::getMatrix( void ) const 00141 { 00142 return( m_trafo.getMatrix() ); 00143 } 00144 00145 inline const nvmath::Vec3f & Transform::getTranslation( void ) const 00146 { 00147 return( m_trafo.getTranslation() ); 00148 } 00149 00150 inline bool Transform::isIdentity( void ) const 00151 { 00152 return( nvmath::isIdentity( m_trafo.getMatrix() ) ); 00153 } 00154 }