added: helper to put chunk override groups in OSG files
[opensg.git] / Source / System / State / Base / OSGMaterialChunk.h
blobd05df1999580d12e8ba891421e5284d30ee1f9f3
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGMATERIALCHUNK_H_
40 #define _OSGMATERIALCHUNK_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGMaterialChunkBase.h"
47 OSG_BEGIN_NAMESPACE
49 /*! \brief State chunk for material properties. See \ref
50 PageSystemMaterialChunk for a description.
51 \ingroup GrpSystemStateBaseChunks
52 \ingroup GrpLibOSGSystem
53 \includebasedoc
56 class OSG_SYSTEM_DLLMAPPING MaterialChunk : public MaterialChunkBase
58 /*========================== PUBLIC =================================*/
60 public:
62 /*---------------------------------------------------------------------*/
63 /*! \name Chunk Class Access */
64 /*! \{ */
66 virtual const StateChunkClass *getClass(void) const;
68 /*! \} */
69 /*---------------------------------------------------------------------*/
70 /*! \name Static Chunk Class Access */
71 /*! \{ */
73 static UInt32 getStaticClassId(void);
74 static const StateChunkClass *getStaticClass (void);
76 /*! \} */
77 /*---------------------------------------------------------------------*/
78 /*! \name Chunk Id */
79 /*! \{ */
81 virtual UInt16 getChunkId(void);
83 /*! \} */
84 /*---------------------------------------------------------------------*/
85 /*! \name Sync */
86 /*! \{ */
88 virtual void changed(ConstFieldMaskArg whichField,
89 UInt32 origin,
90 BitVector details);
92 /*! \} */
93 /*---------------------------------------------------------------------*/
94 /*! \name Output */
95 /*! \{ */
97 virtual void dump( UInt32 uiIndent = 0,
98 const BitVector bvFlags = 0) const;
100 /*! \} */
101 /*---------------------------------------------------------------------*/
102 /*! \name State */
103 /*! \{ */
105 virtual void activate (DrawEnv *action,
106 UInt32 index = 0);
108 virtual void changeFrom (DrawEnv *action,
109 StateChunk *old,
110 UInt32 index = 0);
112 virtual void deactivate (DrawEnv *action,
113 UInt32 index = 0);
115 virtual bool isTransparent(void ) const;
117 /*! \} */
118 /*---------------------------------------------------------------------*/
119 /*! \name Comparison */
120 /*! \{ */
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;
129 /*! \} */
130 /*========================= PROTECTED ===============================*/
132 protected:
134 UInt16 _uiChunkId;
136 /*---------------------------------------------------------------------*/
137 /*! \name Init */
138 /*! \{ */
140 void onCreate (const MaterialChunk *source = NULL);
141 void onCreateAspect(const MaterialChunk *createAspect,
142 const MaterialChunk *source = NULL);
144 /*! \} */
145 /*---------------------------------------------------------------------*/
146 /*! \name Constructors */
147 /*! \{ */
149 MaterialChunk(void);
150 MaterialChunk(const MaterialChunk &source);
152 /*! \} */
153 /*---------------------------------------------------------------------*/
154 /*! \name Destructors */
155 /*! \{ */
157 virtual ~MaterialChunk(void);
159 /*! \} */
160 /*---------------------------------------------------------------------*/
161 /*! \name Init */
162 /*! \{ */
164 static void initMethod(InitPhase ePhase);
166 /*! \} */
168 static volatile UInt16 _uiChunkCounter;
170 /*========================== PRIVATE ================================*/
172 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;
188 OSG_END_NAMESPACE
190 #include "OSGMaterialChunkBase.inl"
191 #include "OSGMaterialChunk.inl"
193 #endif /* _OSGMATERIALCHUNK_H_ */