changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Groups / Light / Shadow / Engines / OSGSimpleShadowMapEngineBase.cpp
blob21aae97cc7b003ef3399a43b8584faa38c136da8
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 SimpleShadowMapEngine!
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 "OSGSimpleShadowMapEngineBase.h"
67 #include "OSGSimpleShadowMapEngine.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::SimpleShadowMapEngine
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Color4f SimpleShadowMapEngineBase::_sfShadowColor
89 /*! \var Int32 SimpleShadowMapEngineBase::_sfForceTextureUnit
94 /***************************************************************************\
95 * FieldType/FieldTrait Instantiation *
96 \***************************************************************************/
98 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
99 PointerType FieldTraits<SimpleShadowMapEngine *, nsOSG>::_type(
100 "SimpleShadowMapEnginePtr",
101 "ShadowMapEnginePtr",
102 SimpleShadowMapEngine::getClassType(),
103 nsOSG);
104 #endif
106 OSG_FIELDTRAITS_GETTYPE_NS(SimpleShadowMapEngine *, nsOSG)
108 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
109 SimpleShadowMapEngine *,
110 nsOSG)
112 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
113 SimpleShadowMapEngine *,
114 nsOSG)
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void SimpleShadowMapEngineBase::classDescInserter(TypeObject &oType)
122 FieldDescriptionBase *pDesc = NULL;
125 pDesc = new SFColor4f::Description(
126 SFColor4f::getClassType(),
127 "shadowColor",
129 ShadowColorFieldId, ShadowColorFieldMask,
130 false,
131 (Field::SFDefaultFlags | Field::FStdAccess),
132 static_cast<FieldEditMethodSig>(&SimpleShadowMapEngine::editHandleShadowColor),
133 static_cast<FieldGetMethodSig >(&SimpleShadowMapEngine::getHandleShadowColor));
135 oType.addInitialDesc(pDesc);
137 pDesc = new SFInt32::Description(
138 SFInt32::getClassType(),
139 "forceTextureUnit",
141 ForceTextureUnitFieldId, ForceTextureUnitFieldMask,
142 false,
143 (Field::SFDefaultFlags | Field::FStdAccess),
144 static_cast<FieldEditMethodSig>(&SimpleShadowMapEngine::editHandleForceTextureUnit),
145 static_cast<FieldGetMethodSig >(&SimpleShadowMapEngine::getHandleForceTextureUnit));
147 oType.addInitialDesc(pDesc);
151 SimpleShadowMapEngineBase::TypeObject SimpleShadowMapEngineBase::_type(
152 SimpleShadowMapEngineBase::getClassname(),
153 Inherited::getClassname(),
154 "NULL",
155 nsOSG, //Namespace
156 reinterpret_cast<PrototypeCreateF>(&SimpleShadowMapEngineBase::createEmptyLocal),
157 reinterpret_cast<InitContainerF>(&SimpleShadowMapEngine::initMethod),
158 reinterpret_cast<ExitContainerF>(&SimpleShadowMapEngine::exitMethod),
159 reinterpret_cast<InitalInsertDescFunc>(
160 reinterpret_cast<void *>(&SimpleShadowMapEngine::classDescInserter)),
161 false,
163 "<?xml version=\"1.0\" ?>\n"
164 "\n"
165 "<FieldContainer\n"
166 " name=\"SimpleShadowMapEngine\"\n"
167 " parent=\"ShadowMapEngine\"\n"
168 " library=\"Group\"\n"
169 " structure=\"concrete\"\n"
170 " pointerfieldtypes=\"both\"\n"
171 " systemcomponent=\"true\"\n"
172 " parentsystemcomponent=\"true\"\n"
173 " isNodeCore=\"false\"\n"
174 " docGroupBase=\"GrpGroupLightShadowEngines\"\n"
175 " >\n"
176 " <Field\n"
177 " name=\"shadowColor\"\n"
178 " category=\"data\"\n"
179 " type=\"Color4f\"\n"
180 " cardinality=\"single\"\n"
181 " visibility=\"external\"\n"
182 " defaultValue=\"0.f, 0.f, 0.f, 1.f\"\n"
183 " access=\"public\"\n"
184 " >\n"
185 " </Field>\n"
186 " <Field\n"
187 " name=\"forceTextureUnit\"\n"
188 " type=\"Int32\"\n"
189 " cardinality=\"single\"\n"
190 " visibility=\"external\"\n"
191 " defaultValue=\"-1\"\n"
192 " access=\"public\"\n"
193 " >\n"
194 " </Field>\n"
195 "</FieldContainer>\n",
199 /*------------------------------ get -----------------------------------*/
201 FieldContainerType &SimpleShadowMapEngineBase::getType(void)
203 return _type;
206 const FieldContainerType &SimpleShadowMapEngineBase::getType(void) const
208 return _type;
211 UInt32 SimpleShadowMapEngineBase::getContainerSize(void) const
213 return sizeof(SimpleShadowMapEngine);
216 /*------------------------- decorator get ------------------------------*/
219 SFColor4f *SimpleShadowMapEngineBase::editSFShadowColor(void)
221 editSField(ShadowColorFieldMask);
223 return &_sfShadowColor;
226 const SFColor4f *SimpleShadowMapEngineBase::getSFShadowColor(void) const
228 return &_sfShadowColor;
232 SFInt32 *SimpleShadowMapEngineBase::editSFForceTextureUnit(void)
234 editSField(ForceTextureUnitFieldMask);
236 return &_sfForceTextureUnit;
239 const SFInt32 *SimpleShadowMapEngineBase::getSFForceTextureUnit(void) const
241 return &_sfForceTextureUnit;
249 /*------------------------------ access -----------------------------------*/
251 SizeT SimpleShadowMapEngineBase::getBinSize(ConstFieldMaskArg whichField)
253 SizeT returnValue = Inherited::getBinSize(whichField);
255 if(FieldBits::NoField != (ShadowColorFieldMask & whichField))
257 returnValue += _sfShadowColor.getBinSize();
259 if(FieldBits::NoField != (ForceTextureUnitFieldMask & whichField))
261 returnValue += _sfForceTextureUnit.getBinSize();
264 return returnValue;
267 void SimpleShadowMapEngineBase::copyToBin(BinaryDataHandler &pMem,
268 ConstFieldMaskArg whichField)
270 Inherited::copyToBin(pMem, whichField);
272 if(FieldBits::NoField != (ShadowColorFieldMask & whichField))
274 _sfShadowColor.copyToBin(pMem);
276 if(FieldBits::NoField != (ForceTextureUnitFieldMask & whichField))
278 _sfForceTextureUnit.copyToBin(pMem);
282 void SimpleShadowMapEngineBase::copyFromBin(BinaryDataHandler &pMem,
283 ConstFieldMaskArg whichField)
285 Inherited::copyFromBin(pMem, whichField);
287 if(FieldBits::NoField != (ShadowColorFieldMask & whichField))
289 editSField(ShadowColorFieldMask);
290 _sfShadowColor.copyFromBin(pMem);
292 if(FieldBits::NoField != (ForceTextureUnitFieldMask & whichField))
294 editSField(ForceTextureUnitFieldMask);
295 _sfForceTextureUnit.copyFromBin(pMem);
299 //! create a new instance of the class
300 SimpleShadowMapEngineTransitPtr SimpleShadowMapEngineBase::createLocal(BitVector bFlags)
302 SimpleShadowMapEngineTransitPtr fc;
304 if(getClassType().getPrototype() != NULL)
306 FieldContainerTransitPtr tmpPtr =
307 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
309 fc = dynamic_pointer_cast<SimpleShadowMapEngine>(tmpPtr);
312 return fc;
315 //! create a new instance of the class, copy the container flags
316 SimpleShadowMapEngineTransitPtr SimpleShadowMapEngineBase::createDependent(BitVector bFlags)
318 SimpleShadowMapEngineTransitPtr fc;
320 if(getClassType().getPrototype() != NULL)
322 FieldContainerTransitPtr tmpPtr =
323 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
325 fc = dynamic_pointer_cast<SimpleShadowMapEngine>(tmpPtr);
328 return fc;
331 //! create a new instance of the class
332 SimpleShadowMapEngineTransitPtr SimpleShadowMapEngineBase::create(void)
334 SimpleShadowMapEngineTransitPtr fc;
336 if(getClassType().getPrototype() != NULL)
338 FieldContainerTransitPtr tmpPtr =
339 getClassType().getPrototype()-> shallowCopy();
341 fc = dynamic_pointer_cast<SimpleShadowMapEngine>(tmpPtr);
344 return fc;
347 SimpleShadowMapEngine *SimpleShadowMapEngineBase::createEmptyLocal(BitVector bFlags)
349 SimpleShadowMapEngine *returnValue;
351 newPtr<SimpleShadowMapEngine>(returnValue, bFlags);
353 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
355 return returnValue;
358 //! create an empty new instance of the class, do not copy the prototype
359 SimpleShadowMapEngine *SimpleShadowMapEngineBase::createEmpty(void)
361 SimpleShadowMapEngine *returnValue;
363 newPtr<SimpleShadowMapEngine>(returnValue, Thread::getCurrentLocalFlags());
365 returnValue->_pFieldFlags->_bNamespaceMask &=
366 ~Thread::getCurrentLocalFlags();
368 return returnValue;
372 FieldContainerTransitPtr SimpleShadowMapEngineBase::shallowCopyLocal(
373 BitVector bFlags) const
375 SimpleShadowMapEngine *tmpPtr;
377 newPtr(tmpPtr, dynamic_cast<const SimpleShadowMapEngine *>(this), bFlags);
379 FieldContainerTransitPtr returnValue(tmpPtr);
381 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
383 return returnValue;
386 FieldContainerTransitPtr SimpleShadowMapEngineBase::shallowCopyDependent(
387 BitVector bFlags) const
389 SimpleShadowMapEngine *tmpPtr;
391 newPtr(tmpPtr, dynamic_cast<const SimpleShadowMapEngine *>(this), ~bFlags);
393 FieldContainerTransitPtr returnValue(tmpPtr);
395 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
397 return returnValue;
400 FieldContainerTransitPtr SimpleShadowMapEngineBase::shallowCopy(void) const
402 SimpleShadowMapEngine *tmpPtr;
404 newPtr(tmpPtr,
405 dynamic_cast<const SimpleShadowMapEngine *>(this),
406 Thread::getCurrentLocalFlags());
408 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
410 FieldContainerTransitPtr returnValue(tmpPtr);
412 return returnValue;
418 /*------------------------- constructors ----------------------------------*/
420 SimpleShadowMapEngineBase::SimpleShadowMapEngineBase(void) :
421 Inherited(),
422 _sfShadowColor (Color4f(0.f, 0.f, 0.f, 1.f)),
423 _sfForceTextureUnit (Int32(-1))
427 SimpleShadowMapEngineBase::SimpleShadowMapEngineBase(const SimpleShadowMapEngineBase &source) :
428 Inherited(source),
429 _sfShadowColor (source._sfShadowColor ),
430 _sfForceTextureUnit (source._sfForceTextureUnit )
435 /*-------------------------- destructors ----------------------------------*/
437 SimpleShadowMapEngineBase::~SimpleShadowMapEngineBase(void)
442 GetFieldHandlePtr SimpleShadowMapEngineBase::getHandleShadowColor (void) const
444 SFColor4f::GetHandlePtr returnValue(
445 new SFColor4f::GetHandle(
446 &_sfShadowColor,
447 this->getType().getFieldDesc(ShadowColorFieldId),
448 const_cast<SimpleShadowMapEngineBase *>(this)));
450 return returnValue;
453 EditFieldHandlePtr SimpleShadowMapEngineBase::editHandleShadowColor (void)
455 SFColor4f::EditHandlePtr returnValue(
456 new SFColor4f::EditHandle(
457 &_sfShadowColor,
458 this->getType().getFieldDesc(ShadowColorFieldId),
459 this));
462 editSField(ShadowColorFieldMask);
464 return returnValue;
467 GetFieldHandlePtr SimpleShadowMapEngineBase::getHandleForceTextureUnit (void) const
469 SFInt32::GetHandlePtr returnValue(
470 new SFInt32::GetHandle(
471 &_sfForceTextureUnit,
472 this->getType().getFieldDesc(ForceTextureUnitFieldId),
473 const_cast<SimpleShadowMapEngineBase *>(this)));
475 return returnValue;
478 EditFieldHandlePtr SimpleShadowMapEngineBase::editHandleForceTextureUnit(void)
480 SFInt32::EditHandlePtr returnValue(
481 new SFInt32::EditHandle(
482 &_sfForceTextureUnit,
483 this->getType().getFieldDesc(ForceTextureUnitFieldId),
484 this));
487 editSField(ForceTextureUnitFieldMask);
489 return returnValue;
493 #ifdef OSG_MT_CPTR_ASPECT
494 void SimpleShadowMapEngineBase::execSyncV( FieldContainer &oFrom,
495 ConstFieldMaskArg whichField,
496 AspectOffsetStore &oOffsets,
497 ConstFieldMaskArg syncMode,
498 const UInt32 uiSyncInfo)
500 SimpleShadowMapEngine *pThis = static_cast<SimpleShadowMapEngine *>(this);
502 pThis->execSync(static_cast<SimpleShadowMapEngine *>(&oFrom),
503 whichField,
504 oOffsets,
505 syncMode,
506 uiSyncInfo);
508 #endif
511 #ifdef OSG_MT_CPTR_ASPECT
512 FieldContainer *SimpleShadowMapEngineBase::createAspectCopy(
513 const FieldContainer *pRefAspect) const
515 SimpleShadowMapEngine *returnValue;
517 newAspectCopy(returnValue,
518 dynamic_cast<const SimpleShadowMapEngine *>(pRefAspect),
519 dynamic_cast<const SimpleShadowMapEngine *>(this));
521 return returnValue;
523 #endif
525 void SimpleShadowMapEngineBase::resolveLinks(void)
527 Inherited::resolveLinks();
533 OSG_END_NAMESPACE