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 \*****************************************************************************/
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
61 #include "OSGConfig.h"
65 #include "OSGNode.h" // Beacon Class
66 #include "OSGLightEngine.h" // LightEngine Class
68 #include "OSGLightBase.h"
71 #include <boost/bind.hpp>
75 /***************************************************************************\
77 \***************************************************************************/
80 Light is the base class for all the light source nodes.
81 It contains the field for the general light source attributes
82 (AmbientColor, DiffuseColor, SpecularColor, Beacon). The Beacon
83 defines the reference coordinate system for the lightsource, while
84 the position in the graph defines the objects that are lit.
87 /***************************************************************************\
88 * Field Documentation *
89 \***************************************************************************/
91 /*! \var Color4f LightBase::_sfAmbient
92 The light's ambient component.
95 /*! \var Color4f LightBase::_sfDiffuse
96 The light's diffuse color.
99 /*! \var Color4f LightBase::_sfSpecular
100 The light's specular color.
103 /*! \var Node * LightBase::_sfBeacon
107 /*! \var bool LightBase::_sfOn
111 /*! \var Real32 LightBase::_sfConstantAttenuation
112 The light's constant attenuation.
115 /*! \var Real32 LightBase::_sfLinearAttenuation
116 The light's linear attenuation.
119 /*! \var Real32 LightBase::_sfQuadraticAttenuation
120 The light's quadratic attenuation.
123 /*! \var LightEngine * LightBase::_sfLightEngine
127 /*! \var Real32 LightBase::_sfShadowIntensity
131 /*! \var UInt32 LightBase::_sfShadowMode
136 /***************************************************************************\
137 * FieldType/FieldTrait Instantiation *
138 \***************************************************************************/
140 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
141 PointerType FieldTraits
<Light
*, nsOSG
>::_type(
144 Light::getClassType(),
148 OSG_FIELDTRAITS_GETTYPE_NS(Light
*, nsOSG
)
150 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
154 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
158 /***************************************************************************\
159 * Field Description *
160 \***************************************************************************/
162 void LightBase::classDescInserter(TypeObject
&oType
)
164 FieldDescriptionBase
*pDesc
= NULL
;
167 pDesc
= new SFColor4f::Description(
168 SFColor4f::getClassType(),
170 "The light's ambient component.\n",
171 AmbientFieldId
, AmbientFieldMask
,
173 (Field::SFDefaultFlags
| Field::FStdAccess
),
174 static_cast<FieldEditMethodSig
>(&Light::editHandleAmbient
),
175 static_cast<FieldGetMethodSig
>(&Light::getHandleAmbient
));
177 oType
.addInitialDesc(pDesc
);
179 pDesc
= new SFColor4f::Description(
180 SFColor4f::getClassType(),
182 "The light's diffuse color.\n",
183 DiffuseFieldId
, DiffuseFieldMask
,
185 (Field::SFDefaultFlags
| Field::FStdAccess
),
186 static_cast<FieldEditMethodSig
>(&Light::editHandleDiffuse
),
187 static_cast<FieldGetMethodSig
>(&Light::getHandleDiffuse
));
189 oType
.addInitialDesc(pDesc
);
191 pDesc
= new SFColor4f::Description(
192 SFColor4f::getClassType(),
194 "The light's specular color.\n",
195 SpecularFieldId
, SpecularFieldMask
,
197 (Field::SFDefaultFlags
| Field::FStdAccess
),
198 static_cast<FieldEditMethodSig
>(&Light::editHandleSpecular
),
199 static_cast<FieldGetMethodSig
>(&Light::getHandleSpecular
));
201 oType
.addInitialDesc(pDesc
);
203 pDesc
= new SFWeakNodePtr::Description(
204 SFWeakNodePtr::getClassType(),
207 BeaconFieldId
, BeaconFieldMask
,
209 (Field::SFDefaultFlags
| Field::FStdAccess
),
210 static_cast<FieldEditMethodSig
>(&Light::editHandleBeacon
),
211 static_cast<FieldGetMethodSig
>(&Light::getHandleBeacon
));
213 oType
.addInitialDesc(pDesc
);
215 pDesc
= new SFBool::Description(
216 SFBool::getClassType(),
219 OnFieldId
, OnFieldMask
,
221 (Field::SFDefaultFlags
| Field::FStdAccess
),
222 static_cast<FieldEditMethodSig
>(&Light::editHandleOn
),
223 static_cast<FieldGetMethodSig
>(&Light::getHandleOn
));
225 oType
.addInitialDesc(pDesc
);
227 pDesc
= new SFReal32::Description(
228 SFReal32::getClassType(),
229 "constantAttenuation",
230 "The light's constant attenuation.\n",
231 ConstantAttenuationFieldId
, ConstantAttenuationFieldMask
,
233 (Field::SFDefaultFlags
| Field::FStdAccess
),
234 static_cast<FieldEditMethodSig
>(&Light::editHandleConstantAttenuation
),
235 static_cast<FieldGetMethodSig
>(&Light::getHandleConstantAttenuation
));
237 oType
.addInitialDesc(pDesc
);
239 pDesc
= new SFReal32::Description(
240 SFReal32::getClassType(),
242 "The light's linear attenuation.\n",
243 LinearAttenuationFieldId
, LinearAttenuationFieldMask
,
245 (Field::SFDefaultFlags
| Field::FStdAccess
),
246 static_cast<FieldEditMethodSig
>(&Light::editHandleLinearAttenuation
),
247 static_cast<FieldGetMethodSig
>(&Light::getHandleLinearAttenuation
));
249 oType
.addInitialDesc(pDesc
);
251 pDesc
= new SFReal32::Description(
252 SFReal32::getClassType(),
253 "quadraticAttenuation",
254 "The light's quadratic attenuation.\n",
255 QuadraticAttenuationFieldId
, QuadraticAttenuationFieldMask
,
257 (Field::SFDefaultFlags
| Field::FStdAccess
),
258 static_cast<FieldEditMethodSig
>(&Light::editHandleQuadraticAttenuation
),
259 static_cast<FieldGetMethodSig
>(&Light::getHandleQuadraticAttenuation
));
261 oType
.addInitialDesc(pDesc
);
263 pDesc
= new SFUnrecLightEnginePtr::Description(
264 SFUnrecLightEnginePtr::getClassType(),
267 LightEngineFieldId
, LightEngineFieldMask
,
269 (Field::SFDefaultFlags
| Field::FStdAccess
),
270 static_cast<FieldEditMethodSig
>(&Light::editHandleLightEngine
),
271 static_cast<FieldGetMethodSig
>(&Light::getHandleLightEngine
));
273 oType
.addInitialDesc(pDesc
);
275 pDesc
= new SFReal32::Description(
276 SFReal32::getClassType(),
279 ShadowIntensityFieldId
, ShadowIntensityFieldMask
,
281 (Field::SFDefaultFlags
| Field::FStdAccess
),
282 static_cast<FieldEditMethodSig
>(&Light::editHandleShadowIntensity
),
283 static_cast<FieldGetMethodSig
>(&Light::getHandleShadowIntensity
));
285 oType
.addInitialDesc(pDesc
);
287 pDesc
= new SFUInt32::Description(
288 SFUInt32::getClassType(),
291 ShadowModeFieldId
, ShadowModeFieldMask
,
293 (Field::SFDefaultFlags
| Field::FStdAccess
),
294 static_cast<FieldEditMethodSig
>(&Light::editHandleShadowMode
),
295 static_cast<FieldGetMethodSig
>(&Light::getHandleShadowMode
));
297 oType
.addInitialDesc(pDesc
);
301 LightBase::TypeObject
LightBase::_type(
302 LightBase::getClassname(),
303 Inherited::getClassname(),
307 reinterpret_cast<InitContainerF
>(&Light::initMethod
),
308 reinterpret_cast<ExitContainerF
>(&Light::exitMethod
),
309 reinterpret_cast<InitalInsertDescFunc
>(
310 reinterpret_cast<void *>(&Light::classDescInserter
)),
313 "<?xml version=\"1.0\"?>\n"
317 " parent=\"Group\"\n"
318 " library=\"System\"\n"
319 " pointerfieldtypes=\"both\"\n"
320 " structure=\"abstract\"\n"
321 " systemcomponent=\"true\"\n"
322 " parentsystemcomponent=\"true\"\n"
323 " isNodeCore=\"true\"\n"
324 " decoratable=\"false\"\n"
325 " useLocalIncludes=\"false\"\n"
326 " docGroupBase=\"GrpSystemNodeCoreGroups\"\n"
329 " Light is the base class for all the light source nodes.\n"
330 " It contains the field for the general light source attributes\n"
331 " (AmbientColor, DiffuseColor, SpecularColor, Beacon). The Beacon\n"
332 " defines the reference coordinate system for the lightsource, while\n"
333 " the position in the graph defines the objects that are lit.\n"
336 "\t name=\"ambient\"\n"
337 "\t type=\"Color4f\"\n"
338 "\t cardinality=\"single\"\n"
339 "\t visibility=\"external\"\n"
340 "\t defaultValue=\"0.f,0.f,0.f,1.f\"\n"
341 "\t access=\"public\"\n"
343 "\tThe light's ambient component.\n"
346 "\t name=\"diffuse\"\n"
347 "\t type=\"Color4f\"\n"
348 "\t cardinality=\"single\"\n"
349 "\t visibility=\"external\"\n"
350 "\t defaultValue=\"1.f,1.f,1.f,1.f\"\n"
351 "\t access=\"public\"\n"
353 "\tThe light's diffuse color.\n"
356 "\t name=\"specular\"\n"
357 "\t type=\"Color4f\"\n"
358 "\t cardinality=\"single\"\n"
359 "\t visibility=\"external\"\n"
360 "\t defaultValue=\"1.f,1.f,1.f,1.f\"\n"
361 "\t access=\"public\"\n"
363 "\tThe light's specular color.\n"
366 "\t name=\"beacon\"\n"
368 " category=\"weakpointer\"\n"
369 "\t cardinality=\"single\"\n"
370 "\t visibility=\"external\"\n"
371 "\t access=\"public\"\n"
377 "\t cardinality=\"single\"\n"
378 "\t visibility=\"external\"\n"
379 "\t defaultValue=\"true\"\n"
380 "\t access=\"public\"\n"
384 "\t name=\"constantAttenuation\"\n"
385 "\t type=\"Real32\"\n"
386 "\t cardinality=\"single\"\n"
387 "\t visibility=\"external\"\n"
388 "\t defaultValue=\"1.f\"\n"
389 "\t access=\"public\"\n"
391 "\tThe light's constant attenuation.\n"
394 "\t name=\"linearAttenuation\"\n"
395 "\t type=\"Real32\"\n"
396 "\t cardinality=\"single\"\n"
397 "\t visibility=\"external\"\n"
398 "\t defaultValue=\"0.f\"\n"
399 "\t access=\"public\"\n"
401 "\tThe light's linear attenuation.\n"
404 "\t name=\"quadraticAttenuation\"\n"
405 "\t type=\"Real32\"\n"
406 "\t cardinality=\"single\"\n"
407 "\t visibility=\"external\"\n"
408 "\t defaultValue=\"0.f\"\n"
409 "\t access=\"public\"\n"
411 "\tThe light's quadratic attenuation.\n"
414 "\t name=\"lightEngine\"\n"
415 "\t type=\"LightEnginePtr\"\n"
416 "\t cardinality=\"single\"\n"
417 "\t visibility=\"external\"\n"
418 "\t access=\"public\"\n"
424 "\t name=\"shadowIntensity\"\n"
425 "\t type=\"Real32\"\n"
426 "\t cardinality=\"single\"\n"
427 "\t visibility=\"external\"\n"
428 "\t defaultValue=\"0.f\"\n"
429 "\t access=\"public\"\n"
433 "\t name=\"shadowMode\"\n"
434 "\t type=\"UInt32\"\n"
435 "\t cardinality=\"single\"\n"
436 "\t visibility=\"external\"\n"
437 "\t defaultValue=\"0\"\n"
438 "\t access=\"public\"\n"
443 "</FieldContainer>\n",
444 "Light is the base class for all the light source nodes.\n"
445 "It contains the field for the general light source attributes\n"
446 "(AmbientColor, DiffuseColor, SpecularColor, Beacon). The Beacon\n"
447 "defines the reference coordinate system for the lightsource, while\n"
448 "the position in the graph defines the objects that are lit.\n"
451 /*------------------------------ get -----------------------------------*/
453 FieldContainerType
&LightBase::getType(void)
458 const FieldContainerType
&LightBase::getType(void) const
463 UInt32
LightBase::getContainerSize(void) const
465 return sizeof(Light
);
468 /*------------------------- decorator get ------------------------------*/
471 SFColor4f
*LightBase::editSFAmbient(void)
473 editSField(AmbientFieldMask
);
478 const SFColor4f
*LightBase::getSFAmbient(void) const
484 SFColor4f
*LightBase::editSFDiffuse(void)
486 editSField(DiffuseFieldMask
);
491 const SFColor4f
*LightBase::getSFDiffuse(void) const
497 SFColor4f
*LightBase::editSFSpecular(void)
499 editSField(SpecularFieldMask
);
504 const SFColor4f
*LightBase::getSFSpecular(void) const
510 //! Get the Light::_sfBeacon field.
511 const SFWeakNodePtr
*LightBase::getSFBeacon(void) const
516 SFWeakNodePtr
*LightBase::editSFBeacon (void)
518 editSField(BeaconFieldMask
);
523 //! Get the value of the Light::_sfBeacon field.
524 Node
* LightBase::getBeacon(void) const
526 return _sfBeacon
.getValue();
529 //! Set the value of the Light::_sfBeacon field.
530 void LightBase::setBeacon(Node
* const value
)
532 editSField(BeaconFieldMask
);
534 _sfBeacon
.setValue(value
);
538 SFBool
*LightBase::editSFOn(void)
540 editSField(OnFieldMask
);
545 const SFBool
*LightBase::getSFOn(void) const
551 SFReal32
*LightBase::editSFConstantAttenuation(void)
553 editSField(ConstantAttenuationFieldMask
);
555 return &_sfConstantAttenuation
;
558 const SFReal32
*LightBase::getSFConstantAttenuation(void) const
560 return &_sfConstantAttenuation
;
564 SFReal32
*LightBase::editSFLinearAttenuation(void)
566 editSField(LinearAttenuationFieldMask
);
568 return &_sfLinearAttenuation
;
571 const SFReal32
*LightBase::getSFLinearAttenuation(void) const
573 return &_sfLinearAttenuation
;
577 SFReal32
*LightBase::editSFQuadraticAttenuation(void)
579 editSField(QuadraticAttenuationFieldMask
);
581 return &_sfQuadraticAttenuation
;
584 const SFReal32
*LightBase::getSFQuadraticAttenuation(void) const
586 return &_sfQuadraticAttenuation
;
590 //! Get the Light::_sfLightEngine field.
591 const SFUnrecLightEnginePtr
*LightBase::getSFLightEngine(void) const
593 return &_sfLightEngine
;
596 SFUnrecLightEnginePtr
*LightBase::editSFLightEngine (void)
598 editSField(LightEngineFieldMask
);
600 return &_sfLightEngine
;
603 //! Get the value of the Light::_sfLightEngine field.
604 LightEngine
* LightBase::getLightEngine(void) const
606 return _sfLightEngine
.getValue();
609 //! Set the value of the Light::_sfLightEngine field.
610 void LightBase::setLightEngine(LightEngine
* const value
)
612 editSField(LightEngineFieldMask
);
614 _sfLightEngine
.setValue(value
);
618 SFReal32
*LightBase::editSFShadowIntensity(void)
620 editSField(ShadowIntensityFieldMask
);
622 return &_sfShadowIntensity
;
625 const SFReal32
*LightBase::getSFShadowIntensity(void) const
627 return &_sfShadowIntensity
;
631 SFUInt32
*LightBase::editSFShadowMode(void)
633 editSField(ShadowModeFieldMask
);
635 return &_sfShadowMode
;
638 const SFUInt32
*LightBase::getSFShadowMode(void) const
640 return &_sfShadowMode
;
648 /*------------------------------ access -----------------------------------*/
650 SizeT
LightBase::getBinSize(ConstFieldMaskArg whichField
)
652 SizeT returnValue
= Inherited::getBinSize(whichField
);
654 if(FieldBits::NoField
!= (AmbientFieldMask
& whichField
))
656 returnValue
+= _sfAmbient
.getBinSize();
658 if(FieldBits::NoField
!= (DiffuseFieldMask
& whichField
))
660 returnValue
+= _sfDiffuse
.getBinSize();
662 if(FieldBits::NoField
!= (SpecularFieldMask
& whichField
))
664 returnValue
+= _sfSpecular
.getBinSize();
666 if(FieldBits::NoField
!= (BeaconFieldMask
& whichField
))
668 returnValue
+= _sfBeacon
.getBinSize();
670 if(FieldBits::NoField
!= (OnFieldMask
& whichField
))
672 returnValue
+= _sfOn
.getBinSize();
674 if(FieldBits::NoField
!= (ConstantAttenuationFieldMask
& whichField
))
676 returnValue
+= _sfConstantAttenuation
.getBinSize();
678 if(FieldBits::NoField
!= (LinearAttenuationFieldMask
& whichField
))
680 returnValue
+= _sfLinearAttenuation
.getBinSize();
682 if(FieldBits::NoField
!= (QuadraticAttenuationFieldMask
& whichField
))
684 returnValue
+= _sfQuadraticAttenuation
.getBinSize();
686 if(FieldBits::NoField
!= (LightEngineFieldMask
& whichField
))
688 returnValue
+= _sfLightEngine
.getBinSize();
690 if(FieldBits::NoField
!= (ShadowIntensityFieldMask
& whichField
))
692 returnValue
+= _sfShadowIntensity
.getBinSize();
694 if(FieldBits::NoField
!= (ShadowModeFieldMask
& whichField
))
696 returnValue
+= _sfShadowMode
.getBinSize();
702 void LightBase::copyToBin(BinaryDataHandler
&pMem
,
703 ConstFieldMaskArg whichField
)
705 Inherited::copyToBin(pMem
, whichField
);
707 if(FieldBits::NoField
!= (AmbientFieldMask
& whichField
))
709 _sfAmbient
.copyToBin(pMem
);
711 if(FieldBits::NoField
!= (DiffuseFieldMask
& whichField
))
713 _sfDiffuse
.copyToBin(pMem
);
715 if(FieldBits::NoField
!= (SpecularFieldMask
& whichField
))
717 _sfSpecular
.copyToBin(pMem
);
719 if(FieldBits::NoField
!= (BeaconFieldMask
& whichField
))
721 _sfBeacon
.copyToBin(pMem
);
723 if(FieldBits::NoField
!= (OnFieldMask
& whichField
))
725 _sfOn
.copyToBin(pMem
);
727 if(FieldBits::NoField
!= (ConstantAttenuationFieldMask
& whichField
))
729 _sfConstantAttenuation
.copyToBin(pMem
);
731 if(FieldBits::NoField
!= (LinearAttenuationFieldMask
& whichField
))
733 _sfLinearAttenuation
.copyToBin(pMem
);
735 if(FieldBits::NoField
!= (QuadraticAttenuationFieldMask
& whichField
))
737 _sfQuadraticAttenuation
.copyToBin(pMem
);
739 if(FieldBits::NoField
!= (LightEngineFieldMask
& whichField
))
741 _sfLightEngine
.copyToBin(pMem
);
743 if(FieldBits::NoField
!= (ShadowIntensityFieldMask
& whichField
))
745 _sfShadowIntensity
.copyToBin(pMem
);
747 if(FieldBits::NoField
!= (ShadowModeFieldMask
& whichField
))
749 _sfShadowMode
.copyToBin(pMem
);
753 void LightBase::copyFromBin(BinaryDataHandler
&pMem
,
754 ConstFieldMaskArg whichField
)
756 Inherited::copyFromBin(pMem
, whichField
);
758 if(FieldBits::NoField
!= (AmbientFieldMask
& whichField
))
760 editSField(AmbientFieldMask
);
761 _sfAmbient
.copyFromBin(pMem
);
763 if(FieldBits::NoField
!= (DiffuseFieldMask
& whichField
))
765 editSField(DiffuseFieldMask
);
766 _sfDiffuse
.copyFromBin(pMem
);
768 if(FieldBits::NoField
!= (SpecularFieldMask
& whichField
))
770 editSField(SpecularFieldMask
);
771 _sfSpecular
.copyFromBin(pMem
);
773 if(FieldBits::NoField
!= (BeaconFieldMask
& whichField
))
775 editSField(BeaconFieldMask
);
776 _sfBeacon
.copyFromBin(pMem
);
778 if(FieldBits::NoField
!= (OnFieldMask
& whichField
))
780 editSField(OnFieldMask
);
781 _sfOn
.copyFromBin(pMem
);
783 if(FieldBits::NoField
!= (ConstantAttenuationFieldMask
& whichField
))
785 editSField(ConstantAttenuationFieldMask
);
786 _sfConstantAttenuation
.copyFromBin(pMem
);
788 if(FieldBits::NoField
!= (LinearAttenuationFieldMask
& whichField
))
790 editSField(LinearAttenuationFieldMask
);
791 _sfLinearAttenuation
.copyFromBin(pMem
);
793 if(FieldBits::NoField
!= (QuadraticAttenuationFieldMask
& whichField
))
795 editSField(QuadraticAttenuationFieldMask
);
796 _sfQuadraticAttenuation
.copyFromBin(pMem
);
798 if(FieldBits::NoField
!= (LightEngineFieldMask
& whichField
))
800 editSField(LightEngineFieldMask
);
801 _sfLightEngine
.copyFromBin(pMem
);
803 if(FieldBits::NoField
!= (ShadowIntensityFieldMask
& whichField
))
805 editSField(ShadowIntensityFieldMask
);
806 _sfShadowIntensity
.copyFromBin(pMem
);
808 if(FieldBits::NoField
!= (ShadowModeFieldMask
& whichField
))
810 editSField(ShadowModeFieldMask
);
811 _sfShadowMode
.copyFromBin(pMem
);
818 /*------------------------- constructors ----------------------------------*/
820 LightBase::LightBase(void) :
822 _sfAmbient (Color4f(0.f
,0.f
,0.f
,1.f
)),
823 _sfDiffuse (Color4f(1.f
,1.f
,1.f
,1.f
)),
824 _sfSpecular (Color4f(1.f
,1.f
,1.f
,1.f
)),
827 _sfConstantAttenuation (Real32(1.f
)),
828 _sfLinearAttenuation (Real32(0.f
)),
829 _sfQuadraticAttenuation (Real32(0.f
)),
830 _sfLightEngine (NULL
),
831 _sfShadowIntensity (Real32(0.f
)),
832 _sfShadowMode (UInt32(0))
836 LightBase::LightBase(const LightBase
&source
) :
838 _sfAmbient (source
._sfAmbient
),
839 _sfDiffuse (source
._sfDiffuse
),
840 _sfSpecular (source
._sfSpecular
),
842 _sfOn (source
._sfOn
),
843 _sfConstantAttenuation (source
._sfConstantAttenuation
),
844 _sfLinearAttenuation (source
._sfLinearAttenuation
),
845 _sfQuadraticAttenuation (source
._sfQuadraticAttenuation
),
846 _sfLightEngine (NULL
),
847 _sfShadowIntensity (source
._sfShadowIntensity
),
848 _sfShadowMode (source
._sfShadowMode
)
853 /*-------------------------- destructors ----------------------------------*/
855 LightBase::~LightBase(void)
859 void LightBase::onCreate(const Light
*source
)
861 Inherited::onCreate(source
);
865 Light
*pThis
= static_cast<Light
*>(this);
867 pThis
->setBeacon(source
->getBeacon());
869 pThis
->setLightEngine(source
->getLightEngine());
873 GetFieldHandlePtr
LightBase::getHandleAmbient (void) const
875 SFColor4f::GetHandlePtr
returnValue(
876 new SFColor4f::GetHandle(
878 this->getType().getFieldDesc(AmbientFieldId
),
879 const_cast<LightBase
*>(this)));
884 EditFieldHandlePtr
LightBase::editHandleAmbient (void)
886 SFColor4f::EditHandlePtr
returnValue(
887 new SFColor4f::EditHandle(
889 this->getType().getFieldDesc(AmbientFieldId
),
893 editSField(AmbientFieldMask
);
898 GetFieldHandlePtr
LightBase::getHandleDiffuse (void) const
900 SFColor4f::GetHandlePtr
returnValue(
901 new SFColor4f::GetHandle(
903 this->getType().getFieldDesc(DiffuseFieldId
),
904 const_cast<LightBase
*>(this)));
909 EditFieldHandlePtr
LightBase::editHandleDiffuse (void)
911 SFColor4f::EditHandlePtr
returnValue(
912 new SFColor4f::EditHandle(
914 this->getType().getFieldDesc(DiffuseFieldId
),
918 editSField(DiffuseFieldMask
);
923 GetFieldHandlePtr
LightBase::getHandleSpecular (void) const
925 SFColor4f::GetHandlePtr
returnValue(
926 new SFColor4f::GetHandle(
928 this->getType().getFieldDesc(SpecularFieldId
),
929 const_cast<LightBase
*>(this)));
934 EditFieldHandlePtr
LightBase::editHandleSpecular (void)
936 SFColor4f::EditHandlePtr
returnValue(
937 new SFColor4f::EditHandle(
939 this->getType().getFieldDesc(SpecularFieldId
),
943 editSField(SpecularFieldMask
);
948 GetFieldHandlePtr
LightBase::getHandleBeacon (void) const
950 SFWeakNodePtr::GetHandlePtr
returnValue(
951 new SFWeakNodePtr::GetHandle(
953 this->getType().getFieldDesc(BeaconFieldId
),
954 const_cast<LightBase
*>(this)));
959 EditFieldHandlePtr
LightBase::editHandleBeacon (void)
961 SFWeakNodePtr::EditHandlePtr
returnValue(
962 new SFWeakNodePtr::EditHandle(
964 this->getType().getFieldDesc(BeaconFieldId
),
967 returnValue
->setSetMethod(
968 boost::bind(&Light::setBeacon
,
969 static_cast<Light
*>(this), _1
));
971 editSField(BeaconFieldMask
);
976 GetFieldHandlePtr
LightBase::getHandleOn (void) const
978 SFBool::GetHandlePtr
returnValue(
979 new SFBool::GetHandle(
981 this->getType().getFieldDesc(OnFieldId
),
982 const_cast<LightBase
*>(this)));
987 EditFieldHandlePtr
LightBase::editHandleOn (void)
989 SFBool::EditHandlePtr
returnValue(
990 new SFBool::EditHandle(
992 this->getType().getFieldDesc(OnFieldId
),
996 editSField(OnFieldMask
);
1001 GetFieldHandlePtr
LightBase::getHandleConstantAttenuation (void) const
1003 SFReal32::GetHandlePtr
returnValue(
1004 new SFReal32::GetHandle(
1005 &_sfConstantAttenuation
,
1006 this->getType().getFieldDesc(ConstantAttenuationFieldId
),
1007 const_cast<LightBase
*>(this)));
1012 EditFieldHandlePtr
LightBase::editHandleConstantAttenuation(void)
1014 SFReal32::EditHandlePtr
returnValue(
1015 new SFReal32::EditHandle(
1016 &_sfConstantAttenuation
,
1017 this->getType().getFieldDesc(ConstantAttenuationFieldId
),
1021 editSField(ConstantAttenuationFieldMask
);
1026 GetFieldHandlePtr
LightBase::getHandleLinearAttenuation (void) const
1028 SFReal32::GetHandlePtr
returnValue(
1029 new SFReal32::GetHandle(
1030 &_sfLinearAttenuation
,
1031 this->getType().getFieldDesc(LinearAttenuationFieldId
),
1032 const_cast<LightBase
*>(this)));
1037 EditFieldHandlePtr
LightBase::editHandleLinearAttenuation(void)
1039 SFReal32::EditHandlePtr
returnValue(
1040 new SFReal32::EditHandle(
1041 &_sfLinearAttenuation
,
1042 this->getType().getFieldDesc(LinearAttenuationFieldId
),
1046 editSField(LinearAttenuationFieldMask
);
1051 GetFieldHandlePtr
LightBase::getHandleQuadraticAttenuation (void) const
1053 SFReal32::GetHandlePtr
returnValue(
1054 new SFReal32::GetHandle(
1055 &_sfQuadraticAttenuation
,
1056 this->getType().getFieldDesc(QuadraticAttenuationFieldId
),
1057 const_cast<LightBase
*>(this)));
1062 EditFieldHandlePtr
LightBase::editHandleQuadraticAttenuation(void)
1064 SFReal32::EditHandlePtr
returnValue(
1065 new SFReal32::EditHandle(
1066 &_sfQuadraticAttenuation
,
1067 this->getType().getFieldDesc(QuadraticAttenuationFieldId
),
1071 editSField(QuadraticAttenuationFieldMask
);
1076 GetFieldHandlePtr
LightBase::getHandleLightEngine (void) const
1078 SFUnrecLightEnginePtr::GetHandlePtr
returnValue(
1079 new SFUnrecLightEnginePtr::GetHandle(
1081 this->getType().getFieldDesc(LightEngineFieldId
),
1082 const_cast<LightBase
*>(this)));
1087 EditFieldHandlePtr
LightBase::editHandleLightEngine (void)
1089 SFUnrecLightEnginePtr::EditHandlePtr
returnValue(
1090 new SFUnrecLightEnginePtr::EditHandle(
1092 this->getType().getFieldDesc(LightEngineFieldId
),
1095 returnValue
->setSetMethod(
1096 boost::bind(&Light::setLightEngine
,
1097 static_cast<Light
*>(this), _1
));
1099 editSField(LightEngineFieldMask
);
1104 GetFieldHandlePtr
LightBase::getHandleShadowIntensity (void) const
1106 SFReal32::GetHandlePtr
returnValue(
1107 new SFReal32::GetHandle(
1108 &_sfShadowIntensity
,
1109 this->getType().getFieldDesc(ShadowIntensityFieldId
),
1110 const_cast<LightBase
*>(this)));
1115 EditFieldHandlePtr
LightBase::editHandleShadowIntensity(void)
1117 SFReal32::EditHandlePtr
returnValue(
1118 new SFReal32::EditHandle(
1119 &_sfShadowIntensity
,
1120 this->getType().getFieldDesc(ShadowIntensityFieldId
),
1124 editSField(ShadowIntensityFieldMask
);
1129 GetFieldHandlePtr
LightBase::getHandleShadowMode (void) const
1131 SFUInt32::GetHandlePtr
returnValue(
1132 new SFUInt32::GetHandle(
1134 this->getType().getFieldDesc(ShadowModeFieldId
),
1135 const_cast<LightBase
*>(this)));
1140 EditFieldHandlePtr
LightBase::editHandleShadowMode (void)
1142 SFUInt32::EditHandlePtr
returnValue(
1143 new SFUInt32::EditHandle(
1145 this->getType().getFieldDesc(ShadowModeFieldId
),
1149 editSField(ShadowModeFieldMask
);
1155 #ifdef OSG_MT_CPTR_ASPECT
1156 void LightBase::execSyncV( FieldContainer
&oFrom
,
1157 ConstFieldMaskArg whichField
,
1158 AspectOffsetStore
&oOffsets
,
1159 ConstFieldMaskArg syncMode
,
1160 const UInt32 uiSyncInfo
)
1162 Light
*pThis
= static_cast<Light
*>(this);
1164 pThis
->execSync(static_cast<Light
*>(&oFrom
),
1174 void LightBase::resolveLinks(void)
1176 Inherited::resolveLinks();
1178 static_cast<Light
*>(this)->setBeacon(NULL
);
1180 static_cast<Light
*>(this)->setLightEngine(NULL
);