changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Groups / DynamicStateGenerators / OSGCubeMapGeneratorBase.cpp
blobccb5dfa1148e4fdc49aeb979dac528eb01bb1d6d
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 CubeMapGenerator!
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"
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>
75 OSG_BEGIN_NAMESPACE
77 /***************************************************************************\
78 * Description *
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(),
147 nsOSG);
148 #endif
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(),
163 "root",
165 RootFieldId, RootFieldMask,
166 false,
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(),
175 "exclude",
177 ExcludeFieldId, ExcludeFieldMask,
178 false,
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(),
187 "texture",
189 TextureFieldId, TextureFieldMask,
190 false,
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(),
199 "textureSize",
201 TextureSizeFieldId, TextureSizeFieldMask,
202 false,
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(),
211 "textureFormat",
213 TextureFormatFieldId, TextureFormatFieldMask,
214 false,
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(),
223 "beacon",
225 BeaconFieldId, BeaconFieldMask,
226 false,
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(),
235 "origin",
237 OriginFieldId, OriginFieldMask,
238 false,
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(),
247 "originMode",
249 OriginModeFieldId, OriginModeFieldMask,
250 false,
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(),
259 "texUnit",
261 TexUnitFieldId, TexUnitFieldMask,
262 false,
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(),
271 "setupMode",
273 SetupModeFieldId, SetupModeFieldMask,
274 false,
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(),
283 "background",
285 BackgroundFieldId, BackgroundFieldMask,
286 false,
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(),
295 "camera",
297 CameraFieldId, CameraFieldMask,
298 false,
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(),
310 "NULL",
311 nsOSG, //Namespace
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)),
317 false,
319 "<?xml version=\"1.0\"?>\n"
320 "\n"
321 "<FieldContainer\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"
333 " >\n"
334 " <Field\n"
335 "\t name=\"root\"\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"
341 "\t >\n"
342 " </Field>\n"
343 " <Field\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"
350 "\t >\n"
351 " </Field>\n"
352 " <Field\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"
359 "\t >\n"
360 " </Field>\n"
361 " <Field\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"
368 "\t >\n"
369 " </Field>\n"
370 " <Field\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"
377 "\t >\n"
378 " </Field>\n"
379 " <Field\n"
380 "\t name=\"beacon\"\n"
381 "\t type=\"Node\"\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"
387 "\t >\n"
388 " </Field>\n"
389 " <Field\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"
396 "\t >\n"
397 " </Field>\n"
398 " <Field\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"
405 "\t >\n"
406 " </Field>\n"
407 " <Field\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"
414 "\t >\n"
415 " </Field>\n"
416 " <Field\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"
423 "\t >\n"
424 " </Field>\n"
425 " <Field\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"
432 "\t >\n"
433 " </Field>\n"
434 " <Field\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"
441 "\t >\n"
442 " </Field>\n"
443 "</FieldContainer>\n",
447 /*------------------------------ get -----------------------------------*/
449 FieldContainerType &CubeMapGeneratorBase::getType(void)
451 return _type;
454 const FieldContainerType &CubeMapGeneratorBase::getType(void) const
456 return _type;
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
470 return &_sfRoot;
473 SFUnrecNodePtr *CubeMapGeneratorBase::editSFRoot (void)
475 editSField(RootFieldMask);
477 return &_sfRoot;
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
498 return &_mfExclude;
501 MFUnrecNodePtr *CubeMapGeneratorBase::editMFExclude (void)
503 editMField(ExcludeFieldMask, _mfExclude);
505 return &_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
515 return &_sfTexture;
518 SFUnrecTextureObjChunkPtr *CubeMapGeneratorBase::editSFTexture (void)
520 editSField(TextureFieldMask);
522 return &_sfTexture;
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
569 return &_sfBeacon;
572 SFWeakNodePtr *CubeMapGeneratorBase::editSFBeacon (void)
574 editSField(BeaconFieldMask);
576 return &_sfBeacon;
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);
598 return &_sfOrigin;
601 const SFPnt3f *CubeMapGeneratorBase::getSFOrigin(void) const
603 return &_sfOrigin;
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);
624 return &_sfTexUnit;
627 const SFUInt32 *CubeMapGeneratorBase::getSFTexUnit(void) const
629 return &_sfTexUnit;
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
677 return &_sfCamera;
680 SFUnrecCameraPtr *CubeMapGeneratorBase::editSFCamera (void)
682 editSField(CameraFieldMask);
684 return &_sfCamera;
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 =
714 value.begin();
715 MFUnrecNodePtr ::const_iterator elemEnd =
716 value.end ();
718 static_cast<CubeMapGenerator *>(this)->clearExclude();
720 while(elemIt != elemEnd)
722 this->pushToExclude(*elemIt);
724 ++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);
742 if(iElemIdx != -1)
744 editMField(ExcludeFieldMask, _mfExclude);
746 _mfExclude.erase(iElemIdx);
749 void CubeMapGeneratorBase::clearExclude(void)
751 editMField(ExcludeFieldMask, _mfExclude);
754 _mfExclude.clear();
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();
814 return returnValue;
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);
952 return fc;
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);
968 return fc;
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);
984 return fc;
987 CubeMapGenerator *CubeMapGeneratorBase::createEmptyLocal(BitVector bFlags)
989 CubeMapGenerator *returnValue;
991 newPtr<CubeMapGenerator>(returnValue, bFlags);
993 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
995 return returnValue;
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();
1008 return returnValue;
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;
1023 return returnValue;
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;
1037 return returnValue;
1040 FieldContainerTransitPtr CubeMapGeneratorBase::shallowCopy(void) const
1042 CubeMapGenerator *tmpPtr;
1044 newPtr(tmpPtr,
1045 dynamic_cast<const CubeMapGenerator *>(this),
1046 Thread::getCurrentLocalFlags());
1048 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
1050 FieldContainerTransitPtr returnValue(tmpPtr);
1052 return returnValue;
1058 /*------------------------- constructors ----------------------------------*/
1060 CubeMapGeneratorBase::CubeMapGeneratorBase(void) :
1061 Inherited(),
1062 _sfRoot (NULL),
1063 _mfExclude (),
1064 _sfTexture (NULL),
1065 _sfTextureSize (Vec2s(0, 0)),
1066 _sfTextureFormat (GLenum(GL_NONE)),
1067 _sfBeacon (NULL),
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),
1073 _sfCamera (NULL)
1077 CubeMapGeneratorBase::CubeMapGeneratorBase(const CubeMapGeneratorBase &source) :
1078 Inherited(source),
1079 _sfRoot (NULL),
1080 _mfExclude (),
1081 _sfTexture (NULL),
1082 _sfTextureSize (source._sfTextureSize ),
1083 _sfTextureFormat (source._sfTextureFormat ),
1084 _sfBeacon (NULL),
1085 _sfOrigin (source._sfOrigin ),
1086 _sfOriginMode (source._sfOriginMode ),
1087 _sfTexUnit (source._sfTexUnit ),
1088 _sfSetupMode (source._sfSetupMode ),
1089 _sfBackground (NULL),
1090 _sfCamera (NULL)
1095 /*-------------------------- destructors ----------------------------------*/
1097 CubeMapGeneratorBase::~CubeMapGeneratorBase(void)
1101 void CubeMapGeneratorBase::onCreate(const CubeMapGenerator *source)
1103 Inherited::onCreate(source);
1105 if(source != NULL)
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);
1120 ++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(
1137 &_sfRoot,
1138 this->getType().getFieldDesc(RootFieldId),
1139 const_cast<CubeMapGeneratorBase *>(this)));
1141 return returnValue;
1144 EditFieldHandlePtr CubeMapGeneratorBase::editHandleRoot (void)
1146 SFUnrecNodePtr::EditHandlePtr returnValue(
1147 new SFUnrecNodePtr::EditHandle(
1148 &_sfRoot,
1149 this->getType().getFieldDesc(RootFieldId),
1150 this));
1152 returnValue->setSetMethod(
1153 boost::bind(&CubeMapGenerator::setRoot,
1154 static_cast<CubeMapGenerator *>(this), _1));
1156 editSField(RootFieldMask);
1158 return returnValue;
1161 GetFieldHandlePtr CubeMapGeneratorBase::getHandleExclude (void) const
1163 MFUnrecNodePtr::GetHandlePtr returnValue(
1164 new MFUnrecNodePtr::GetHandle(
1165 &_mfExclude,
1166 this->getType().getFieldDesc(ExcludeFieldId),
1167 const_cast<CubeMapGeneratorBase *>(this)));
1169 return returnValue;
1172 EditFieldHandlePtr CubeMapGeneratorBase::editHandleExclude (void)
1174 MFUnrecNodePtr::EditHandlePtr returnValue(
1175 new MFUnrecNodePtr::EditHandle(
1176 &_mfExclude,
1177 this->getType().getFieldDesc(ExcludeFieldId),
1178 this));
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);
1195 return returnValue;
1198 GetFieldHandlePtr CubeMapGeneratorBase::getHandleTexture (void) const
1200 SFUnrecTextureObjChunkPtr::GetHandlePtr returnValue(
1201 new SFUnrecTextureObjChunkPtr::GetHandle(
1202 &_sfTexture,
1203 this->getType().getFieldDesc(TextureFieldId),
1204 const_cast<CubeMapGeneratorBase *>(this)));
1206 return returnValue;
1209 EditFieldHandlePtr CubeMapGeneratorBase::editHandleTexture (void)
1211 SFUnrecTextureObjChunkPtr::EditHandlePtr returnValue(
1212 new SFUnrecTextureObjChunkPtr::EditHandle(
1213 &_sfTexture,
1214 this->getType().getFieldDesc(TextureFieldId),
1215 this));
1217 returnValue->setSetMethod(
1218 boost::bind(&CubeMapGenerator::setTexture,
1219 static_cast<CubeMapGenerator *>(this), _1));
1221 editSField(TextureFieldMask);
1223 return returnValue;
1226 GetFieldHandlePtr CubeMapGeneratorBase::getHandleTextureSize (void) const
1228 SFVec2s::GetHandlePtr returnValue(
1229 new SFVec2s::GetHandle(
1230 &_sfTextureSize,
1231 this->getType().getFieldDesc(TextureSizeFieldId),
1232 const_cast<CubeMapGeneratorBase *>(this)));
1234 return returnValue;
1237 EditFieldHandlePtr CubeMapGeneratorBase::editHandleTextureSize (void)
1239 SFVec2s::EditHandlePtr returnValue(
1240 new SFVec2s::EditHandle(
1241 &_sfTextureSize,
1242 this->getType().getFieldDesc(TextureSizeFieldId),
1243 this));
1246 editSField(TextureSizeFieldMask);
1248 return returnValue;
1251 GetFieldHandlePtr CubeMapGeneratorBase::getHandleTextureFormat (void) const
1253 SFGLenum::GetHandlePtr returnValue(
1254 new SFGLenum::GetHandle(
1255 &_sfTextureFormat,
1256 this->getType().getFieldDesc(TextureFormatFieldId),
1257 const_cast<CubeMapGeneratorBase *>(this)));
1259 return returnValue;
1262 EditFieldHandlePtr CubeMapGeneratorBase::editHandleTextureFormat (void)
1264 SFGLenum::EditHandlePtr returnValue(
1265 new SFGLenum::EditHandle(
1266 &_sfTextureFormat,
1267 this->getType().getFieldDesc(TextureFormatFieldId),
1268 this));
1271 editSField(TextureFormatFieldMask);
1273 return returnValue;
1276 GetFieldHandlePtr CubeMapGeneratorBase::getHandleBeacon (void) const
1278 SFWeakNodePtr::GetHandlePtr returnValue(
1279 new SFWeakNodePtr::GetHandle(
1280 &_sfBeacon,
1281 this->getType().getFieldDesc(BeaconFieldId),
1282 const_cast<CubeMapGeneratorBase *>(this)));
1284 return returnValue;
1287 EditFieldHandlePtr CubeMapGeneratorBase::editHandleBeacon (void)
1289 SFWeakNodePtr::EditHandlePtr returnValue(
1290 new SFWeakNodePtr::EditHandle(
1291 &_sfBeacon,
1292 this->getType().getFieldDesc(BeaconFieldId),
1293 this));
1295 returnValue->setSetMethod(
1296 boost::bind(&CubeMapGenerator::setBeacon,
1297 static_cast<CubeMapGenerator *>(this), _1));
1299 editSField(BeaconFieldMask);
1301 return returnValue;
1304 GetFieldHandlePtr CubeMapGeneratorBase::getHandleOrigin (void) const
1306 SFPnt3f::GetHandlePtr returnValue(
1307 new SFPnt3f::GetHandle(
1308 &_sfOrigin,
1309 this->getType().getFieldDesc(OriginFieldId),
1310 const_cast<CubeMapGeneratorBase *>(this)));
1312 return returnValue;
1315 EditFieldHandlePtr CubeMapGeneratorBase::editHandleOrigin (void)
1317 SFPnt3f::EditHandlePtr returnValue(
1318 new SFPnt3f::EditHandle(
1319 &_sfOrigin,
1320 this->getType().getFieldDesc(OriginFieldId),
1321 this));
1324 editSField(OriginFieldMask);
1326 return returnValue;
1329 GetFieldHandlePtr CubeMapGeneratorBase::getHandleOriginMode (void) const
1331 SFUInt32::GetHandlePtr returnValue(
1332 new SFUInt32::GetHandle(
1333 &_sfOriginMode,
1334 this->getType().getFieldDesc(OriginModeFieldId),
1335 const_cast<CubeMapGeneratorBase *>(this)));
1337 return returnValue;
1340 EditFieldHandlePtr CubeMapGeneratorBase::editHandleOriginMode (void)
1342 SFUInt32::EditHandlePtr returnValue(
1343 new SFUInt32::EditHandle(
1344 &_sfOriginMode,
1345 this->getType().getFieldDesc(OriginModeFieldId),
1346 this));
1349 editSField(OriginModeFieldMask);
1351 return returnValue;
1354 GetFieldHandlePtr CubeMapGeneratorBase::getHandleTexUnit (void) const
1356 SFUInt32::GetHandlePtr returnValue(
1357 new SFUInt32::GetHandle(
1358 &_sfTexUnit,
1359 this->getType().getFieldDesc(TexUnitFieldId),
1360 const_cast<CubeMapGeneratorBase *>(this)));
1362 return returnValue;
1365 EditFieldHandlePtr CubeMapGeneratorBase::editHandleTexUnit (void)
1367 SFUInt32::EditHandlePtr returnValue(
1368 new SFUInt32::EditHandle(
1369 &_sfTexUnit,
1370 this->getType().getFieldDesc(TexUnitFieldId),
1371 this));
1374 editSField(TexUnitFieldMask);
1376 return returnValue;
1379 GetFieldHandlePtr CubeMapGeneratorBase::getHandleSetupMode (void) const
1381 SFUInt32::GetHandlePtr returnValue(
1382 new SFUInt32::GetHandle(
1383 &_sfSetupMode,
1384 this->getType().getFieldDesc(SetupModeFieldId),
1385 const_cast<CubeMapGeneratorBase *>(this)));
1387 return returnValue;
1390 EditFieldHandlePtr CubeMapGeneratorBase::editHandleSetupMode (void)
1392 SFUInt32::EditHandlePtr returnValue(
1393 new SFUInt32::EditHandle(
1394 &_sfSetupMode,
1395 this->getType().getFieldDesc(SetupModeFieldId),
1396 this));
1399 editSField(SetupModeFieldMask);
1401 return returnValue;
1404 GetFieldHandlePtr CubeMapGeneratorBase::getHandleBackground (void) const
1406 SFUnrecBackgroundPtr::GetHandlePtr returnValue(
1407 new SFUnrecBackgroundPtr::GetHandle(
1408 &_sfBackground,
1409 this->getType().getFieldDesc(BackgroundFieldId),
1410 const_cast<CubeMapGeneratorBase *>(this)));
1412 return returnValue;
1415 EditFieldHandlePtr CubeMapGeneratorBase::editHandleBackground (void)
1417 SFUnrecBackgroundPtr::EditHandlePtr returnValue(
1418 new SFUnrecBackgroundPtr::EditHandle(
1419 &_sfBackground,
1420 this->getType().getFieldDesc(BackgroundFieldId),
1421 this));
1423 returnValue->setSetMethod(
1424 boost::bind(&CubeMapGenerator::setBackground,
1425 static_cast<CubeMapGenerator *>(this), _1));
1427 editSField(BackgroundFieldMask);
1429 return returnValue;
1432 GetFieldHandlePtr CubeMapGeneratorBase::getHandleCamera (void) const
1434 SFUnrecCameraPtr::GetHandlePtr returnValue(
1435 new SFUnrecCameraPtr::GetHandle(
1436 &_sfCamera,
1437 this->getType().getFieldDesc(CameraFieldId),
1438 const_cast<CubeMapGeneratorBase *>(this)));
1440 return returnValue;
1443 EditFieldHandlePtr CubeMapGeneratorBase::editHandleCamera (void)
1445 SFUnrecCameraPtr::EditHandlePtr returnValue(
1446 new SFUnrecCameraPtr::EditHandle(
1447 &_sfCamera,
1448 this->getType().getFieldDesc(CameraFieldId),
1449 this));
1451 returnValue->setSetMethod(
1452 boost::bind(&CubeMapGenerator::setCamera,
1453 static_cast<CubeMapGenerator *>(this), _1));
1455 editSField(CameraFieldMask);
1457 return returnValue;
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),
1471 whichField,
1472 oOffsets,
1473 syncMode,
1474 uiSyncInfo);
1476 #endif
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));
1489 return returnValue;
1491 #endif
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);
1513 OSG_END_NAMESPACE