changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Groups / Light / OSGDirectionalLightBase.cpp
blob3eb2330fecfee107c110107ad5379d1a6c317a5a
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
41 ** **
42 ** This file is automatically generated. **
43 ** **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
46 ** **
47 ** Do not change this file, changes should be done in the derived **
48 ** class DirectionalLight!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #ifdef WIN32
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
59 #endif
61 #include "OSGConfig.h"
66 #include "OSGDirectionalLightBase.h"
67 #include "OSGDirectionalLight.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
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",
98 "LightPtr",
99 DirectionalLight::getClassType(),
100 nsOSG);
101 #endif
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(),
116 "direction",
118 DirectionFieldId, DirectionFieldMask,
119 false,
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(),
131 "NULL",
132 nsOSG, //Namespace
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)),
138 false,
140 "<?xml version=\"1.0\" ?>\n"
141 "\n"
142 "<FieldContainer\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"
152 " >\n"
153 " DirectionalLight is an infinitely distant lightsource. Its only\n"
154 " attribute is the light's direction.\n"
155 " <Field\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"
161 "\t >\n"
162 " </Field>\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)
172 return _type;
175 const FieldContainerType &DirectionalLightBase::getType(void) const
177 return _type;
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();
216 return returnValue;
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);
255 return fc;
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);
271 return fc;
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);
287 return fc;
290 DirectionalLight *DirectionalLightBase::createEmptyLocal(BitVector bFlags)
292 DirectionalLight *returnValue;
294 newPtr<DirectionalLight>(returnValue, bFlags);
296 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
298 return returnValue;
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();
311 return returnValue;
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;
326 return returnValue;
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;
340 return returnValue;
343 FieldContainerTransitPtr DirectionalLightBase::shallowCopy(void) const
345 DirectionalLight *tmpPtr;
347 newPtr(tmpPtr,
348 dynamic_cast<const DirectionalLight *>(this),
349 Thread::getCurrentLocalFlags());
351 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
353 FieldContainerTransitPtr returnValue(tmpPtr);
355 return returnValue;
361 /*------------------------- constructors ----------------------------------*/
363 DirectionalLightBase::DirectionalLightBase(void) :
364 Inherited(),
365 _sfDirection (Vec3f(0.f,0.f,1.f))
369 DirectionalLightBase::DirectionalLightBase(const DirectionalLightBase &source) :
370 Inherited(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(
387 &_sfDirection,
388 this->getType().getFieldDesc(DirectionFieldId),
389 const_cast<DirectionalLightBase *>(this)));
391 return returnValue;
394 EditFieldHandlePtr DirectionalLightBase::editHandleDirection (void)
396 SFVec3f::EditHandlePtr returnValue(
397 new SFVec3f::EditHandle(
398 &_sfDirection,
399 this->getType().getFieldDesc(DirectionFieldId),
400 this));
403 editSField(DirectionFieldMask);
405 return returnValue;
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),
419 whichField,
420 oOffsets,
421 syncMode,
422 uiSyncInfo);
424 #endif
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));
437 return returnValue;
439 #endif
441 void DirectionalLightBase::resolveLinks(void)
443 Inherited::resolveLinks();
449 OSG_END_NAMESPACE