1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
40 #ifndef _OSGMATERIAL_H_
41 #define _OSGMATERIAL_H_
46 #include "OSGConfig.h"
47 #include "OSGAction.h"
48 #include "OSGMaterialBase.h"
50 #include "OSGMaterialMapFields.h"
55 class MaterialDrawable
;
61 class MapCacheHandlerMixin
;
63 /*! \brief Abstract Material base class. See \ref PageSystemMaterial for a
66 \ingroup GrpSystemMaterialBase
67 \ingroup GrpLibOSGSystem
71 class OSG_SYSTEM_DLLMAPPING Material
: public MaterialBase
73 /*========================== PUBLIC =================================*/
76 /*---------------------------------------------------------------------*/
77 /*! \name Constants */
80 static const Int32 NoStateSorting
;
81 static const Int32 TransparencyAutoDetection
;
82 static const Int32 TransparencyForceTransparent
;
83 static const Int32 TransparencyForceOpaque
;
86 /*---------------------------------------------------------------------*/
90 virtual void changed(ConstFieldMaskArg whichField
,
95 /*---------------------------------------------------------------------*/
99 virtual void dump( UInt32 uiIndent
= 0,
100 const BitVector bvFlags
= 0) const;
103 /*---------------------------------------------------------------------*/
104 /*! \name Rendering */
108 PrimeMaterial
*finalize ( MaterialMapKey oKey
,
109 const StateOverride
*pOverrides
,
112 bool isTransparent( void ) const = 0;
115 /*---------------------------------------------------------------------*/
116 /*! \name Comparison */
119 virtual Action::ResultE
renderEnter(NodeCore
* const pCore
,
122 virtual Action::ResultE
renderLeave(NodeCore
* const pCore
,
126 /*---------------------------------------------------------------------*/
127 /*! \name Comparison */
131 virtual bool operator < (const Material
&other
) const;
133 virtual bool operator == (const Material
&other
) const;
134 virtual bool operator != (const Material
&other
) const;
138 /*========================= PROTECTED ===============================*/
142 /*---------------------------------------------------------------------*/
143 /*! \name Constructors */
147 Material(const Material
&source
);
150 /*---------------------------------------------------------------------*/
151 /*! \name Destructors */
154 virtual ~Material(void);
157 /*---------------------------------------------------------------------*/
161 static void initMethod(InitPhase ePhase
);
164 /*---------------------------------------------------------------------*/
168 virtual void resolveLinks(void);
171 /*========================== PRIVATE ================================*/
175 typedef MaterialBase Inherited
;
177 friend class FieldContainer
;
178 friend class MaterialBase
;
180 template <class Desc
>
181 friend class MapCacheHandlerMixin
;
183 // prohibit default functions (move to 'public' if you need one)
184 void operator =(const Material
&source
);
187 typedef Material
*MaterialP
;
189 /*---------------------------------------------------------------------*/
190 /*! \name Material Access */
193 /*! \ingroup GrpSystemFunctions
196 OSG_SYSTEM_DLLMAPPING PrimeMaterial
*getDefaultMaterial (void);
198 /*! \ingroup GrpSystemFunctions
201 OSG_SYSTEM_DLLMAPPING PrimeMaterial
*getDefaultUnlitMaterial(void);
204 /*---------------------------------------------------------------------*/
208 #include "OSGMaterialBase.inl"
209 #include "OSGMaterial.inl"
211 #endif /* _OSGMATERIAL_H_ */