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 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGMATERIALCHUNK_H_
40 #define _OSGMATERIALCHUNK_H_
45 #include "OSGMaterialChunkBase.h"
49 /*! \brief State chunk for material properties. See \ref
50 PageSystemMaterialChunk for a description.
51 \ingroup GrpSystemStateBaseChunks
52 \ingroup GrpLibOSGSystem
56 class OSG_SYSTEM_DLLMAPPING MaterialChunk
: public MaterialChunkBase
58 /*========================== PUBLIC =================================*/
62 /*---------------------------------------------------------------------*/
63 /*! \name Chunk Class Access */
66 virtual const StateChunkClass
*getClass(void) const;
69 /*---------------------------------------------------------------------*/
70 /*! \name Static Chunk Class Access */
73 static UInt32
getStaticClassId(void);
74 static const StateChunkClass
*getStaticClass (void);
77 /*---------------------------------------------------------------------*/
81 virtual UInt16
getChunkId(void);
84 /*---------------------------------------------------------------------*/
88 virtual void changed(ConstFieldMaskArg whichField
,
93 /*---------------------------------------------------------------------*/
97 virtual void dump( UInt32 uiIndent
= 0,
98 const BitVector bvFlags
= 0) const;
101 /*---------------------------------------------------------------------*/
105 virtual void activate (DrawEnv
*action
,
108 virtual void changeFrom (DrawEnv
*action
,
112 virtual void deactivate (DrawEnv
*action
,
115 virtual bool isTransparent(void ) const;
118 /*---------------------------------------------------------------------*/
119 /*! \name Comparison */
122 virtual Real32
switchCost(StateChunk
*chunk
);
124 virtual bool operator < (const StateChunk
&other
) const;
126 virtual bool operator == (const StateChunk
&other
) const;
127 virtual bool operator != (const StateChunk
&other
) const;
130 /*========================= PROTECTED ===============================*/
136 /*---------------------------------------------------------------------*/
140 void onCreate (const MaterialChunk
*source
= NULL
);
141 void onCreateAspect(const MaterialChunk
*createAspect
,
142 const MaterialChunk
*source
= NULL
);
145 /*---------------------------------------------------------------------*/
146 /*! \name Constructors */
150 MaterialChunk(const MaterialChunk
&source
);
153 /*---------------------------------------------------------------------*/
154 /*! \name Destructors */
157 virtual ~MaterialChunk(void);
160 /*---------------------------------------------------------------------*/
164 static void initMethod(InitPhase ePhase
);
168 static volatile UInt16 _uiChunkCounter
;
170 /*========================== PRIVATE ================================*/
174 typedef MaterialChunkBase Inherited
;
176 friend class FieldContainer
;
177 friend class MaterialChunkBase
;
179 // class. Used for indexing in State
180 static StateChunkClass _class
;
182 // prohibit default functions (move to 'public' if you need one)
183 void operator =(const MaterialChunk
&source
);
186 typedef MaterialChunk
*MaterialChunkP
;
190 #include "OSGMaterialChunkBase.inl"
191 #include "OSGMaterialChunk.inl"
193 #endif /* _OSGMATERIALCHUNK_H_ */