fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Material / Base / OSGVariantMaterial.h
blobfc39afa88984a7ff96bd5158d603ddb18c3b4c4e
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 \*---------------------------------------------------------------------------*/
40 #ifndef _OSGVARIANTMATERIAL_H_
41 #define _OSGVARIANTMATERIAL_H_
42 #ifdef __sgi
43 #pragma once
44 #endif
46 #include "OSGPrimeMaterial.h"
47 #include "OSGVariantMaterialBase.h"
48 #include "OSGMapCacheHandlerMixin.h"
50 OSG_BEGIN_NAMESPACE
52 class VariantMaterial;
54 /*! \ingroup GrpSystemMaterialBase
55 \nohierarchy
58 struct VarMatMapCache
60 typedef VariantMaterialBase ParentT;
61 typedef VariantMaterial FinalContainer;
63 typedef SFMaterialPtrMap MapCacheField;
64 typedef MapCacheField::StoredType MapCache;
65 typedef SFMaterialPtrMap::EditHandle::KeyPool MapKeyPool;
67 typedef MapCache::mapped_type MapCacheElement;
68 typedef MapCache::key_type MapCacheKey;
70 typedef PrimeMaterial FinalizedElement;
72 static const bool IsInternal = false;
74 static void setFallback(ParentT *pContainer, MapCacheElement pElem)
76 pContainer->setFallbackMaterial(pElem);
79 static MapCacheElement getFallback(ParentT *pContainer)
81 return pContainer->getFallbackMaterial();
84 static const Char8 *getFieldName(void)
86 return "materialStore";
90 /*! \brief Material using variant set. See \ref
91 PageSystemMaterialVariantMaterial for a description.
92 \ingroup GrpSystemMaterialBase
93 \ingroup GrpLibOSGSystem
94 \includebasedoc
97 class OSG_SYSTEM_DLLMAPPING VariantMaterial :
98 public MapCacheHandlerMixin<VarMatMapCache>
100 /*========================== PUBLIC =================================*/
102 public:
104 typedef MapCacheHandlerMixin<VarMatMapCache> Inherited;
105 typedef VariantMaterial Self;
107 /*---------------------------------------------------------------------*/
108 /*! \name Sync */
109 /*! \{ */
111 virtual void changed(ConstFieldMaskArg whichField,
112 UInt32 origin,
113 BitVector detail);
115 /*! \} */
116 /*---------------------------------------------------------------------*/
117 /*! \name Get */
118 /*! \{ */
120 virtual PrimeMaterial *finalize( MapCacheKey oKey,
121 const StateOverride *pOverrides,
122 Window *pWin );
124 /*! \} */
125 /*---------------------------------------------------------------------*/
126 /*! \name Set */
127 /*! \{ */
129 void addMaterial(PrimeMaterial * const materialP,
130 MaterialMapKey key = 0);
132 void subMaterial(MaterialMapKey key = 0);
134 /*! \} */
135 /*---------------------------------------------------------------------*/
136 /*! \name Set */
137 /*! \{ */
139 PrimeMaterial *findMaterial(MaterialMapKey key) const;
141 /*! \} */
142 /*---------------------------------------------------------------------*/
143 /*! \name Set */
144 /*! \{ */
146 virtual bool isTransparent(void) const;
148 /*! \} */
149 /*---------------------------------------------------------------------*/
150 /*! \name your_category */
151 /*! \{ */
153 const SFMaterialPtrMap *getSFMaterialStore(void) const;
155 /*! \} */
156 /*---------------------------------------------------------------------*/
157 /*! \name Output */
158 /*! \{ */
160 virtual void dump( UInt32 uiIndent = 0,
161 const BitVector bvFlags = 0) const;
163 /*! \} */
164 /*---------------------------------------------------------------------*/
165 /*! \name Rendering */
166 /*! \{ */
168 /*! \} */
169 /*---------------------------------------------------------------------*/
170 /*! \name Access */
171 /*! \{ */
173 /*! \} */
174 /*---------------------------------------------------------------------*/
175 /*! \name Find */
176 /*! \{ */
178 /*! \} */
179 /*---------------------------------------------------------------------*/
180 /*! \name Find */
181 /*! \{ */
183 /*! \} */
184 /*---------------------------------------------------------------------*/
185 /*! \name Find */
186 /*! \{ */
188 /*! \} */
189 /*---------------------------------------------------------------------*/
190 /*! \name Find */
191 /*! \{ */
193 #if 0
194 virtual bool operator == (const VariantMaterial &other) const;
195 #endif
197 /*! \} */
198 /*========================= PROTECTED ===============================*/
200 protected:
202 typedef SFMaterialPtrMap::StoredType MaterialPtrMap;
203 typedef MaterialPtrMap ::iterator MaterialPtrMapIt;
204 typedef MaterialPtrMap ::const_iterator MaterialPtrMapConstIt;
206 typedef SFMaterialPtrMap::EditHandle::KeyPool MapKeyPool;
208 /*---------------------------------------------------------------------*/
209 /*! \name Type information */
210 /*! \{ */
212 static void classDescInserter(TypeObject &oType);
214 /*! \} */
215 /*---------------------------------------------------------------------*/
216 /*! \name Fields */
217 /*! \{ */
219 /*! \} */
220 /*---------------------------------------------------------------------*/
221 /*! \name Constructors */
222 /*! \{ */
224 VariantMaterial(void);
225 VariantMaterial(const VariantMaterial &source);
227 /*! \} */
228 /*---------------------------------------------------------------------*/
229 /*! \name Destructor */
230 /*! \{ */
232 virtual ~VariantMaterial(void);
234 /*! \} */
235 /*---------------------------------------------------------------------*/
236 /*! \name Changed */
237 /*! \{ */
239 /*! \} */
240 /*---------------------------------------------------------------------*/
241 /*! \name MT Destruction */
242 /*! \{ */
244 /*! \} */
245 /*---------------------------------------------------------------------*/
246 /*! \name Init */
247 /*! \{ */
249 static void initMethod(InitPhase ePhase);
251 /*! \} */
252 /*---------------------------------------------------------------------*/
253 /*! \name Ptr MField Set */
254 /*! \{ */
256 /*! \} */
257 /*---------------------------------------------------------------------*/
258 /*! \name Destructor */
259 /*! \{ */
261 /*! \} */
262 /*========================== PRIVATE ================================*/
264 private:
266 friend class FieldContainer;
267 friend class VariantMaterialBase;
269 // prohibit default functions (move to 'public' if you need one)
270 void operator =(const VariantMaterial &source);
273 typedef VariantMaterial *VariantMaterialP;
275 OSG_END_NAMESPACE
277 #include "OSGVariantMaterialBase.inl"
278 #include "OSGVariantMaterial.inl"
280 #endif /* _OSGVARIANTMATERIAL_H_ */