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 DirectionalLight!
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 "OSGDirectionalLightBase.h"
67 #include "OSGDirectionalLight.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::DirectionalLight
78 DirectionalLight is an infinitely distant lightsource. Its only
79 attribute is the light's direction.
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var Vec3f DirectionalLightBase::_sfDirection
91 /***************************************************************************\
92 * FieldType/FieldTrait Instantiation *
93 \***************************************************************************/
95 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
96 PointerType FieldTraits
<DirectionalLight
*, nsOSG
>::_type(
97 "DirectionalLightPtr",
99 DirectionalLight::getClassType(),
103 OSG_FIELDTRAITS_GETTYPE_NS(DirectionalLight
*, nsOSG
)
105 /***************************************************************************\
106 * Field Description *
107 \***************************************************************************/
109 void DirectionalLightBase::classDescInserter(TypeObject
&oType
)
111 FieldDescriptionBase
*pDesc
= NULL
;
114 pDesc
= new SFVec3f::Description(
115 SFVec3f::getClassType(),
118 DirectionFieldId
, DirectionFieldMask
,
120 (Field::SFDefaultFlags
| Field::FStdAccess
),
121 static_cast<FieldEditMethodSig
>(&DirectionalLight::editHandleDirection
),
122 static_cast<FieldGetMethodSig
>(&DirectionalLight::getHandleDirection
));
124 oType
.addInitialDesc(pDesc
);
128 DirectionalLightBase::TypeObject
DirectionalLightBase::_type(
129 DirectionalLightBase::getClassname(),
130 Inherited::getClassname(),
133 reinterpret_cast<PrototypeCreateF
>(&DirectionalLightBase::createEmptyLocal
),
134 reinterpret_cast<InitContainerF
>(&DirectionalLight::initMethod
),
135 reinterpret_cast<ExitContainerF
>(&DirectionalLight::exitMethod
),
136 reinterpret_cast<InitalInsertDescFunc
>(
137 reinterpret_cast<void *>(&DirectionalLight::classDescInserter
)),
140 "<?xml version=\"1.0\" ?>\n"
143 " name=\"DirectionalLight\"\n"
144 " parent=\"Light\"\n"
145 " library=\"Group\"\n"
146 " structure=\"concrete\"\n"
147 " pointerfieldtypes=\"none\"\n"
148 " systemcomponent=\"true\"\n"
149 " parentsystemcomponent=\"true\"\n"
150 " isNodeCore=\"true\"\n"
151 " docGroupBase=\"GrpGroupLight\"\n"
153 " DirectionalLight is an infinitely distant lightsource. Its only\n"
154 " attribute is the light's direction.\n"
156 "\t name=\"direction\"\n"
157 "\t type=\"Vec3f\"\n"
158 "\t cardinality=\"single\"\n"
159 "\t visibility=\"external\"\n"
160 " defaultValue=\"0.f,0.f,1.f\"\n"
163 "</FieldContainer>\n",
164 "DirectionalLight is an infinitely distant lightsource. Its only\n"
165 "attribute is the light's direction.\n"
168 /*------------------------------ get -----------------------------------*/
170 FieldContainerType
&DirectionalLightBase::getType(void)
175 const FieldContainerType
&DirectionalLightBase::getType(void) const
180 UInt32
DirectionalLightBase::getContainerSize(void) const
182 return sizeof(DirectionalLight
);
185 /*------------------------- decorator get ------------------------------*/
188 SFVec3f
*DirectionalLightBase::editSFDirection(void)
190 editSField(DirectionFieldMask
);
192 return &_sfDirection
;
195 const SFVec3f
*DirectionalLightBase::getSFDirection(void) const
197 return &_sfDirection
;
205 /*------------------------------ access -----------------------------------*/
207 SizeT
DirectionalLightBase::getBinSize(ConstFieldMaskArg whichField
)
209 SizeT returnValue
= Inherited::getBinSize(whichField
);
211 if(FieldBits::NoField
!= (DirectionFieldMask
& whichField
))
213 returnValue
+= _sfDirection
.getBinSize();
219 void DirectionalLightBase::copyToBin(BinaryDataHandler
&pMem
,
220 ConstFieldMaskArg whichField
)
222 Inherited::copyToBin(pMem
, whichField
);
224 if(FieldBits::NoField
!= (DirectionFieldMask
& whichField
))
226 _sfDirection
.copyToBin(pMem
);
230 void DirectionalLightBase::copyFromBin(BinaryDataHandler
&pMem
,
231 ConstFieldMaskArg whichField
)
233 Inherited::copyFromBin(pMem
, whichField
);
235 if(FieldBits::NoField
!= (DirectionFieldMask
& whichField
))
237 editSField(DirectionFieldMask
);
238 _sfDirection
.copyFromBin(pMem
);
242 //! create a new instance of the class
243 DirectionalLightTransitPtr
DirectionalLightBase::createLocal(BitVector bFlags
)
245 DirectionalLightTransitPtr fc
;
247 if(getClassType().getPrototype() != NULL
)
249 FieldContainerTransitPtr tmpPtr
=
250 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
252 fc
= dynamic_pointer_cast
<DirectionalLight
>(tmpPtr
);
258 //! create a new instance of the class, copy the container flags
259 DirectionalLightTransitPtr
DirectionalLightBase::createDependent(BitVector bFlags
)
261 DirectionalLightTransitPtr fc
;
263 if(getClassType().getPrototype() != NULL
)
265 FieldContainerTransitPtr tmpPtr
=
266 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
268 fc
= dynamic_pointer_cast
<DirectionalLight
>(tmpPtr
);
274 //! create a new instance of the class
275 DirectionalLightTransitPtr
DirectionalLightBase::create(void)
277 DirectionalLightTransitPtr fc
;
279 if(getClassType().getPrototype() != NULL
)
281 FieldContainerTransitPtr tmpPtr
=
282 getClassType().getPrototype()-> shallowCopy();
284 fc
= dynamic_pointer_cast
<DirectionalLight
>(tmpPtr
);
290 DirectionalLight
*DirectionalLightBase::createEmptyLocal(BitVector bFlags
)
292 DirectionalLight
*returnValue
;
294 newPtr
<DirectionalLight
>(returnValue
, bFlags
);
296 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
301 //! create an empty new instance of the class, do not copy the prototype
302 DirectionalLight
*DirectionalLightBase::createEmpty(void)
304 DirectionalLight
*returnValue
;
306 newPtr
<DirectionalLight
>(returnValue
, Thread::getCurrentLocalFlags());
308 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
309 ~Thread::getCurrentLocalFlags();
315 FieldContainerTransitPtr
DirectionalLightBase::shallowCopyLocal(
316 BitVector bFlags
) const
318 DirectionalLight
*tmpPtr
;
320 newPtr(tmpPtr
, dynamic_cast<const DirectionalLight
*>(this), bFlags
);
322 FieldContainerTransitPtr
returnValue(tmpPtr
);
324 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
329 FieldContainerTransitPtr
DirectionalLightBase::shallowCopyDependent(
330 BitVector bFlags
) const
332 DirectionalLight
*tmpPtr
;
334 newPtr(tmpPtr
, dynamic_cast<const DirectionalLight
*>(this), ~bFlags
);
336 FieldContainerTransitPtr
returnValue(tmpPtr
);
338 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
343 FieldContainerTransitPtr
DirectionalLightBase::shallowCopy(void) const
345 DirectionalLight
*tmpPtr
;
348 dynamic_cast<const DirectionalLight
*>(this),
349 Thread::getCurrentLocalFlags());
351 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
353 FieldContainerTransitPtr
returnValue(tmpPtr
);
361 /*------------------------- constructors ----------------------------------*/
363 DirectionalLightBase::DirectionalLightBase(void) :
365 _sfDirection (Vec3f(0.f
,0.f
,1.f
))
369 DirectionalLightBase::DirectionalLightBase(const DirectionalLightBase
&source
) :
371 _sfDirection (source
._sfDirection
)
376 /*-------------------------- destructors ----------------------------------*/
378 DirectionalLightBase::~DirectionalLightBase(void)
383 GetFieldHandlePtr
DirectionalLightBase::getHandleDirection (void) const
385 SFVec3f::GetHandlePtr
returnValue(
386 new SFVec3f::GetHandle(
388 this->getType().getFieldDesc(DirectionFieldId
),
389 const_cast<DirectionalLightBase
*>(this)));
394 EditFieldHandlePtr
DirectionalLightBase::editHandleDirection (void)
396 SFVec3f::EditHandlePtr
returnValue(
397 new SFVec3f::EditHandle(
399 this->getType().getFieldDesc(DirectionFieldId
),
403 editSField(DirectionFieldMask
);
409 #ifdef OSG_MT_CPTR_ASPECT
410 void DirectionalLightBase::execSyncV( FieldContainer
&oFrom
,
411 ConstFieldMaskArg whichField
,
412 AspectOffsetStore
&oOffsets
,
413 ConstFieldMaskArg syncMode
,
414 const UInt32 uiSyncInfo
)
416 DirectionalLight
*pThis
= static_cast<DirectionalLight
*>(this);
418 pThis
->execSync(static_cast<DirectionalLight
*>(&oFrom
),
427 #ifdef OSG_MT_CPTR_ASPECT
428 FieldContainer
*DirectionalLightBase::createAspectCopy(
429 const FieldContainer
*pRefAspect
) const
431 DirectionalLight
*returnValue
;
433 newAspectCopy(returnValue
,
434 dynamic_cast<const DirectionalLight
*>(pRefAspect
),
435 dynamic_cast<const DirectionalLight
*>(this));
441 void DirectionalLightBase::resolveLinks(void)
443 Inherited::resolveLinks();