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 CubeMapGenerator!
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"
65 #include "OSGNode.h" // Root Class
66 #include "OSGTextureObjChunk.h" // Texture Class
67 #include "OSGBackground.h" // Background Class
68 #include "OSGCamera.h" // Camera Class
70 #include "OSGCubeMapGeneratorBase.h"
71 #include "OSGCubeMapGenerator.h"
73 #include <boost/bind.hpp>
77 /***************************************************************************\
79 \***************************************************************************/
81 /*! \class OSG::CubeMapGenerator
85 /***************************************************************************\
86 * Field Documentation *
87 \***************************************************************************/
89 /*! \var Node * CubeMapGeneratorBase::_sfRoot
93 /*! \var Node * CubeMapGeneratorBase::_mfExclude
97 /*! \var TextureObjChunk * CubeMapGeneratorBase::_sfTexture
101 /*! \var Vec2s CubeMapGeneratorBase::_sfTextureSize
105 /*! \var GLenum CubeMapGeneratorBase::_sfTextureFormat
109 /*! \var Node * CubeMapGeneratorBase::_sfBeacon
113 /*! \var Pnt3f CubeMapGeneratorBase::_sfOrigin
117 /*! \var UInt32 CubeMapGeneratorBase::_sfOriginMode
121 /*! \var UInt32 CubeMapGeneratorBase::_sfTexUnit
125 /*! \var UInt32 CubeMapGeneratorBase::_sfSetupMode
129 /*! \var Background * CubeMapGeneratorBase::_sfBackground
133 /*! \var Camera * CubeMapGeneratorBase::_sfCamera
138 /***************************************************************************\
139 * FieldType/FieldTrait Instantiation *
140 \***************************************************************************/
142 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
143 PointerType FieldTraits
<CubeMapGenerator
*, nsOSG
>::_type(
144 "CubeMapGeneratorPtr",
145 "DynamicStateGeneratorPtr",
146 CubeMapGenerator::getClassType(),
150 OSG_FIELDTRAITS_GETTYPE_NS(CubeMapGenerator
*, nsOSG
)
152 /***************************************************************************\
153 * Field Description *
154 \***************************************************************************/
156 void CubeMapGeneratorBase::classDescInserter(TypeObject
&oType
)
158 FieldDescriptionBase
*pDesc
= NULL
;
161 pDesc
= new SFUnrecNodePtr::Description(
162 SFUnrecNodePtr::getClassType(),
165 RootFieldId
, RootFieldMask
,
167 (Field::SFDefaultFlags
| Field::FStdAccess
),
168 static_cast<FieldEditMethodSig
>(&CubeMapGenerator::editHandleRoot
),
169 static_cast<FieldGetMethodSig
>(&CubeMapGenerator::getHandleRoot
));
171 oType
.addInitialDesc(pDesc
);
173 pDesc
= new MFUnrecNodePtr::Description(
174 MFUnrecNodePtr::getClassType(),
177 ExcludeFieldId
, ExcludeFieldMask
,
179 (Field::MFDefaultFlags
| Field::FStdAccess
),
180 static_cast<FieldEditMethodSig
>(&CubeMapGenerator::editHandleExclude
),
181 static_cast<FieldGetMethodSig
>(&CubeMapGenerator::getHandleExclude
));
183 oType
.addInitialDesc(pDesc
);
185 pDesc
= new SFUnrecTextureObjChunkPtr::Description(
186 SFUnrecTextureObjChunkPtr::getClassType(),
189 TextureFieldId
, TextureFieldMask
,
191 (Field::SFDefaultFlags
| Field::FStdAccess
),
192 static_cast<FieldEditMethodSig
>(&CubeMapGenerator::editHandleTexture
),
193 static_cast<FieldGetMethodSig
>(&CubeMapGenerator::getHandleTexture
));
195 oType
.addInitialDesc(pDesc
);
197 pDesc
= new SFVec2s::Description(
198 SFVec2s::getClassType(),
201 TextureSizeFieldId
, TextureSizeFieldMask
,
203 (Field::SFDefaultFlags
| Field::FStdAccess
),
204 static_cast<FieldEditMethodSig
>(&CubeMapGenerator::editHandleTextureSize
),
205 static_cast<FieldGetMethodSig
>(&CubeMapGenerator::getHandleTextureSize
));
207 oType
.addInitialDesc(pDesc
);
209 pDesc
= new SFGLenum::Description(
210 SFGLenum::getClassType(),
213 TextureFormatFieldId
, TextureFormatFieldMask
,
215 (Field::SFDefaultFlags
| Field::FStdAccess
),
216 static_cast<FieldEditMethodSig
>(&CubeMapGenerator::editHandleTextureFormat
),
217 static_cast<FieldGetMethodSig
>(&CubeMapGenerator::getHandleTextureFormat
));
219 oType
.addInitialDesc(pDesc
);
221 pDesc
= new SFWeakNodePtr::Description(
222 SFWeakNodePtr::getClassType(),
225 BeaconFieldId
, BeaconFieldMask
,
227 (Field::SFDefaultFlags
| Field::FStdAccess
),
228 static_cast<FieldEditMethodSig
>(&CubeMapGenerator::editHandleBeacon
),
229 static_cast<FieldGetMethodSig
>(&CubeMapGenerator::getHandleBeacon
));
231 oType
.addInitialDesc(pDesc
);
233 pDesc
= new SFPnt3f::Description(
234 SFPnt3f::getClassType(),
237 OriginFieldId
, OriginFieldMask
,
239 (Field::SFDefaultFlags
| Field::FStdAccess
),
240 static_cast<FieldEditMethodSig
>(&CubeMapGenerator::editHandleOrigin
),
241 static_cast<FieldGetMethodSig
>(&CubeMapGenerator::getHandleOrigin
));
243 oType
.addInitialDesc(pDesc
);
245 pDesc
= new SFUInt32::Description(
246 SFUInt32::getClassType(),
249 OriginModeFieldId
, OriginModeFieldMask
,
251 (Field::SFDefaultFlags
| Field::FStdAccess
),
252 static_cast<FieldEditMethodSig
>(&CubeMapGenerator::editHandleOriginMode
),
253 static_cast<FieldGetMethodSig
>(&CubeMapGenerator::getHandleOriginMode
));
255 oType
.addInitialDesc(pDesc
);
257 pDesc
= new SFUInt32::Description(
258 SFUInt32::getClassType(),
261 TexUnitFieldId
, TexUnitFieldMask
,
263 (Field::SFDefaultFlags
| Field::FStdAccess
),
264 static_cast<FieldEditMethodSig
>(&CubeMapGenerator::editHandleTexUnit
),
265 static_cast<FieldGetMethodSig
>(&CubeMapGenerator::getHandleTexUnit
));
267 oType
.addInitialDesc(pDesc
);
269 pDesc
= new SFUInt32::Description(
270 SFUInt32::getClassType(),
273 SetupModeFieldId
, SetupModeFieldMask
,
275 (Field::SFDefaultFlags
| Field::FStdAccess
),
276 static_cast<FieldEditMethodSig
>(&CubeMapGenerator::editHandleSetupMode
),
277 static_cast<FieldGetMethodSig
>(&CubeMapGenerator::getHandleSetupMode
));
279 oType
.addInitialDesc(pDesc
);
281 pDesc
= new SFUnrecBackgroundPtr::Description(
282 SFUnrecBackgroundPtr::getClassType(),
285 BackgroundFieldId
, BackgroundFieldMask
,
287 (Field::SFDefaultFlags
| Field::FStdAccess
),
288 static_cast<FieldEditMethodSig
>(&CubeMapGenerator::editHandleBackground
),
289 static_cast<FieldGetMethodSig
>(&CubeMapGenerator::getHandleBackground
));
291 oType
.addInitialDesc(pDesc
);
293 pDesc
= new SFUnrecCameraPtr::Description(
294 SFUnrecCameraPtr::getClassType(),
297 CameraFieldId
, CameraFieldMask
,
299 (Field::SFDefaultFlags
| Field::FStdAccess
),
300 static_cast<FieldEditMethodSig
>(&CubeMapGenerator::editHandleCamera
),
301 static_cast<FieldGetMethodSig
>(&CubeMapGenerator::getHandleCamera
));
303 oType
.addInitialDesc(pDesc
);
307 CubeMapGeneratorBase::TypeObject
CubeMapGeneratorBase::_type(
308 CubeMapGeneratorBase::getClassname(),
309 Inherited::getClassname(),
312 reinterpret_cast<PrototypeCreateF
>(&CubeMapGeneratorBase::createEmptyLocal
),
313 reinterpret_cast<InitContainerF
>(&CubeMapGenerator::initMethod
),
314 reinterpret_cast<ExitContainerF
>(&CubeMapGenerator::exitMethod
),
315 reinterpret_cast<InitalInsertDescFunc
>(
316 reinterpret_cast<void *>(&CubeMapGenerator::classDescInserter
)),
319 "<?xml version=\"1.0\"?>\n"
322 " name=\"CubeMapGenerator\"\n"
323 " parent=\"DynamicStateGenerator\"\n"
324 " library=\"Group\"\n"
325 " pointerfieldtypes=\"none\"\n"
326 " structure=\"concrete\"\n"
327 " systemcomponent=\"true\"\n"
328 " parentsystemcomponent=\"true\"\n"
329 " decoratable=\"false\"\n"
330 " useLocalIncludes=\"false\"\n"
331 " isNodeCore=\"true\"\n"
332 " docGroupBase=\"GrpGroupDynamicStateGenerators\"\n"
336 "\t type=\"NodePtr\"\n"
337 "\t cardinality=\"single\"\n"
338 "\t visibility=\"external\"\n"
339 "\t defaultValue=\"NULL\"\n"
340 "\t access=\"public\"\n"
344 "\t name=\"exclude\"\n"
345 "\t type=\"NodePtr\"\n"
346 "\t cardinality=\"multi\"\n"
347 "\t visibility=\"external\"\n"
348 "\t defaultValue=\"\"\n"
349 "\t access=\"public\"\n"
353 "\t name=\"texture\"\n"
354 "\t type=\"TextureObjChunkPtr\"\n"
355 "\t cardinality=\"single\"\n"
356 "\t visibility=\"external\"\n"
357 "\t defaultValue=\"NULL\"\n"
358 "\t access=\"public\"\n"
362 "\t name=\"textureSize\"\n"
363 "\t type=\"Vec2s\"\n"
364 "\t cardinality=\"single\"\n"
365 "\t visibility=\"external\"\n"
366 "\t defaultValue=\"0, 0\"\n"
367 "\t access=\"public\"\n"
371 "\t name=\"textureFormat\"\n"
372 "\t type=\"GLenum\"\n"
373 "\t cardinality=\"single\"\n"
374 "\t visibility=\"external\"\n"
375 "\t defaultValue=\"GL_NONE\"\n"
376 "\t access=\"public\"\n"
380 "\t name=\"beacon\"\n"
382 " category=\"weakpointer\"\n"
383 "\t cardinality=\"single\"\n"
384 "\t visibility=\"external\"\n"
385 "\t defaultValue=\"NULL\"\n"
386 "\t access=\"public\"\n"
390 "\t name=\"origin\"\n"
391 "\t type=\"Pnt3f\"\n"
392 "\t cardinality=\"single\"\n"
393 "\t visibility=\"external\"\n"
394 "\t defaultValue=\"0.f,0.f,0.f\"\n"
395 "\t access=\"public\"\n"
399 "\t name=\"originMode\"\n"
400 "\t type=\"UInt32\"\n"
401 "\t cardinality=\"single\"\n"
402 "\t visibility=\"external\"\n"
403 "\t defaultValue=\"CubeMapGenerator::UseCurrentVolumeCenter\"\n"
404 "\t access=\"public\"\n"
408 "\t name=\"texUnit\"\n"
409 "\t type=\"UInt32\"\n"
410 "\t cardinality=\"single\"\n"
411 "\t visibility=\"external\"\n"
412 "\t defaultValue=\"0\"\n"
413 "\t access=\"public\"\n"
417 "\t name=\"setupMode\"\n"
418 "\t type=\"UInt32\"\n"
419 "\t cardinality=\"single\"\n"
420 "\t visibility=\"external\"\n"
421 "\t defaultValue=\"CubeMapGenerator::SetupAll\"\n"
422 "\t access=\"public\"\n"
426 "\t name=\"background\"\n"
427 "\t type=\"BackgroundPtr\"\n"
428 "\t cardinality=\"single\"\n"
429 "\t visibility=\"external\"\n"
430 "\t defaultValue=\"NULL\"\n"
431 "\t access=\"public\"\n"
435 "\t name=\"camera\"\n"
436 "\t type=\"CameraPtr\"\n"
437 "\t cardinality=\"single\"\n"
438 "\t visibility=\"external\"\n"
439 "\t defaultValue=\"NULL\"\n"
440 "\t access=\"public\"\n"
443 "</FieldContainer>\n",
447 /*------------------------------ get -----------------------------------*/
449 FieldContainerType
&CubeMapGeneratorBase::getType(void)
454 const FieldContainerType
&CubeMapGeneratorBase::getType(void) const
459 UInt32
CubeMapGeneratorBase::getContainerSize(void) const
461 return sizeof(CubeMapGenerator
);
464 /*------------------------- decorator get ------------------------------*/
467 //! Get the CubeMapGenerator::_sfRoot field.
468 const SFUnrecNodePtr
*CubeMapGeneratorBase::getSFRoot(void) const
473 SFUnrecNodePtr
*CubeMapGeneratorBase::editSFRoot (void)
475 editSField(RootFieldMask
);
480 //! Get the value of the CubeMapGenerator::_sfRoot field.
481 Node
* CubeMapGeneratorBase::getRoot(void) const
483 return _sfRoot
.getValue();
486 //! Set the value of the CubeMapGenerator::_sfRoot field.
487 void CubeMapGeneratorBase::setRoot(Node
* const value
)
489 editSField(RootFieldMask
);
491 _sfRoot
.setValue(value
);
495 //! Get the CubeMapGenerator::_mfExclude field.
496 const MFUnrecNodePtr
*CubeMapGeneratorBase::getMFExclude(void) const
501 MFUnrecNodePtr
*CubeMapGeneratorBase::editMFExclude (void)
503 editMField(ExcludeFieldMask
, _mfExclude
);
507 Node
* CubeMapGeneratorBase::getExclude(const UInt32 index
) const
509 return _mfExclude
[index
];
512 //! Get the CubeMapGenerator::_sfTexture field.
513 const SFUnrecTextureObjChunkPtr
*CubeMapGeneratorBase::getSFTexture(void) const
518 SFUnrecTextureObjChunkPtr
*CubeMapGeneratorBase::editSFTexture (void)
520 editSField(TextureFieldMask
);
525 //! Get the value of the CubeMapGenerator::_sfTexture field.
526 TextureObjChunk
* CubeMapGeneratorBase::getTexture(void) const
528 return _sfTexture
.getValue();
531 //! Set the value of the CubeMapGenerator::_sfTexture field.
532 void CubeMapGeneratorBase::setTexture(TextureObjChunk
* const value
)
534 editSField(TextureFieldMask
);
536 _sfTexture
.setValue(value
);
540 SFVec2s
*CubeMapGeneratorBase::editSFTextureSize(void)
542 editSField(TextureSizeFieldMask
);
544 return &_sfTextureSize
;
547 const SFVec2s
*CubeMapGeneratorBase::getSFTextureSize(void) const
549 return &_sfTextureSize
;
553 SFGLenum
*CubeMapGeneratorBase::editSFTextureFormat(void)
555 editSField(TextureFormatFieldMask
);
557 return &_sfTextureFormat
;
560 const SFGLenum
*CubeMapGeneratorBase::getSFTextureFormat(void) const
562 return &_sfTextureFormat
;
566 //! Get the CubeMapGenerator::_sfBeacon field.
567 const SFWeakNodePtr
*CubeMapGeneratorBase::getSFBeacon(void) const
572 SFWeakNodePtr
*CubeMapGeneratorBase::editSFBeacon (void)
574 editSField(BeaconFieldMask
);
579 //! Get the value of the CubeMapGenerator::_sfBeacon field.
580 Node
* CubeMapGeneratorBase::getBeacon(void) const
582 return _sfBeacon
.getValue();
585 //! Set the value of the CubeMapGenerator::_sfBeacon field.
586 void CubeMapGeneratorBase::setBeacon(Node
* const value
)
588 editSField(BeaconFieldMask
);
590 _sfBeacon
.setValue(value
);
594 SFPnt3f
*CubeMapGeneratorBase::editSFOrigin(void)
596 editSField(OriginFieldMask
);
601 const SFPnt3f
*CubeMapGeneratorBase::getSFOrigin(void) const
607 SFUInt32
*CubeMapGeneratorBase::editSFOriginMode(void)
609 editSField(OriginModeFieldMask
);
611 return &_sfOriginMode
;
614 const SFUInt32
*CubeMapGeneratorBase::getSFOriginMode(void) const
616 return &_sfOriginMode
;
620 SFUInt32
*CubeMapGeneratorBase::editSFTexUnit(void)
622 editSField(TexUnitFieldMask
);
627 const SFUInt32
*CubeMapGeneratorBase::getSFTexUnit(void) const
633 SFUInt32
*CubeMapGeneratorBase::editSFSetupMode(void)
635 editSField(SetupModeFieldMask
);
637 return &_sfSetupMode
;
640 const SFUInt32
*CubeMapGeneratorBase::getSFSetupMode(void) const
642 return &_sfSetupMode
;
646 //! Get the CubeMapGenerator::_sfBackground field.
647 const SFUnrecBackgroundPtr
*CubeMapGeneratorBase::getSFBackground(void) const
649 return &_sfBackground
;
652 SFUnrecBackgroundPtr
*CubeMapGeneratorBase::editSFBackground (void)
654 editSField(BackgroundFieldMask
);
656 return &_sfBackground
;
659 //! Get the value of the CubeMapGenerator::_sfBackground field.
660 Background
* CubeMapGeneratorBase::getBackground(void) const
662 return _sfBackground
.getValue();
665 //! Set the value of the CubeMapGenerator::_sfBackground field.
666 void CubeMapGeneratorBase::setBackground(Background
* const value
)
668 editSField(BackgroundFieldMask
);
670 _sfBackground
.setValue(value
);
674 //! Get the CubeMapGenerator::_sfCamera field.
675 const SFUnrecCameraPtr
*CubeMapGeneratorBase::getSFCamera(void) const
680 SFUnrecCameraPtr
*CubeMapGeneratorBase::editSFCamera (void)
682 editSField(CameraFieldMask
);
687 //! Get the value of the CubeMapGenerator::_sfCamera field.
688 Camera
* CubeMapGeneratorBase::getCamera(void) const
690 return _sfCamera
.getValue();
693 //! Set the value of the CubeMapGenerator::_sfCamera field.
694 void CubeMapGeneratorBase::setCamera(Camera
* const value
)
696 editSField(CameraFieldMask
);
698 _sfCamera
.setValue(value
);
704 void CubeMapGeneratorBase::pushToExclude(Node
* const value
)
706 editMField(ExcludeFieldMask
, _mfExclude
);
708 _mfExclude
.push_back(value
);
711 void CubeMapGeneratorBase::assignExclude (const MFUnrecNodePtr
&value
)
713 MFUnrecNodePtr ::const_iterator elemIt
=
715 MFUnrecNodePtr ::const_iterator elemEnd
=
718 static_cast<CubeMapGenerator
*>(this)->clearExclude();
720 while(elemIt
!= elemEnd
)
722 this->pushToExclude(*elemIt
);
728 void CubeMapGeneratorBase::removeFromExclude(UInt32 uiIndex
)
730 if(uiIndex
< _mfExclude
.size())
732 editMField(ExcludeFieldMask
, _mfExclude
);
734 _mfExclude
.erase(uiIndex
);
738 void CubeMapGeneratorBase::removeObjFromExclude(Node
* const value
)
740 Int32 iElemIdx
= _mfExclude
.findIndex(value
);
744 editMField(ExcludeFieldMask
, _mfExclude
);
746 _mfExclude
.erase(iElemIdx
);
749 void CubeMapGeneratorBase::clearExclude(void)
751 editMField(ExcludeFieldMask
, _mfExclude
);
759 /*------------------------------ access -----------------------------------*/
761 SizeT
CubeMapGeneratorBase::getBinSize(ConstFieldMaskArg whichField
)
763 SizeT returnValue
= Inherited::getBinSize(whichField
);
765 if(FieldBits::NoField
!= (RootFieldMask
& whichField
))
767 returnValue
+= _sfRoot
.getBinSize();
769 if(FieldBits::NoField
!= (ExcludeFieldMask
& whichField
))
771 returnValue
+= _mfExclude
.getBinSize();
773 if(FieldBits::NoField
!= (TextureFieldMask
& whichField
))
775 returnValue
+= _sfTexture
.getBinSize();
777 if(FieldBits::NoField
!= (TextureSizeFieldMask
& whichField
))
779 returnValue
+= _sfTextureSize
.getBinSize();
781 if(FieldBits::NoField
!= (TextureFormatFieldMask
& whichField
))
783 returnValue
+= _sfTextureFormat
.getBinSize();
785 if(FieldBits::NoField
!= (BeaconFieldMask
& whichField
))
787 returnValue
+= _sfBeacon
.getBinSize();
789 if(FieldBits::NoField
!= (OriginFieldMask
& whichField
))
791 returnValue
+= _sfOrigin
.getBinSize();
793 if(FieldBits::NoField
!= (OriginModeFieldMask
& whichField
))
795 returnValue
+= _sfOriginMode
.getBinSize();
797 if(FieldBits::NoField
!= (TexUnitFieldMask
& whichField
))
799 returnValue
+= _sfTexUnit
.getBinSize();
801 if(FieldBits::NoField
!= (SetupModeFieldMask
& whichField
))
803 returnValue
+= _sfSetupMode
.getBinSize();
805 if(FieldBits::NoField
!= (BackgroundFieldMask
& whichField
))
807 returnValue
+= _sfBackground
.getBinSize();
809 if(FieldBits::NoField
!= (CameraFieldMask
& whichField
))
811 returnValue
+= _sfCamera
.getBinSize();
817 void CubeMapGeneratorBase::copyToBin(BinaryDataHandler
&pMem
,
818 ConstFieldMaskArg whichField
)
820 Inherited::copyToBin(pMem
, whichField
);
822 if(FieldBits::NoField
!= (RootFieldMask
& whichField
))
824 _sfRoot
.copyToBin(pMem
);
826 if(FieldBits::NoField
!= (ExcludeFieldMask
& whichField
))
828 _mfExclude
.copyToBin(pMem
);
830 if(FieldBits::NoField
!= (TextureFieldMask
& whichField
))
832 _sfTexture
.copyToBin(pMem
);
834 if(FieldBits::NoField
!= (TextureSizeFieldMask
& whichField
))
836 _sfTextureSize
.copyToBin(pMem
);
838 if(FieldBits::NoField
!= (TextureFormatFieldMask
& whichField
))
840 _sfTextureFormat
.copyToBin(pMem
);
842 if(FieldBits::NoField
!= (BeaconFieldMask
& whichField
))
844 _sfBeacon
.copyToBin(pMem
);
846 if(FieldBits::NoField
!= (OriginFieldMask
& whichField
))
848 _sfOrigin
.copyToBin(pMem
);
850 if(FieldBits::NoField
!= (OriginModeFieldMask
& whichField
))
852 _sfOriginMode
.copyToBin(pMem
);
854 if(FieldBits::NoField
!= (TexUnitFieldMask
& whichField
))
856 _sfTexUnit
.copyToBin(pMem
);
858 if(FieldBits::NoField
!= (SetupModeFieldMask
& whichField
))
860 _sfSetupMode
.copyToBin(pMem
);
862 if(FieldBits::NoField
!= (BackgroundFieldMask
& whichField
))
864 _sfBackground
.copyToBin(pMem
);
866 if(FieldBits::NoField
!= (CameraFieldMask
& whichField
))
868 _sfCamera
.copyToBin(pMem
);
872 void CubeMapGeneratorBase::copyFromBin(BinaryDataHandler
&pMem
,
873 ConstFieldMaskArg whichField
)
875 Inherited::copyFromBin(pMem
, whichField
);
877 if(FieldBits::NoField
!= (RootFieldMask
& whichField
))
879 editSField(RootFieldMask
);
880 _sfRoot
.copyFromBin(pMem
);
882 if(FieldBits::NoField
!= (ExcludeFieldMask
& whichField
))
884 editMField(ExcludeFieldMask
, _mfExclude
);
885 _mfExclude
.copyFromBin(pMem
);
887 if(FieldBits::NoField
!= (TextureFieldMask
& whichField
))
889 editSField(TextureFieldMask
);
890 _sfTexture
.copyFromBin(pMem
);
892 if(FieldBits::NoField
!= (TextureSizeFieldMask
& whichField
))
894 editSField(TextureSizeFieldMask
);
895 _sfTextureSize
.copyFromBin(pMem
);
897 if(FieldBits::NoField
!= (TextureFormatFieldMask
& whichField
))
899 editSField(TextureFormatFieldMask
);
900 _sfTextureFormat
.copyFromBin(pMem
);
902 if(FieldBits::NoField
!= (BeaconFieldMask
& whichField
))
904 editSField(BeaconFieldMask
);
905 _sfBeacon
.copyFromBin(pMem
);
907 if(FieldBits::NoField
!= (OriginFieldMask
& whichField
))
909 editSField(OriginFieldMask
);
910 _sfOrigin
.copyFromBin(pMem
);
912 if(FieldBits::NoField
!= (OriginModeFieldMask
& whichField
))
914 editSField(OriginModeFieldMask
);
915 _sfOriginMode
.copyFromBin(pMem
);
917 if(FieldBits::NoField
!= (TexUnitFieldMask
& whichField
))
919 editSField(TexUnitFieldMask
);
920 _sfTexUnit
.copyFromBin(pMem
);
922 if(FieldBits::NoField
!= (SetupModeFieldMask
& whichField
))
924 editSField(SetupModeFieldMask
);
925 _sfSetupMode
.copyFromBin(pMem
);
927 if(FieldBits::NoField
!= (BackgroundFieldMask
& whichField
))
929 editSField(BackgroundFieldMask
);
930 _sfBackground
.copyFromBin(pMem
);
932 if(FieldBits::NoField
!= (CameraFieldMask
& whichField
))
934 editSField(CameraFieldMask
);
935 _sfCamera
.copyFromBin(pMem
);
939 //! create a new instance of the class
940 CubeMapGeneratorTransitPtr
CubeMapGeneratorBase::createLocal(BitVector bFlags
)
942 CubeMapGeneratorTransitPtr fc
;
944 if(getClassType().getPrototype() != NULL
)
946 FieldContainerTransitPtr tmpPtr
=
947 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
949 fc
= dynamic_pointer_cast
<CubeMapGenerator
>(tmpPtr
);
955 //! create a new instance of the class, copy the container flags
956 CubeMapGeneratorTransitPtr
CubeMapGeneratorBase::createDependent(BitVector bFlags
)
958 CubeMapGeneratorTransitPtr fc
;
960 if(getClassType().getPrototype() != NULL
)
962 FieldContainerTransitPtr tmpPtr
=
963 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
965 fc
= dynamic_pointer_cast
<CubeMapGenerator
>(tmpPtr
);
971 //! create a new instance of the class
972 CubeMapGeneratorTransitPtr
CubeMapGeneratorBase::create(void)
974 CubeMapGeneratorTransitPtr fc
;
976 if(getClassType().getPrototype() != NULL
)
978 FieldContainerTransitPtr tmpPtr
=
979 getClassType().getPrototype()-> shallowCopy();
981 fc
= dynamic_pointer_cast
<CubeMapGenerator
>(tmpPtr
);
987 CubeMapGenerator
*CubeMapGeneratorBase::createEmptyLocal(BitVector bFlags
)
989 CubeMapGenerator
*returnValue
;
991 newPtr
<CubeMapGenerator
>(returnValue
, bFlags
);
993 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
998 //! create an empty new instance of the class, do not copy the prototype
999 CubeMapGenerator
*CubeMapGeneratorBase::createEmpty(void)
1001 CubeMapGenerator
*returnValue
;
1003 newPtr
<CubeMapGenerator
>(returnValue
, Thread::getCurrentLocalFlags());
1005 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
1006 ~Thread::getCurrentLocalFlags();
1012 FieldContainerTransitPtr
CubeMapGeneratorBase::shallowCopyLocal(
1013 BitVector bFlags
) const
1015 CubeMapGenerator
*tmpPtr
;
1017 newPtr(tmpPtr
, dynamic_cast<const CubeMapGenerator
*>(this), bFlags
);
1019 FieldContainerTransitPtr
returnValue(tmpPtr
);
1021 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
1026 FieldContainerTransitPtr
CubeMapGeneratorBase::shallowCopyDependent(
1027 BitVector bFlags
) const
1029 CubeMapGenerator
*tmpPtr
;
1031 newPtr(tmpPtr
, dynamic_cast<const CubeMapGenerator
*>(this), ~bFlags
);
1033 FieldContainerTransitPtr
returnValue(tmpPtr
);
1035 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
1040 FieldContainerTransitPtr
CubeMapGeneratorBase::shallowCopy(void) const
1042 CubeMapGenerator
*tmpPtr
;
1045 dynamic_cast<const CubeMapGenerator
*>(this),
1046 Thread::getCurrentLocalFlags());
1048 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
1050 FieldContainerTransitPtr
returnValue(tmpPtr
);
1058 /*------------------------- constructors ----------------------------------*/
1060 CubeMapGeneratorBase::CubeMapGeneratorBase(void) :
1065 _sfTextureSize (Vec2s(0, 0)),
1066 _sfTextureFormat (GLenum(GL_NONE
)),
1068 _sfOrigin (Pnt3f(0.f
,0.f
,0.f
)),
1069 _sfOriginMode (UInt32(CubeMapGenerator::UseCurrentVolumeCenter
)),
1070 _sfTexUnit (UInt32(0)),
1071 _sfSetupMode (UInt32(CubeMapGenerator::SetupAll
)),
1072 _sfBackground (NULL
),
1077 CubeMapGeneratorBase::CubeMapGeneratorBase(const CubeMapGeneratorBase
&source
) :
1082 _sfTextureSize (source
._sfTextureSize
),
1083 _sfTextureFormat (source
._sfTextureFormat
),
1085 _sfOrigin (source
._sfOrigin
),
1086 _sfOriginMode (source
._sfOriginMode
),
1087 _sfTexUnit (source
._sfTexUnit
),
1088 _sfSetupMode (source
._sfSetupMode
),
1089 _sfBackground (NULL
),
1095 /*-------------------------- destructors ----------------------------------*/
1097 CubeMapGeneratorBase::~CubeMapGeneratorBase(void)
1101 void CubeMapGeneratorBase::onCreate(const CubeMapGenerator
*source
)
1103 Inherited::onCreate(source
);
1107 CubeMapGenerator
*pThis
= static_cast<CubeMapGenerator
*>(this);
1109 pThis
->setRoot(source
->getRoot());
1111 MFUnrecNodePtr::const_iterator ExcludeIt
=
1112 source
->_mfExclude
.begin();
1113 MFUnrecNodePtr::const_iterator ExcludeEnd
=
1114 source
->_mfExclude
.end ();
1116 while(ExcludeIt
!= ExcludeEnd
)
1118 pThis
->pushToExclude(*ExcludeIt
);
1123 pThis
->setTexture(source
->getTexture());
1125 pThis
->setBeacon(source
->getBeacon());
1127 pThis
->setBackground(source
->getBackground());
1129 pThis
->setCamera(source
->getCamera());
1133 GetFieldHandlePtr
CubeMapGeneratorBase::getHandleRoot (void) const
1135 SFUnrecNodePtr::GetHandlePtr
returnValue(
1136 new SFUnrecNodePtr::GetHandle(
1138 this->getType().getFieldDesc(RootFieldId
),
1139 const_cast<CubeMapGeneratorBase
*>(this)));
1144 EditFieldHandlePtr
CubeMapGeneratorBase::editHandleRoot (void)
1146 SFUnrecNodePtr::EditHandlePtr
returnValue(
1147 new SFUnrecNodePtr::EditHandle(
1149 this->getType().getFieldDesc(RootFieldId
),
1152 returnValue
->setSetMethod(
1153 boost::bind(&CubeMapGenerator::setRoot
,
1154 static_cast<CubeMapGenerator
*>(this), _1
));
1156 editSField(RootFieldMask
);
1161 GetFieldHandlePtr
CubeMapGeneratorBase::getHandleExclude (void) const
1163 MFUnrecNodePtr::GetHandlePtr
returnValue(
1164 new MFUnrecNodePtr::GetHandle(
1166 this->getType().getFieldDesc(ExcludeFieldId
),
1167 const_cast<CubeMapGeneratorBase
*>(this)));
1172 EditFieldHandlePtr
CubeMapGeneratorBase::editHandleExclude (void)
1174 MFUnrecNodePtr::EditHandlePtr
returnValue(
1175 new MFUnrecNodePtr::EditHandle(
1177 this->getType().getFieldDesc(ExcludeFieldId
),
1180 returnValue
->setAddMethod(
1181 boost::bind(&CubeMapGenerator::pushToExclude
,
1182 static_cast<CubeMapGenerator
*>(this), _1
));
1183 returnValue
->setRemoveMethod(
1184 boost::bind(&CubeMapGenerator::removeFromExclude
,
1185 static_cast<CubeMapGenerator
*>(this), _1
));
1186 returnValue
->setRemoveObjMethod(
1187 boost::bind(&CubeMapGenerator::removeObjFromExclude
,
1188 static_cast<CubeMapGenerator
*>(this), _1
));
1189 returnValue
->setClearMethod(
1190 boost::bind(&CubeMapGenerator::clearExclude
,
1191 static_cast<CubeMapGenerator
*>(this)));
1193 editMField(ExcludeFieldMask
, _mfExclude
);
1198 GetFieldHandlePtr
CubeMapGeneratorBase::getHandleTexture (void) const
1200 SFUnrecTextureObjChunkPtr::GetHandlePtr
returnValue(
1201 new SFUnrecTextureObjChunkPtr::GetHandle(
1203 this->getType().getFieldDesc(TextureFieldId
),
1204 const_cast<CubeMapGeneratorBase
*>(this)));
1209 EditFieldHandlePtr
CubeMapGeneratorBase::editHandleTexture (void)
1211 SFUnrecTextureObjChunkPtr::EditHandlePtr
returnValue(
1212 new SFUnrecTextureObjChunkPtr::EditHandle(
1214 this->getType().getFieldDesc(TextureFieldId
),
1217 returnValue
->setSetMethod(
1218 boost::bind(&CubeMapGenerator::setTexture
,
1219 static_cast<CubeMapGenerator
*>(this), _1
));
1221 editSField(TextureFieldMask
);
1226 GetFieldHandlePtr
CubeMapGeneratorBase::getHandleTextureSize (void) const
1228 SFVec2s::GetHandlePtr
returnValue(
1229 new SFVec2s::GetHandle(
1231 this->getType().getFieldDesc(TextureSizeFieldId
),
1232 const_cast<CubeMapGeneratorBase
*>(this)));
1237 EditFieldHandlePtr
CubeMapGeneratorBase::editHandleTextureSize (void)
1239 SFVec2s::EditHandlePtr
returnValue(
1240 new SFVec2s::EditHandle(
1242 this->getType().getFieldDesc(TextureSizeFieldId
),
1246 editSField(TextureSizeFieldMask
);
1251 GetFieldHandlePtr
CubeMapGeneratorBase::getHandleTextureFormat (void) const
1253 SFGLenum::GetHandlePtr
returnValue(
1254 new SFGLenum::GetHandle(
1256 this->getType().getFieldDesc(TextureFormatFieldId
),
1257 const_cast<CubeMapGeneratorBase
*>(this)));
1262 EditFieldHandlePtr
CubeMapGeneratorBase::editHandleTextureFormat (void)
1264 SFGLenum::EditHandlePtr
returnValue(
1265 new SFGLenum::EditHandle(
1267 this->getType().getFieldDesc(TextureFormatFieldId
),
1271 editSField(TextureFormatFieldMask
);
1276 GetFieldHandlePtr
CubeMapGeneratorBase::getHandleBeacon (void) const
1278 SFWeakNodePtr::GetHandlePtr
returnValue(
1279 new SFWeakNodePtr::GetHandle(
1281 this->getType().getFieldDesc(BeaconFieldId
),
1282 const_cast<CubeMapGeneratorBase
*>(this)));
1287 EditFieldHandlePtr
CubeMapGeneratorBase::editHandleBeacon (void)
1289 SFWeakNodePtr::EditHandlePtr
returnValue(
1290 new SFWeakNodePtr::EditHandle(
1292 this->getType().getFieldDesc(BeaconFieldId
),
1295 returnValue
->setSetMethod(
1296 boost::bind(&CubeMapGenerator::setBeacon
,
1297 static_cast<CubeMapGenerator
*>(this), _1
));
1299 editSField(BeaconFieldMask
);
1304 GetFieldHandlePtr
CubeMapGeneratorBase::getHandleOrigin (void) const
1306 SFPnt3f::GetHandlePtr
returnValue(
1307 new SFPnt3f::GetHandle(
1309 this->getType().getFieldDesc(OriginFieldId
),
1310 const_cast<CubeMapGeneratorBase
*>(this)));
1315 EditFieldHandlePtr
CubeMapGeneratorBase::editHandleOrigin (void)
1317 SFPnt3f::EditHandlePtr
returnValue(
1318 new SFPnt3f::EditHandle(
1320 this->getType().getFieldDesc(OriginFieldId
),
1324 editSField(OriginFieldMask
);
1329 GetFieldHandlePtr
CubeMapGeneratorBase::getHandleOriginMode (void) const
1331 SFUInt32::GetHandlePtr
returnValue(
1332 new SFUInt32::GetHandle(
1334 this->getType().getFieldDesc(OriginModeFieldId
),
1335 const_cast<CubeMapGeneratorBase
*>(this)));
1340 EditFieldHandlePtr
CubeMapGeneratorBase::editHandleOriginMode (void)
1342 SFUInt32::EditHandlePtr
returnValue(
1343 new SFUInt32::EditHandle(
1345 this->getType().getFieldDesc(OriginModeFieldId
),
1349 editSField(OriginModeFieldMask
);
1354 GetFieldHandlePtr
CubeMapGeneratorBase::getHandleTexUnit (void) const
1356 SFUInt32::GetHandlePtr
returnValue(
1357 new SFUInt32::GetHandle(
1359 this->getType().getFieldDesc(TexUnitFieldId
),
1360 const_cast<CubeMapGeneratorBase
*>(this)));
1365 EditFieldHandlePtr
CubeMapGeneratorBase::editHandleTexUnit (void)
1367 SFUInt32::EditHandlePtr
returnValue(
1368 new SFUInt32::EditHandle(
1370 this->getType().getFieldDesc(TexUnitFieldId
),
1374 editSField(TexUnitFieldMask
);
1379 GetFieldHandlePtr
CubeMapGeneratorBase::getHandleSetupMode (void) const
1381 SFUInt32::GetHandlePtr
returnValue(
1382 new SFUInt32::GetHandle(
1384 this->getType().getFieldDesc(SetupModeFieldId
),
1385 const_cast<CubeMapGeneratorBase
*>(this)));
1390 EditFieldHandlePtr
CubeMapGeneratorBase::editHandleSetupMode (void)
1392 SFUInt32::EditHandlePtr
returnValue(
1393 new SFUInt32::EditHandle(
1395 this->getType().getFieldDesc(SetupModeFieldId
),
1399 editSField(SetupModeFieldMask
);
1404 GetFieldHandlePtr
CubeMapGeneratorBase::getHandleBackground (void) const
1406 SFUnrecBackgroundPtr::GetHandlePtr
returnValue(
1407 new SFUnrecBackgroundPtr::GetHandle(
1409 this->getType().getFieldDesc(BackgroundFieldId
),
1410 const_cast<CubeMapGeneratorBase
*>(this)));
1415 EditFieldHandlePtr
CubeMapGeneratorBase::editHandleBackground (void)
1417 SFUnrecBackgroundPtr::EditHandlePtr
returnValue(
1418 new SFUnrecBackgroundPtr::EditHandle(
1420 this->getType().getFieldDesc(BackgroundFieldId
),
1423 returnValue
->setSetMethod(
1424 boost::bind(&CubeMapGenerator::setBackground
,
1425 static_cast<CubeMapGenerator
*>(this), _1
));
1427 editSField(BackgroundFieldMask
);
1432 GetFieldHandlePtr
CubeMapGeneratorBase::getHandleCamera (void) const
1434 SFUnrecCameraPtr::GetHandlePtr
returnValue(
1435 new SFUnrecCameraPtr::GetHandle(
1437 this->getType().getFieldDesc(CameraFieldId
),
1438 const_cast<CubeMapGeneratorBase
*>(this)));
1443 EditFieldHandlePtr
CubeMapGeneratorBase::editHandleCamera (void)
1445 SFUnrecCameraPtr::EditHandlePtr
returnValue(
1446 new SFUnrecCameraPtr::EditHandle(
1448 this->getType().getFieldDesc(CameraFieldId
),
1451 returnValue
->setSetMethod(
1452 boost::bind(&CubeMapGenerator::setCamera
,
1453 static_cast<CubeMapGenerator
*>(this), _1
));
1455 editSField(CameraFieldMask
);
1461 #ifdef OSG_MT_CPTR_ASPECT
1462 void CubeMapGeneratorBase::execSyncV( FieldContainer
&oFrom
,
1463 ConstFieldMaskArg whichField
,
1464 AspectOffsetStore
&oOffsets
,
1465 ConstFieldMaskArg syncMode
,
1466 const UInt32 uiSyncInfo
)
1468 CubeMapGenerator
*pThis
= static_cast<CubeMapGenerator
*>(this);
1470 pThis
->execSync(static_cast<CubeMapGenerator
*>(&oFrom
),
1479 #ifdef OSG_MT_CPTR_ASPECT
1480 FieldContainer
*CubeMapGeneratorBase::createAspectCopy(
1481 const FieldContainer
*pRefAspect
) const
1483 CubeMapGenerator
*returnValue
;
1485 newAspectCopy(returnValue
,
1486 dynamic_cast<const CubeMapGenerator
*>(pRefAspect
),
1487 dynamic_cast<const CubeMapGenerator
*>(this));
1493 void CubeMapGeneratorBase::resolveLinks(void)
1495 Inherited::resolveLinks();
1497 static_cast<CubeMapGenerator
*>(this)->setRoot(NULL
);
1499 static_cast<CubeMapGenerator
*>(this)->clearExclude();
1501 static_cast<CubeMapGenerator
*>(this)->setTexture(NULL
);
1503 static_cast<CubeMapGenerator
*>(this)->setBeacon(NULL
);
1505 static_cast<CubeMapGenerator
*>(this)->setBackground(NULL
);
1507 static_cast<CubeMapGenerator
*>(this)->setCamera(NULL
);