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 SimpleShadowMapEngine!
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 "OSGSimpleShadowMapEngineBase.h"
67 #include "OSGSimpleShadowMapEngine.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
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(),
106 OSG_FIELDTRAITS_GETTYPE_NS(SimpleShadowMapEngine
*, nsOSG
)
108 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
109 SimpleShadowMapEngine
*,
112 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
113 SimpleShadowMapEngine
*,
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void SimpleShadowMapEngineBase::classDescInserter(TypeObject
&oType
)
122 FieldDescriptionBase
*pDesc
= NULL
;
125 pDesc
= new SFColor4f::Description(
126 SFColor4f::getClassType(),
129 ShadowColorFieldId
, ShadowColorFieldMask
,
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(),
141 ForceTextureUnitFieldId
, ForceTextureUnitFieldMask
,
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(),
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
)),
163 "<?xml version=\"1.0\" ?>\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"
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"
187 " name=\"forceTextureUnit\"\n"
189 " cardinality=\"single\"\n"
190 " visibility=\"external\"\n"
191 " defaultValue=\"-1\"\n"
192 " access=\"public\"\n"
195 "</FieldContainer>\n",
199 /*------------------------------ get -----------------------------------*/
201 FieldContainerType
&SimpleShadowMapEngineBase::getType(void)
206 const FieldContainerType
&SimpleShadowMapEngineBase::getType(void) const
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();
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
);
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
);
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
);
347 SimpleShadowMapEngine
*SimpleShadowMapEngineBase::createEmptyLocal(BitVector bFlags
)
349 SimpleShadowMapEngine
*returnValue
;
351 newPtr
<SimpleShadowMapEngine
>(returnValue
, bFlags
);
353 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
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();
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
;
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
;
400 FieldContainerTransitPtr
SimpleShadowMapEngineBase::shallowCopy(void) const
402 SimpleShadowMapEngine
*tmpPtr
;
405 dynamic_cast<const SimpleShadowMapEngine
*>(this),
406 Thread::getCurrentLocalFlags());
408 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
410 FieldContainerTransitPtr
returnValue(tmpPtr
);
418 /*------------------------- constructors ----------------------------------*/
420 SimpleShadowMapEngineBase::SimpleShadowMapEngineBase(void) :
422 _sfShadowColor (Color4f(0.f
, 0.f
, 0.f
, 1.f
)),
423 _sfForceTextureUnit (Int32(-1))
427 SimpleShadowMapEngineBase::SimpleShadowMapEngineBase(const SimpleShadowMapEngineBase
&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(
447 this->getType().getFieldDesc(ShadowColorFieldId
),
448 const_cast<SimpleShadowMapEngineBase
*>(this)));
453 EditFieldHandlePtr
SimpleShadowMapEngineBase::editHandleShadowColor (void)
455 SFColor4f::EditHandlePtr
returnValue(
456 new SFColor4f::EditHandle(
458 this->getType().getFieldDesc(ShadowColorFieldId
),
462 editSField(ShadowColorFieldMask
);
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)));
478 EditFieldHandlePtr
SimpleShadowMapEngineBase::editHandleForceTextureUnit(void)
480 SFInt32::EditHandlePtr
returnValue(
481 new SFInt32::EditHandle(
482 &_sfForceTextureUnit
,
483 this->getType().getFieldDesc(ForceTextureUnitFieldId
),
487 editSField(ForceTextureUnitFieldMask
);
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
),
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));
525 void SimpleShadowMapEngineBase::resolveLinks(void)
527 Inherited::resolveLinks();