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"
66 #include "OSGPointLightBase.h"
67 #include "OSGPointLight.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::PointLight
78 PointLight is a located lightsource. The position of the light source
79 (in the beacon's coordinate system) is defined by the \c position
80 attribute. The influence of the light diminishes with distance, controlled
81 by the \c constantAttenuation, \c linearAttenuation and \c
82 quadraticAttenuation attributes.
85 /***************************************************************************\
86 * Field Documentation *
87 \***************************************************************************/
89 /*! \var Pnt3f PointLightBase::_sfPosition
94 /***************************************************************************\
95 * FieldType/FieldTrait Instantiation *
96 \***************************************************************************/
98 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
99 PointerType FieldTraits
<PointLight
*, nsOSG
>::_type(
102 PointLight::getClassType(),
106 OSG_FIELDTRAITS_GETTYPE_NS(PointLight
*, nsOSG
)
108 /***************************************************************************\
109 * Field Description *
110 \***************************************************************************/
112 void PointLightBase::classDescInserter(TypeObject
&oType
)
114 FieldDescriptionBase
*pDesc
= NULL
;
117 pDesc
= new SFPnt3f::Description(
118 SFPnt3f::getClassType(),
121 PositionFieldId
, PositionFieldMask
,
123 (Field::SFDefaultFlags
| Field::FStdAccess
),
124 static_cast<FieldEditMethodSig
>(&PointLight::editHandlePosition
),
125 static_cast<FieldGetMethodSig
>(&PointLight::getHandlePosition
));
127 oType
.addInitialDesc(pDesc
);
131 PointLightBase::TypeObject
PointLightBase::_type(
132 PointLightBase::getClassname(),
133 Inherited::getClassname(),
136 reinterpret_cast<PrototypeCreateF
>(&PointLightBase::createEmptyLocal
),
137 reinterpret_cast<InitContainerF
>(&PointLight::initMethod
),
138 reinterpret_cast<ExitContainerF
>(&PointLight::exitMethod
),
139 reinterpret_cast<InitalInsertDescFunc
>(
140 reinterpret_cast<void *>(&PointLight::classDescInserter
)),
143 "<?xml version=\"1.0\" ?>\n"
146 " name=\"PointLight\"\n"
147 " parent=\"Light\"\n"
148 " library=\"Group\"\n"
149 " structure=\"concrete\"\n"
150 " pointerfieldtypes=\"none\"\n"
151 " systemcomponent=\"true\"\n"
152 " parentsystemcomponent=\"true\"\n"
153 " isNodeCore=\"true\"\n"
154 " docGroupBase=\"GrpGroupLight\"\n"
156 " PointLight is a located lightsource. The position of the light source\n"
157 " (in the beacon's coordinate system) is defined by the \\c position\n"
158 " attribute. The influence of the light diminishes with distance, controlled\n"
159 " by the \\c constantAttenuation, \\c linearAttenuation and \\c\n"
160 " quadraticAttenuation attributes.\n"
162 "\t name=\"position\"\n"
163 "\t type=\"Pnt3f\"\n"
164 "\t cardinality=\"single\"\n"
165 "\t visibility=\"external\"\n"
166 " defaultValue=\"0.f,0.f,0.f\"\n"
169 "</FieldContainer>\n",
170 "PointLight is a located lightsource. The position of the light source\n"
171 "(in the beacon's coordinate system) is defined by the \\c position\n"
172 "attribute. The influence of the light diminishes with distance, controlled\n"
173 "by the \\c constantAttenuation, \\c linearAttenuation and \\c\n"
174 "quadraticAttenuation attributes.\n"
177 /*------------------------------ get -----------------------------------*/
179 FieldContainerType
&PointLightBase::getType(void)
184 const FieldContainerType
&PointLightBase::getType(void) const
189 UInt32
PointLightBase::getContainerSize(void) const
191 return sizeof(PointLight
);
194 /*------------------------- decorator get ------------------------------*/
197 SFPnt3f
*PointLightBase::editSFPosition(void)
199 editSField(PositionFieldMask
);
204 const SFPnt3f
*PointLightBase::getSFPosition(void) const
214 /*------------------------------ access -----------------------------------*/
216 SizeT
PointLightBase::getBinSize(ConstFieldMaskArg whichField
)
218 SizeT returnValue
= Inherited::getBinSize(whichField
);
220 if(FieldBits::NoField
!= (PositionFieldMask
& whichField
))
222 returnValue
+= _sfPosition
.getBinSize();
228 void PointLightBase::copyToBin(BinaryDataHandler
&pMem
,
229 ConstFieldMaskArg whichField
)
231 Inherited::copyToBin(pMem
, whichField
);
233 if(FieldBits::NoField
!= (PositionFieldMask
& whichField
))
235 _sfPosition
.copyToBin(pMem
);
239 void PointLightBase::copyFromBin(BinaryDataHandler
&pMem
,
240 ConstFieldMaskArg whichField
)
242 Inherited::copyFromBin(pMem
, whichField
);
244 if(FieldBits::NoField
!= (PositionFieldMask
& whichField
))
246 editSField(PositionFieldMask
);
247 _sfPosition
.copyFromBin(pMem
);
251 //! create a new instance of the class
252 PointLightTransitPtr
PointLightBase::createLocal(BitVector bFlags
)
254 PointLightTransitPtr fc
;
256 if(getClassType().getPrototype() != NULL
)
258 FieldContainerTransitPtr tmpPtr
=
259 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
261 fc
= dynamic_pointer_cast
<PointLight
>(tmpPtr
);
267 //! create a new instance of the class, copy the container flags
268 PointLightTransitPtr
PointLightBase::createDependent(BitVector bFlags
)
270 PointLightTransitPtr fc
;
272 if(getClassType().getPrototype() != NULL
)
274 FieldContainerTransitPtr tmpPtr
=
275 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
277 fc
= dynamic_pointer_cast
<PointLight
>(tmpPtr
);
283 //! create a new instance of the class
284 PointLightTransitPtr
PointLightBase::create(void)
286 PointLightTransitPtr fc
;
288 if(getClassType().getPrototype() != NULL
)
290 FieldContainerTransitPtr tmpPtr
=
291 getClassType().getPrototype()-> shallowCopy();
293 fc
= dynamic_pointer_cast
<PointLight
>(tmpPtr
);
299 PointLight
*PointLightBase::createEmptyLocal(BitVector bFlags
)
301 PointLight
*returnValue
;
303 newPtr
<PointLight
>(returnValue
, bFlags
);
305 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
310 //! create an empty new instance of the class, do not copy the prototype
311 PointLight
*PointLightBase::createEmpty(void)
313 PointLight
*returnValue
;
315 newPtr
<PointLight
>(returnValue
, Thread::getCurrentLocalFlags());
317 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
318 ~Thread::getCurrentLocalFlags();
324 FieldContainerTransitPtr
PointLightBase::shallowCopyLocal(
325 BitVector bFlags
) const
329 newPtr(tmpPtr
, dynamic_cast<const PointLight
*>(this), bFlags
);
331 FieldContainerTransitPtr
returnValue(tmpPtr
);
333 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
338 FieldContainerTransitPtr
PointLightBase::shallowCopyDependent(
339 BitVector bFlags
) const
343 newPtr(tmpPtr
, dynamic_cast<const PointLight
*>(this), ~bFlags
);
345 FieldContainerTransitPtr
returnValue(tmpPtr
);
347 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
352 FieldContainerTransitPtr
PointLightBase::shallowCopy(void) const
357 dynamic_cast<const PointLight
*>(this),
358 Thread::getCurrentLocalFlags());
360 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
362 FieldContainerTransitPtr
returnValue(tmpPtr
);
370 /*------------------------- constructors ----------------------------------*/
372 PointLightBase::PointLightBase(void) :
374 _sfPosition (Pnt3f(0.f
,0.f
,0.f
))
378 PointLightBase::PointLightBase(const PointLightBase
&source
) :
380 _sfPosition (source
._sfPosition
)
385 /*-------------------------- destructors ----------------------------------*/
387 PointLightBase::~PointLightBase(void)
392 GetFieldHandlePtr
PointLightBase::getHandlePosition (void) const
394 SFPnt3f::GetHandlePtr
returnValue(
395 new SFPnt3f::GetHandle(
397 this->getType().getFieldDesc(PositionFieldId
),
398 const_cast<PointLightBase
*>(this)));
403 EditFieldHandlePtr
PointLightBase::editHandlePosition (void)
405 SFPnt3f::EditHandlePtr
returnValue(
406 new SFPnt3f::EditHandle(
408 this->getType().getFieldDesc(PositionFieldId
),
412 editSField(PositionFieldMask
);
418 #ifdef OSG_MT_CPTR_ASPECT
419 void PointLightBase::execSyncV( FieldContainer
&oFrom
,
420 ConstFieldMaskArg whichField
,
421 AspectOffsetStore
&oOffsets
,
422 ConstFieldMaskArg syncMode
,
423 const UInt32 uiSyncInfo
)
425 PointLight
*pThis
= static_cast<PointLight
*>(this);
427 pThis
->execSync(static_cast<PointLight
*>(&oFrom
),
436 #ifdef OSG_MT_CPTR_ASPECT
437 FieldContainer
*PointLightBase::createAspectCopy(
438 const FieldContainer
*pRefAspect
) const
440 PointLight
*returnValue
;
442 newAspectCopy(returnValue
,
443 dynamic_cast<const PointLight
*>(pRefAspect
),
444 dynamic_cast<const PointLight
*>(this));
450 void PointLightBase::resolveLinks(void)
452 Inherited::resolveLinks();