00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #pragma once
00013
00015 #include "nvsgcommon.h"
00016
00017 #include "nvsg/Object.h"
00018
00019
00020 namespace nvmath
00021 {
00022 class Sphere3f;
00023 }
00024 namespace nvsg
00025 {
00026 class GeoNode;
00027 }
00028
00029 namespace nvsg
00030 {
00032
00033 class Drawable : public Object
00034 {
00035 public:
00036
00038 NVSG_API virtual const Drawable * clone( void ) const = 0;
00039
00041
00043 NVSG_API virtual bool isBoundingSphereValid( void ) const = 0;
00044
00046
00050 NVSG_API virtual const nvmath::Sphere3f & getBoundingSphere( void ) const = 0;
00051
00053 NVSG_API void invalidateNumberOfFrames( void ) const;
00054
00056
00057 NVSG_API virtual size_t getNumberOfFrames( void ) const;
00058
00060
00061 NVSG_API size_t getNumberOfOwners( void ) const;
00062
00064
00065 NVSG_API const GeoNode * getOwner( size_t index
00066 ) const;
00067
00068
00069 NVSG_API virtual DataID getDataID( void ) const;
00070 NVSG_API virtual bool isDataShared( void ) const;
00071
00072 protected:
00074 NVSG_API Drawable( void );
00075
00076 NVSG_API Drawable( const Drawable& );
00077
00079 NVSG_API virtual ~Drawable( void );
00080
00082 NVSG_API virtual void invalidateBoundingSphere( void ) const;
00083
00084 private:
00085
00086
00087
00088 friend class GeoNode;
00089 void addOwner( const GeoNode * node );
00090 void removeOwner( const GeoNode * node );
00091
00092 private:
00093 std::vector<const GeoNode*> m_owners;
00094 };
00095
00096 inline size_t Drawable::getNumberOfOwners( void ) const
00097 {
00098 __TRACE();
00099 return( m_owners.size() );
00100 }
00101
00102 inline const GeoNode * Drawable::getOwner( size_t index ) const
00103 {
00104 __TRACE();
00105 __ASSERT( index < m_owners.size() );
00106 return( m_owners[index] );
00107 }
00108 }
00109