Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

StateAttribute.h

Go to the documentation of this file.
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/Object.h"
00018 #include "nvutil/Incarnation.h"
00019 
00020 namespace nvsg
00021 {  
00022   class StateSet;
00023 
00025 
00026   class StateAttribute : public Object
00027   {
00028     public:
00030       NVSG_API virtual const StateAttribute * clone( void ) const = 0;
00031 
00033 
00034       NVSG_API virtual bool isDataShared( void ) const;
00035 
00037 
00038       NVSG_API virtual DataID getDataID( void ) const;
00039 
00041 
00042       NVSG_API const nvutil::Incarnation& getIncarnation( void ) const;
00043 
00045 
00046       NVSG_API size_t getNumberOfParents( void ) const;
00047 
00049 
00050       NVSG_API const StateSet * getParent( size_t index    
00051                                          ) const;
00052 
00054 
00055       NVSG_API virtual bool containsTransparentMaterial( void ) const;
00056 
00058 
00059       NVSG_API virtual void invalidateTransparentMaterialContainment( void );
00060 
00062 
00063       NVSG_API virtual bool containsTransparentTexture( void ) const;
00064 
00066 
00067       NVSG_API virtual void invalidateTransparentTextureContainment( void );
00068 
00069     protected:
00071       NVSG_API StateAttribute( void );
00073       NVSG_API StateAttribute(const StateAttribute& rhs);
00074 
00076       NVSG_API virtual ~StateAttribute( void );
00077 
00078     protected:
00079       nvutil::Incarnation m_incarnation;    
00080 
00081     private:
00082       // A StateAttribute can be the child of more than one parent. 
00083       // The child-to-parent connection is used, for example, for 
00084       // invalidating the parent's transparent Material containment flag.
00085       friend class StateSet;
00086       NVSG_API void addParent( const StateSet * stateSet );
00087       NVSG_API void removeParent( const StateSet * stateSet );
00088 
00089     private:
00090       std::vector<const StateSet*> m_parents;     
00091   };
00092 
00093   inline size_t StateAttribute::getNumberOfParents( void ) const
00094   {
00095     __TRACE();
00096     return( m_parents.size() );
00097   }
00098 
00099   inline const StateSet * StateAttribute::getParent( size_t index ) const
00100   {
00101     __TRACE();
00102     __ASSERT( index < m_parents.size() );   
00103     return( m_parents[index] );
00104   }
00105 
00106   inline const nvutil::Incarnation& StateAttribute::getIncarnation( void ) const
00107   {
00108     __TRACE();
00109     return m_incarnation;
00110   }
00111 
00112 } //  namespace nvsg
00113 

Generated on Tue Mar 1 13:19:20 2005 for NVSGSDK by NVIDIA