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 **
50 *****************************************************************************
51 \*****************************************************************************/
54 #ifndef _OSGLIGHTBASE_H_
55 #define _OSGLIGHTBASE_H_
61 #include "OSGConfig.h"
62 #include "OSGSystemDef.h"
64 //#include "OSGBaseTypes.h"
66 #include "OSGGroup.h" // Parent
68 #include "OSGBaseFields.h" // Ambient type
69 #include "OSGNodeFields.h" // Beacon type
70 #include "OSGSysFields.h" // On type
71 #include "OSGLightEngineFields.h" // LightEngine type
73 #include "OSGLightFields.h"
80 //! \brief Light Base Class.
82 class OSG_SYSTEM_DLLMAPPING LightBase
: public Group
86 typedef Group Inherited
;
87 typedef Group ParentContainer
;
89 typedef Inherited::TypeObject TypeObject
;
90 typedef TypeObject::InitPhase InitPhase
;
92 OSG_GEN_INTERNALPTR(Light
);
94 /*========================== PUBLIC =================================*/
100 AmbientFieldId
= Inherited::NextFieldId
,
101 DiffuseFieldId
= AmbientFieldId
+ 1,
102 SpecularFieldId
= DiffuseFieldId
+ 1,
103 BeaconFieldId
= SpecularFieldId
+ 1,
104 OnFieldId
= BeaconFieldId
+ 1,
105 ConstantAttenuationFieldId
= OnFieldId
+ 1,
106 LinearAttenuationFieldId
= ConstantAttenuationFieldId
+ 1,
107 QuadraticAttenuationFieldId
= LinearAttenuationFieldId
+ 1,
108 LightEngineFieldId
= QuadraticAttenuationFieldId
+ 1,
109 ShadowIntensityFieldId
= LightEngineFieldId
+ 1,
110 ShadowModeFieldId
= ShadowIntensityFieldId
+ 1,
111 NextFieldId
= ShadowModeFieldId
+ 1
114 static const OSG::BitVector AmbientFieldMask
=
115 (TypeTraits
<BitVector
>::One
<< AmbientFieldId
);
116 static const OSG::BitVector DiffuseFieldMask
=
117 (TypeTraits
<BitVector
>::One
<< DiffuseFieldId
);
118 static const OSG::BitVector SpecularFieldMask
=
119 (TypeTraits
<BitVector
>::One
<< SpecularFieldId
);
120 static const OSG::BitVector BeaconFieldMask
=
121 (TypeTraits
<BitVector
>::One
<< BeaconFieldId
);
122 static const OSG::BitVector OnFieldMask
=
123 (TypeTraits
<BitVector
>::One
<< OnFieldId
);
124 static const OSG::BitVector ConstantAttenuationFieldMask
=
125 (TypeTraits
<BitVector
>::One
<< ConstantAttenuationFieldId
);
126 static const OSG::BitVector LinearAttenuationFieldMask
=
127 (TypeTraits
<BitVector
>::One
<< LinearAttenuationFieldId
);
128 static const OSG::BitVector QuadraticAttenuationFieldMask
=
129 (TypeTraits
<BitVector
>::One
<< QuadraticAttenuationFieldId
);
130 static const OSG::BitVector LightEngineFieldMask
=
131 (TypeTraits
<BitVector
>::One
<< LightEngineFieldId
);
132 static const OSG::BitVector ShadowIntensityFieldMask
=
133 (TypeTraits
<BitVector
>::One
<< ShadowIntensityFieldId
);
134 static const OSG::BitVector ShadowModeFieldMask
=
135 (TypeTraits
<BitVector
>::One
<< ShadowModeFieldId
);
136 static const OSG::BitVector NextFieldMask
=
137 (TypeTraits
<BitVector
>::One
<< NextFieldId
);
139 typedef SFColor4f SFAmbientType
;
140 typedef SFColor4f SFDiffuseType
;
141 typedef SFColor4f SFSpecularType
;
142 typedef SFWeakNodePtr SFBeaconType
;
143 typedef SFBool SFOnType
;
144 typedef SFReal32 SFConstantAttenuationType
;
145 typedef SFReal32 SFLinearAttenuationType
;
146 typedef SFReal32 SFQuadraticAttenuationType
;
147 typedef SFUnrecLightEnginePtr SFLightEngineType
;
148 typedef SFReal32 SFShadowIntensityType
;
149 typedef SFUInt32 SFShadowModeType
;
151 /*---------------------------------------------------------------------*/
152 /*! \name Class Get */
155 static FieldContainerType
&getClassType (void);
156 static UInt32
getClassTypeId (void);
157 static UInt16
getClassGroupId(void);
160 /*---------------------------------------------------------------------*/
161 /*! \name FieldContainer Get */
164 virtual FieldContainerType
&getType (void);
165 virtual const FieldContainerType
&getType (void) const;
167 virtual UInt32
getContainerSize(void) const;
170 /*---------------------------------------------------------------------*/
171 /*! \name Field Get */
175 SFColor4f
*editSFAmbient (void);
176 const SFColor4f
*getSFAmbient (void) const;
178 SFColor4f
*editSFDiffuse (void);
179 const SFColor4f
*getSFDiffuse (void) const;
181 SFColor4f
*editSFSpecular (void);
182 const SFColor4f
*getSFSpecular (void) const;
183 const SFWeakNodePtr
*getSFBeacon (void) const;
184 SFWeakNodePtr
*editSFBeacon (void);
186 SFBool
*editSFOn (void);
187 const SFBool
*getSFOn (void) const;
189 SFReal32
*editSFConstantAttenuation(void);
190 const SFReal32
*getSFConstantAttenuation (void) const;
192 SFReal32
*editSFLinearAttenuation(void);
193 const SFReal32
*getSFLinearAttenuation (void) const;
195 SFReal32
*editSFQuadraticAttenuation(void);
196 const SFReal32
*getSFQuadraticAttenuation (void) const;
197 const SFUnrecLightEnginePtr
*getSFLightEngine (void) const;
198 SFUnrecLightEnginePtr
*editSFLightEngine (void);
200 SFReal32
*editSFShadowIntensity(void);
201 const SFReal32
*getSFShadowIntensity (void) const;
203 SFUInt32
*editSFShadowMode (void);
204 const SFUInt32
*getSFShadowMode (void) const;
207 Color4f
&editAmbient (void);
208 const Color4f
&getAmbient (void) const;
210 Color4f
&editDiffuse (void);
211 const Color4f
&getDiffuse (void) const;
213 Color4f
&editSpecular (void);
214 const Color4f
&getSpecular (void) const;
216 Node
* getBeacon (void) const;
219 bool getOn (void) const;
221 Real32
&editConstantAttenuation(void);
222 Real32
getConstantAttenuation (void) const;
224 Real32
&editLinearAttenuation(void);
225 Real32
getLinearAttenuation (void) const;
227 Real32
&editQuadraticAttenuation(void);
228 Real32
getQuadraticAttenuation (void) const;
230 LightEngine
* getLightEngine (void) const;
232 Real32
&editShadowIntensity(void);
233 Real32
getShadowIntensity (void) const;
235 UInt32
&editShadowMode (void);
236 UInt32
getShadowMode (void) const;
239 /*---------------------------------------------------------------------*/
240 /*! \name Field Set */
243 void setAmbient (const Color4f
&value
);
244 void setDiffuse (const Color4f
&value
);
245 void setSpecular (const Color4f
&value
);
246 void setBeacon (Node
* const value
);
247 void setOn (const bool value
);
248 void setConstantAttenuation(const Real32 value
);
249 void setLinearAttenuation(const Real32 value
);
250 void setQuadraticAttenuation(const Real32 value
);
251 void setLightEngine (LightEngine
* const value
);
252 void setShadowIntensity(const Real32 value
);
253 void setShadowMode (const UInt32 value
);
256 /*---------------------------------------------------------------------*/
257 /*! \name Ptr Field Set */
261 /*---------------------------------------------------------------------*/
262 /*! \name Ptr MField Set */
266 /*---------------------------------------------------------------------*/
267 /*! \name Binary Access */
270 virtual SizeT
getBinSize (ConstFieldMaskArg whichField
);
271 virtual void copyToBin (BinaryDataHandler
&pMem
,
272 ConstFieldMaskArg whichField
);
273 virtual void copyFromBin(BinaryDataHandler
&pMem
,
274 ConstFieldMaskArg whichField
);
278 /*========================= PROTECTED ===============================*/
282 static TypeObject _type
;
284 static void classDescInserter(TypeObject
&oType
);
285 static const Char8
*getClassname (void );
287 /*---------------------------------------------------------------------*/
291 SFColor4f _sfAmbient
;
292 SFColor4f _sfDiffuse
;
293 SFColor4f _sfSpecular
;
294 SFWeakNodePtr _sfBeacon
;
296 SFReal32 _sfConstantAttenuation
;
297 SFReal32 _sfLinearAttenuation
;
298 SFReal32 _sfQuadraticAttenuation
;
299 SFUnrecLightEnginePtr _sfLightEngine
;
300 SFReal32 _sfShadowIntensity
;
301 SFUInt32 _sfShadowMode
;
304 /*---------------------------------------------------------------------*/
305 /*! \name Constructors */
309 LightBase(const LightBase
&source
);
312 /*---------------------------------------------------------------------*/
313 /*! \name Destructors */
316 virtual ~LightBase(void);
319 /*---------------------------------------------------------------------*/
320 /*! \name onCreate */
323 void onCreate(const Light
*source
= NULL
);
326 /*---------------------------------------------------------------------*/
327 /*! \name Generic Field Access */
330 GetFieldHandlePtr
getHandleAmbient (void) const;
331 EditFieldHandlePtr
editHandleAmbient (void);
332 GetFieldHandlePtr
getHandleDiffuse (void) const;
333 EditFieldHandlePtr
editHandleDiffuse (void);
334 GetFieldHandlePtr
getHandleSpecular (void) const;
335 EditFieldHandlePtr
editHandleSpecular (void);
336 GetFieldHandlePtr
getHandleBeacon (void) const;
337 EditFieldHandlePtr
editHandleBeacon (void);
338 GetFieldHandlePtr
getHandleOn (void) const;
339 EditFieldHandlePtr
editHandleOn (void);
340 GetFieldHandlePtr
getHandleConstantAttenuation (void) const;
341 EditFieldHandlePtr
editHandleConstantAttenuation(void);
342 GetFieldHandlePtr
getHandleLinearAttenuation (void) const;
343 EditFieldHandlePtr
editHandleLinearAttenuation(void);
344 GetFieldHandlePtr
getHandleQuadraticAttenuation (void) const;
345 EditFieldHandlePtr
editHandleQuadraticAttenuation(void);
346 GetFieldHandlePtr
getHandleLightEngine (void) const;
347 EditFieldHandlePtr
editHandleLightEngine (void);
348 GetFieldHandlePtr
getHandleShadowIntensity (void) const;
349 EditFieldHandlePtr
editHandleShadowIntensity(void);
350 GetFieldHandlePtr
getHandleShadowMode (void) const;
351 EditFieldHandlePtr
editHandleShadowMode (void);
354 /*---------------------------------------------------------------------*/
358 #ifdef OSG_MT_CPTR_ASPECT
359 virtual void execSyncV( FieldContainer
&oFrom
,
360 ConstFieldMaskArg whichField
,
361 AspectOffsetStore
&oOffsets
,
362 ConstFieldMaskArg syncMode
,
363 const UInt32 uiSyncInfo
);
365 void execSync ( LightBase
*pFrom
,
366 ConstFieldMaskArg whichField
,
367 AspectOffsetStore
&oOffsets
,
368 ConstFieldMaskArg syncMode
,
369 const UInt32 uiSyncInfo
);
373 /*---------------------------------------------------------------------*/
378 /*---------------------------------------------------------------------*/
379 /*! \name Aspect Create */
383 /*---------------------------------------------------------------------*/
387 /*---------------------------------------------------------------------*/
391 virtual void resolveLinks(void);
394 /*========================== PRIVATE ================================*/
397 /*---------------------------------------------------------------------*/
399 // prohibit default functions (move to 'public' if you need one)
400 void operator =(const LightBase
&source
);
403 typedef LightBase
*LightBaseP
;
405 typedef CoredNodeRefPtr
<Light
> LightNodeRefPtr
;
406 typedef CoredNodeMTRefPtr
<Light
> LightNodeMTRefPtr
;
410 #endif /* _OSGLIGHTBASE_H_ */