1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
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 /*****************************************************************************\
40 *****************************************************************************
42 ** This file is automatically generated. **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
47 ** Do not change this file, changes should be done in the derived **
48 ** class SimpleMaterial
50 *****************************************************************************
51 \*****************************************************************************/
54 #ifndef _OSGSIMPLEMATERIALBASE_H_
55 #define _OSGSIMPLEMATERIALBASE_H_
61 #include "OSGConfig.h"
62 #include "OSGSystemDef.h"
64 //#include "OSGBaseTypes.h"
66 #include "OSGChunkMaterial.h" // Parent
68 #include "OSGBaseFields.h" // Ambient type
69 #include "OSGSysFields.h" // Shininess type
71 #include "OSGSimpleMaterialFields.h"
78 //! \brief SimpleMaterial Base Class.
80 class OSG_SYSTEM_DLLMAPPING SimpleMaterialBase
: public ChunkMaterial
84 typedef ChunkMaterial Inherited
;
85 typedef ChunkMaterial ParentContainer
;
87 typedef Inherited::TypeObject TypeObject
;
88 typedef TypeObject::InitPhase InitPhase
;
90 OSG_GEN_INTERNALPTR(SimpleMaterial
);
92 /*========================== PUBLIC =================================*/
98 AmbientFieldId
= Inherited::NextFieldId
,
99 DiffuseFieldId
= AmbientFieldId
+ 1,
100 SpecularFieldId
= DiffuseFieldId
+ 1,
101 ShininessFieldId
= SpecularFieldId
+ 1,
102 EmissionFieldId
= ShininessFieldId
+ 1,
103 TransparencyFieldId
= EmissionFieldId
+ 1,
104 LitFieldId
= TransparencyFieldId
+ 1,
105 ColorMaterialFieldId
= LitFieldId
+ 1,
106 NextFieldId
= ColorMaterialFieldId
+ 1
109 static const OSG::BitVector AmbientFieldMask
=
110 (TypeTraits
<BitVector
>::One
<< AmbientFieldId
);
111 static const OSG::BitVector DiffuseFieldMask
=
112 (TypeTraits
<BitVector
>::One
<< DiffuseFieldId
);
113 static const OSG::BitVector SpecularFieldMask
=
114 (TypeTraits
<BitVector
>::One
<< SpecularFieldId
);
115 static const OSG::BitVector ShininessFieldMask
=
116 (TypeTraits
<BitVector
>::One
<< ShininessFieldId
);
117 static const OSG::BitVector EmissionFieldMask
=
118 (TypeTraits
<BitVector
>::One
<< EmissionFieldId
);
119 static const OSG::BitVector TransparencyFieldMask
=
120 (TypeTraits
<BitVector
>::One
<< TransparencyFieldId
);
121 static const OSG::BitVector LitFieldMask
=
122 (TypeTraits
<BitVector
>::One
<< LitFieldId
);
123 static const OSG::BitVector ColorMaterialFieldMask
=
124 (TypeTraits
<BitVector
>::One
<< ColorMaterialFieldId
);
125 static const OSG::BitVector NextFieldMask
=
126 (TypeTraits
<BitVector
>::One
<< NextFieldId
);
128 typedef SFColor3f SFAmbientType
;
129 typedef SFColor3f SFDiffuseType
;
130 typedef SFColor3f SFSpecularType
;
131 typedef SFReal32 SFShininessType
;
132 typedef SFColor3f SFEmissionType
;
133 typedef SFReal32 SFTransparencyType
;
134 typedef SFBool SFLitType
;
135 typedef SFGLenum SFColorMaterialType
;
137 /*---------------------------------------------------------------------*/
138 /*! \name Class Get */
141 static FieldContainerType
&getClassType (void);
142 static UInt32
getClassTypeId (void);
143 static UInt16
getClassGroupId(void);
146 /*---------------------------------------------------------------------*/
147 /*! \name FieldContainer Get */
150 virtual FieldContainerType
&getType (void);
151 virtual const FieldContainerType
&getType (void) const;
153 virtual UInt32
getContainerSize(void) const;
156 /*---------------------------------------------------------------------*/
157 /*! \name Field Get */
161 SFColor3f
*editSFAmbient (void);
162 const SFColor3f
*getSFAmbient (void) const;
164 SFColor3f
*editSFDiffuse (void);
165 const SFColor3f
*getSFDiffuse (void) const;
167 SFColor3f
*editSFSpecular (void);
168 const SFColor3f
*getSFSpecular (void) const;
170 SFReal32
*editSFShininess (void);
171 const SFReal32
*getSFShininess (void) const;
173 SFColor3f
*editSFEmission (void);
174 const SFColor3f
*getSFEmission (void) const;
176 SFReal32
*editSFTransparency (void);
177 const SFReal32
*getSFTransparency (void) const;
179 SFBool
*editSFLit (void);
180 const SFBool
*getSFLit (void) const;
182 SFGLenum
*editSFColorMaterial (void);
183 const SFGLenum
*getSFColorMaterial (void) const;
186 Color3f
&editAmbient (void);
187 const Color3f
&getAmbient (void) const;
189 Color3f
&editDiffuse (void);
190 const Color3f
&getDiffuse (void) const;
192 Color3f
&editSpecular (void);
193 const Color3f
&getSpecular (void) const;
195 Real32
&editShininess (void);
196 Real32
getShininess (void) const;
198 Color3f
&editEmission (void);
199 const Color3f
&getEmission (void) const;
201 Real32
&editTransparency (void);
202 Real32
getTransparency (void) const;
204 bool &editLit (void);
205 bool getLit (void) const;
207 GLenum
&editColorMaterial (void);
208 const GLenum
&getColorMaterial (void) const;
211 /*---------------------------------------------------------------------*/
212 /*! \name Field Set */
215 void setAmbient (const Color3f
&value
);
216 void setDiffuse (const Color3f
&value
);
217 void setSpecular (const Color3f
&value
);
218 void setShininess (const Real32 value
);
219 void setEmission (const Color3f
&value
);
220 void setTransparency (const Real32 value
);
221 void setLit (const bool value
);
222 void setColorMaterial (const GLenum
&value
);
225 /*---------------------------------------------------------------------*/
226 /*! \name Ptr MField Set */
230 /*---------------------------------------------------------------------*/
231 /*! \name Binary Access */
234 virtual SizeT
getBinSize (ConstFieldMaskArg whichField
);
235 virtual void copyToBin (BinaryDataHandler
&pMem
,
236 ConstFieldMaskArg whichField
);
237 virtual void copyFromBin(BinaryDataHandler
&pMem
,
238 ConstFieldMaskArg whichField
);
242 /*---------------------------------------------------------------------*/
243 /*! \name Construction */
246 static SimpleMaterialTransitPtr
create (void);
247 static SimpleMaterial
*createEmpty (void);
249 static SimpleMaterialTransitPtr
createLocal (
250 BitVector bFlags
= FCLocal::All
);
252 static SimpleMaterial
*createEmptyLocal(
253 BitVector bFlags
= FCLocal::All
);
255 static SimpleMaterialTransitPtr
createDependent (BitVector bFlags
);
258 /*---------------------------------------------------------------------*/
262 virtual FieldContainerTransitPtr
shallowCopy (void) const;
263 virtual FieldContainerTransitPtr
shallowCopyLocal(
264 BitVector bFlags
= FCLocal::All
) const;
265 virtual FieldContainerTransitPtr
shallowCopyDependent(
266 BitVector bFlags
) const;
269 /*========================= PROTECTED ===============================*/
273 static TypeObject _type
;
275 static void classDescInserter(TypeObject
&oType
);
276 static const Char8
*getClassname (void );
278 /*---------------------------------------------------------------------*/
282 SFColor3f _sfAmbient
;
283 SFColor3f _sfDiffuse
;
284 SFColor3f _sfSpecular
;
285 SFReal32 _sfShininess
;
286 SFColor3f _sfEmission
;
287 SFReal32 _sfTransparency
;
289 SFGLenum _sfColorMaterial
;
292 /*---------------------------------------------------------------------*/
293 /*! \name Constructors */
296 SimpleMaterialBase(void);
297 SimpleMaterialBase(const SimpleMaterialBase
&source
);
300 /*---------------------------------------------------------------------*/
301 /*! \name Destructors */
304 virtual ~SimpleMaterialBase(void);
307 /*---------------------------------------------------------------------*/
308 /*! \name onCreate */
313 /*---------------------------------------------------------------------*/
314 /*! \name Generic Field Access */
317 GetFieldHandlePtr
getHandleAmbient (void) const;
318 EditFieldHandlePtr
editHandleAmbient (void);
319 GetFieldHandlePtr
getHandleDiffuse (void) const;
320 EditFieldHandlePtr
editHandleDiffuse (void);
321 GetFieldHandlePtr
getHandleSpecular (void) const;
322 EditFieldHandlePtr
editHandleSpecular (void);
323 GetFieldHandlePtr
getHandleShininess (void) const;
324 EditFieldHandlePtr
editHandleShininess (void);
325 GetFieldHandlePtr
getHandleEmission (void) const;
326 EditFieldHandlePtr
editHandleEmission (void);
327 GetFieldHandlePtr
getHandleTransparency (void) const;
328 EditFieldHandlePtr
editHandleTransparency (void);
329 GetFieldHandlePtr
getHandleLit (void) const;
330 EditFieldHandlePtr
editHandleLit (void);
331 GetFieldHandlePtr
getHandleColorMaterial (void) const;
332 EditFieldHandlePtr
editHandleColorMaterial (void);
335 /*---------------------------------------------------------------------*/
339 #ifdef OSG_MT_CPTR_ASPECT
340 virtual void execSyncV( FieldContainer
&oFrom
,
341 ConstFieldMaskArg whichField
,
342 AspectOffsetStore
&oOffsets
,
343 ConstFieldMaskArg syncMode
,
344 const UInt32 uiSyncInfo
);
346 void execSync ( SimpleMaterialBase
*pFrom
,
347 ConstFieldMaskArg whichField
,
348 AspectOffsetStore
&oOffsets
,
349 ConstFieldMaskArg syncMode
,
350 const UInt32 uiSyncInfo
);
354 /*---------------------------------------------------------------------*/
359 /*---------------------------------------------------------------------*/
360 /*! \name Aspect Create */
363 #ifdef OSG_MT_CPTR_ASPECT
364 virtual FieldContainer
*createAspectCopy(
365 const FieldContainer
*pRefAspect
) const;
369 /*---------------------------------------------------------------------*/
373 /*---------------------------------------------------------------------*/
377 virtual void resolveLinks(void);
380 /*========================== PRIVATE ================================*/
383 /*---------------------------------------------------------------------*/
385 // prohibit default functions (move to 'public' if you need one)
386 void operator =(const SimpleMaterialBase
&source
);
389 typedef SimpleMaterialBase
*SimpleMaterialBaseP
;
393 #endif /* _OSGSIMPLEMATERIALBASE_H_ */