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 **
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 "OSGCamera.h" // Camera Class
67 #include "OSGBackground.h" // Background Class
68 #include "OSGForeground.h" // Foregrounds Class
69 #include "OSGRenderOptions.h" // RenderOptions Class
71 #include "OSGCSMViewportBase.h"
72 #include "OSGCSMViewport.h"
74 #include <boost/bind.hpp>
78 /***************************************************************************\
80 \***************************************************************************/
82 /*! \class OSG::CSMViewport
86 /***************************************************************************\
87 * Field Documentation *
88 \***************************************************************************/
90 /*! \var Node * CSMViewportBase::_sfRoot
94 /*! \var Camera * CSMViewportBase::_sfCamera
98 /*! \var Background * CSMViewportBase::_sfBackground
102 /*! \var Foreground * CSMViewportBase::_mfForegrounds
106 /*! \var Vec2f CSMViewportBase::_sfLeftBottom
110 /*! \var Vec2f CSMViewportBase::_sfRightTop
114 /*! \var UInt32 CSMViewportBase::_sfTravMask
118 /*! \var RenderOptions * CSMViewportBase::_sfRenderOptions
122 /*! \var std::string CSMViewportBase::_sfStereoMode
126 /*! \var bool CSMViewportBase::_sfPassive
130 /*! \var Int32 CSMViewportBase::_sfServerId
131 If not -1 used by the cluster multi window to compute the corresponding
135 /*! \var MouseData CSMViewportBase::_sfMouseDataVC
136 MTouchData in local viewport coordinates
139 /*! \var MTouchData CSMViewportBase::_sfMTouchDataVC
140 MTouchData in local viewport coordinates
144 /***************************************************************************\
145 * FieldType/FieldTrait Instantiation *
146 \***************************************************************************/
148 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
149 PointerType FieldTraits
<CSMViewport
*, nsOSG
>::_type(
151 "AttachmentContainerPtr",
152 CSMViewport::getClassType(),
156 OSG_FIELDTRAITS_GETTYPE_NS(CSMViewport
*, nsOSG
)
158 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
162 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
166 /***************************************************************************\
167 * Field Description *
168 \***************************************************************************/
170 void CSMViewportBase::classDescInserter(TypeObject
&oType
)
172 FieldDescriptionBase
*pDesc
= NULL
;
175 pDesc
= new SFUnrecNodePtr::Description(
176 SFUnrecNodePtr::getClassType(),
179 RootFieldId
, RootFieldMask
,
181 (Field::SFDefaultFlags
| Field::FStdAccess
),
182 static_cast<FieldEditMethodSig
>(&CSMViewport::editHandleRoot
),
183 static_cast<FieldGetMethodSig
>(&CSMViewport::getHandleRoot
));
185 oType
.addInitialDesc(pDesc
);
187 pDesc
= new SFUnrecCameraPtr::Description(
188 SFUnrecCameraPtr::getClassType(),
191 CameraFieldId
, CameraFieldMask
,
193 (Field::SFDefaultFlags
| Field::FStdAccess
),
194 static_cast<FieldEditMethodSig
>(&CSMViewport::editHandleCamera
),
195 static_cast<FieldGetMethodSig
>(&CSMViewport::getHandleCamera
));
197 oType
.addInitialDesc(pDesc
);
199 pDesc
= new SFUnrecBackgroundPtr::Description(
200 SFUnrecBackgroundPtr::getClassType(),
203 BackgroundFieldId
, BackgroundFieldMask
,
205 (Field::SFDefaultFlags
| Field::FStdAccess
),
206 static_cast<FieldEditMethodSig
>(&CSMViewport::editHandleBackground
),
207 static_cast<FieldGetMethodSig
>(&CSMViewport::getHandleBackground
));
209 oType
.addInitialDesc(pDesc
);
211 pDesc
= new MFUnrecForegroundPtr::Description(
212 MFUnrecForegroundPtr::getClassType(),
215 ForegroundsFieldId
, ForegroundsFieldMask
,
217 (Field::MFDefaultFlags
| Field::FStdAccess
),
218 static_cast<FieldEditMethodSig
>(&CSMViewport::editHandleForegrounds
),
219 static_cast<FieldGetMethodSig
>(&CSMViewport::getHandleForegrounds
));
221 oType
.addInitialDesc(pDesc
);
223 pDesc
= new SFVec2f::Description(
224 SFVec2f::getClassType(),
227 LeftBottomFieldId
, LeftBottomFieldMask
,
229 (Field::SFDefaultFlags
| Field::FStdAccess
),
230 static_cast<FieldEditMethodSig
>(&CSMViewport::editHandleLeftBottom
),
231 static_cast<FieldGetMethodSig
>(&CSMViewport::getHandleLeftBottom
));
233 oType
.addInitialDesc(pDesc
);
235 pDesc
= new SFVec2f::Description(
236 SFVec2f::getClassType(),
239 RightTopFieldId
, RightTopFieldMask
,
241 (Field::SFDefaultFlags
| Field::FStdAccess
),
242 static_cast<FieldEditMethodSig
>(&CSMViewport::editHandleRightTop
),
243 static_cast<FieldGetMethodSig
>(&CSMViewport::getHandleRightTop
));
245 oType
.addInitialDesc(pDesc
);
247 pDesc
= new SFUInt32::Description(
248 SFUInt32::getClassType(),
251 TravMaskFieldId
, TravMaskFieldMask
,
253 (Field::SFDefaultFlags
| Field::FStdAccess
),
254 static_cast<FieldEditMethodSig
>(&CSMViewport::editHandleTravMask
),
255 static_cast<FieldGetMethodSig
>(&CSMViewport::getHandleTravMask
));
257 oType
.addInitialDesc(pDesc
);
259 pDesc
= new SFUnrecRenderOptionsPtr::Description(
260 SFUnrecRenderOptionsPtr::getClassType(),
263 RenderOptionsFieldId
, RenderOptionsFieldMask
,
265 (Field::SFDefaultFlags
| Field::FStdAccess
),
266 static_cast<FieldEditMethodSig
>(&CSMViewport::editHandleRenderOptions
),
267 static_cast<FieldGetMethodSig
>(&CSMViewport::getHandleRenderOptions
));
269 oType
.addInitialDesc(pDesc
);
271 pDesc
= new SFString::Description(
272 SFString::getClassType(),
275 StereoModeFieldId
, StereoModeFieldMask
,
277 (Field::SFDefaultFlags
| Field::FStdAccess
),
278 static_cast<FieldEditMethodSig
>(&CSMViewport::editHandleStereoMode
),
279 static_cast<FieldGetMethodSig
>(&CSMViewport::getHandleStereoMode
));
281 oType
.addInitialDesc(pDesc
);
283 pDesc
= new SFBool::Description(
284 SFBool::getClassType(),
287 PassiveFieldId
, PassiveFieldMask
,
289 (Field::SFDefaultFlags
| Field::FStdAccess
),
290 static_cast<FieldEditMethodSig
>(&CSMViewport::editHandlePassive
),
291 static_cast<FieldGetMethodSig
>(&CSMViewport::getHandlePassive
));
293 oType
.addInitialDesc(pDesc
);
295 pDesc
= new SFInt32::Description(
296 SFInt32::getClassType(),
298 "If not -1 used by the cluster multi window to compute the corresponding\n"
300 ServerIdFieldId
, ServerIdFieldMask
,
302 (Field::SFDefaultFlags
| Field::FStdAccess
),
303 static_cast<FieldEditMethodSig
>(&CSMViewport::editHandleServerId
),
304 static_cast<FieldGetMethodSig
>(&CSMViewport::getHandleServerId
));
306 oType
.addInitialDesc(pDesc
);
308 pDesc
= new SFMouseData::Description(
309 SFMouseData::getClassType(),
311 "MTouchData in local viewport coordinates\n",
312 MouseDataVCFieldId
, MouseDataVCFieldMask
,
314 (Field::SFDefaultFlags
| Field::FStdAccess
),
315 static_cast<FieldEditMethodSig
>(&CSMViewport::editHandleMouseDataVC
),
316 static_cast<FieldGetMethodSig
>(&CSMViewport::getHandleMouseDataVC
));
318 oType
.addInitialDesc(pDesc
);
320 pDesc
= new SFMTouchData::Description(
321 SFMTouchData::getClassType(),
323 "MTouchData in local viewport coordinates\n",
324 MTouchDataVCFieldId
, MTouchDataVCFieldMask
,
326 (Field::SFDefaultFlags
| Field::FStdAccess
),
327 static_cast<FieldEditMethodSig
>(&CSMViewport::editHandleMTouchDataVC
),
328 static_cast<FieldGetMethodSig
>(&CSMViewport::getHandleMTouchDataVC
));
330 oType
.addInitialDesc(pDesc
);
334 CSMViewportBase::TypeObject
CSMViewportBase::_type(
335 CSMViewportBase::getClassname(),
336 Inherited::getClassname(),
339 reinterpret_cast<PrototypeCreateF
>(&CSMViewportBase::createEmptyLocal
),
340 reinterpret_cast<InitContainerF
>(&CSMViewport::initMethod
),
341 reinterpret_cast<ExitContainerF
>(&CSMViewport::exitMethod
),
342 reinterpret_cast<InitalInsertDescFunc
>(
343 reinterpret_cast<void *>(&CSMViewport::classDescInserter
)),
346 "<?xml version=\"1.0\"?>\n"
349 " name=\"CSMViewport\"\n"
350 " parent=\"AttachmentContainer\"\n"
351 " library=\"ContribCSM\"\n"
352 " pointerfieldtypes=\"both\"\n"
353 " structure=\"concrete\"\n"
354 " systemcomponent=\"true\"\n"
355 " parentsystemcomponent=\"true\"\n"
356 " decoratable=\"false\"\n"
357 " useLocalIncludes=\"false\"\n"
358 " isNodeCore=\"false\"\n"
359 " isBundle=\"true\"\n"
364 " cardinality=\"single\"\n"
365 " visibility=\"external\"\n"
366 " defaultValue=\"NULL\"\n"
367 " access=\"public\"\n"
368 " category=\"pointer\"\n"
374 " cardinality=\"single\"\n"
375 " visibility=\"external\"\n"
376 " defaultValue=\"NULL\"\n"
377 " access=\"public\"\n"
378 " category=\"pointer\"\n"
382 " name=\"background\"\n"
383 " type=\"Background\"\n"
384 " cardinality=\"single\"\n"
385 " visibility=\"external\"\n"
386 " access=\"public\"\n"
387 " category=\"pointer\"\n"
391 " name=\"foregrounds\"\n"
392 " type=\"Foreground\"\n"
393 " cardinality=\"multi\"\n"
394 " visibility=\"external\"\n"
395 " access=\"public\"\n"
396 " category=\"pointer\"\n"
400 " name=\"leftBottom\"\n"
402 " cardinality=\"single\"\n"
403 " visibility=\"external\"\n"
404 " access=\"public\"\n"
405 " defaultValue=\"0.f, 0.f\"\n"
409 " name=\"rightTop\"\n"
411 " cardinality=\"single\"\n"
412 " visibility=\"external\"\n"
413 " access=\"public\"\n"
414 " defaultValue=\"1.f, 1.f\"\n"
418 " name=\"travMask\"\n"
420 " cardinality=\"single\"\n"
421 " visibility=\"external\"\n"
422 " access=\"public\"\n"
423 " defaultValue=\"TypeTraits<UInt32>::BitsSet & ~TraversalMasks::FindNamedComponentTraversal\"\n"
427 " name=\"renderOptions\"\n"
428 " type=\"RenderOptionsPtr\"\n"
429 " cardinality=\"single\"\n"
430 " visibility=\"external\"\n"
431 " access=\"public\"\n"
432 " defaultValue=\"NULL\"\n"
436 " name=\"stereoMode\"\n"
437 " type=\"std::string\"\n"
438 " cardinality=\"single\"\n"
439 " visibility=\"external\"\n"
440 " access=\"public\"\n"
441 " defaultValue='\"none\"'\n"
445 " name=\"passive\"\n"
447 " cardinality=\"single\"\n"
448 " visibility=\"external\"\n"
449 " access=\"public\"\n"
450 " defaultValue=\"false\"\n"
454 " name=\"serverId\"\n"
456 " cardinality=\"single\"\n"
457 " visibility=\"external\"\n"
458 " access=\"public\"\n"
459 " defaultValue=\"-1\"\n"
461 " If not -1 used by the cluster multi window to compute the corresponding\n"
466 " name=\"mouseDataVC\"\n"
467 " type=\"MouseData\"\n"
468 " cardinality=\"single\"\n"
469 " visibility=\"internal\"\n"
470 " access=\"public\"\n"
472 " MTouchData in local viewport coordinates\n"
475 " name=\"MTouchDataVC\"\n"
476 " type=\"MTouchData\"\n"
477 " cardinality=\"single\"\n"
478 " visibility=\"internal\"\n"
479 " access=\"public\"\n"
481 " MTouchData in local viewport coordinates\n"
484 "</FieldContainer>\n",
488 /*------------------------------ get -----------------------------------*/
490 FieldContainerType
&CSMViewportBase::getType(void)
495 const FieldContainerType
&CSMViewportBase::getType(void) const
500 UInt32
CSMViewportBase::getContainerSize(void) const
502 return sizeof(CSMViewport
);
505 /*------------------------- decorator get ------------------------------*/
508 //! Get the CSMViewport::_sfRoot field.
509 const SFUnrecNodePtr
*CSMViewportBase::getSFRoot(void) const
514 SFUnrecNodePtr
*CSMViewportBase::editSFRoot (void)
516 editSField(RootFieldMask
);
521 //! Get the value of the CSMViewport::_sfRoot field.
522 Node
* CSMViewportBase::getRoot(void) const
524 return _sfRoot
.getValue();
527 //! Set the value of the CSMViewport::_sfRoot field.
528 void CSMViewportBase::setRoot(Node
* const value
)
530 editSField(RootFieldMask
);
532 _sfRoot
.setValue(value
);
536 //! Get the CSMViewport::_sfCamera field.
537 const SFUnrecCameraPtr
*CSMViewportBase::getSFCamera(void) const
542 SFUnrecCameraPtr
*CSMViewportBase::editSFCamera (void)
544 editSField(CameraFieldMask
);
549 //! Get the value of the CSMViewport::_sfCamera field.
550 Camera
* CSMViewportBase::getCamera(void) const
552 return _sfCamera
.getValue();
555 //! Set the value of the CSMViewport::_sfCamera field.
556 void CSMViewportBase::setCamera(Camera
* const value
)
558 editSField(CameraFieldMask
);
560 _sfCamera
.setValue(value
);
564 //! Get the CSMViewport::_sfBackground field.
565 const SFUnrecBackgroundPtr
*CSMViewportBase::getSFBackground(void) const
567 return &_sfBackground
;
570 SFUnrecBackgroundPtr
*CSMViewportBase::editSFBackground (void)
572 editSField(BackgroundFieldMask
);
574 return &_sfBackground
;
577 //! Get the value of the CSMViewport::_sfBackground field.
578 Background
* CSMViewportBase::getBackground(void) const
580 return _sfBackground
.getValue();
583 //! Set the value of the CSMViewport::_sfBackground field.
584 void CSMViewportBase::setBackground(Background
* const value
)
586 editSField(BackgroundFieldMask
);
588 _sfBackground
.setValue(value
);
592 //! Get the CSMViewport::_mfForegrounds field.
593 const MFUnrecForegroundPtr
*CSMViewportBase::getMFForegrounds(void) const
595 return &_mfForegrounds
;
598 MFUnrecForegroundPtr
*CSMViewportBase::editMFForegrounds (void)
600 editMField(ForegroundsFieldMask
, _mfForegrounds
);
602 return &_mfForegrounds
;
604 Foreground
* CSMViewportBase::getForegrounds(const UInt32 index
) const
606 return _mfForegrounds
[index
];
609 SFVec2f
*CSMViewportBase::editSFLeftBottom(void)
611 editSField(LeftBottomFieldMask
);
613 return &_sfLeftBottom
;
616 const SFVec2f
*CSMViewportBase::getSFLeftBottom(void) const
618 return &_sfLeftBottom
;
622 SFVec2f
*CSMViewportBase::editSFRightTop(void)
624 editSField(RightTopFieldMask
);
629 const SFVec2f
*CSMViewportBase::getSFRightTop(void) const
635 SFUInt32
*CSMViewportBase::editSFTravMask(void)
637 editSField(TravMaskFieldMask
);
642 const SFUInt32
*CSMViewportBase::getSFTravMask(void) const
648 //! Get the CSMViewport::_sfRenderOptions field.
649 const SFUnrecRenderOptionsPtr
*CSMViewportBase::getSFRenderOptions(void) const
651 return &_sfRenderOptions
;
654 SFUnrecRenderOptionsPtr
*CSMViewportBase::editSFRenderOptions (void)
656 editSField(RenderOptionsFieldMask
);
658 return &_sfRenderOptions
;
661 //! Get the value of the CSMViewport::_sfRenderOptions field.
662 RenderOptions
* CSMViewportBase::getRenderOptions(void) const
664 return _sfRenderOptions
.getValue();
667 //! Set the value of the CSMViewport::_sfRenderOptions field.
668 void CSMViewportBase::setRenderOptions(RenderOptions
* const value
)
670 editSField(RenderOptionsFieldMask
);
672 _sfRenderOptions
.setValue(value
);
676 SFString
*CSMViewportBase::editSFStereoMode(void)
678 editSField(StereoModeFieldMask
);
680 return &_sfStereoMode
;
683 const SFString
*CSMViewportBase::getSFStereoMode(void) const
685 return &_sfStereoMode
;
689 SFBool
*CSMViewportBase::editSFPassive(void)
691 editSField(PassiveFieldMask
);
696 const SFBool
*CSMViewportBase::getSFPassive(void) const
702 SFInt32
*CSMViewportBase::editSFServerId(void)
704 editSField(ServerIdFieldMask
);
709 const SFInt32
*CSMViewportBase::getSFServerId(void) const
715 SFMouseData
*CSMViewportBase::editSFMouseDataVC(void)
717 editSField(MouseDataVCFieldMask
);
719 return &_sfMouseDataVC
;
722 const SFMouseData
*CSMViewportBase::getSFMouseDataVC(void) const
724 return &_sfMouseDataVC
;
728 SFMTouchData
*CSMViewportBase::editSFMTouchDataVC(void)
730 editSField(MTouchDataVCFieldMask
);
732 return &_sfMTouchDataVC
;
735 const SFMTouchData
*CSMViewportBase::getSFMTouchDataVC(void) const
737 return &_sfMTouchDataVC
;
743 void CSMViewportBase::pushToForegrounds(Foreground
* const value
)
745 editMField(ForegroundsFieldMask
, _mfForegrounds
);
747 _mfForegrounds
.push_back(value
);
750 void CSMViewportBase::assignForegrounds(const MFUnrecForegroundPtr
&value
)
752 MFUnrecForegroundPtr::const_iterator elemIt
=
754 MFUnrecForegroundPtr::const_iterator elemEnd
=
757 static_cast<CSMViewport
*>(this)->clearForegrounds();
759 while(elemIt
!= elemEnd
)
761 this->pushToForegrounds(*elemIt
);
767 void CSMViewportBase::removeFromForegrounds(UInt32 uiIndex
)
769 if(uiIndex
< _mfForegrounds
.size())
771 editMField(ForegroundsFieldMask
, _mfForegrounds
);
773 _mfForegrounds
.erase(uiIndex
);
777 void CSMViewportBase::removeObjFromForegrounds(Foreground
* const value
)
779 Int32 iElemIdx
= _mfForegrounds
.findIndex(value
);
783 editMField(ForegroundsFieldMask
, _mfForegrounds
);
785 _mfForegrounds
.erase(iElemIdx
);
788 void CSMViewportBase::clearForegrounds(void)
790 editMField(ForegroundsFieldMask
, _mfForegrounds
);
793 _mfForegrounds
.clear();
798 /*------------------------------ access -----------------------------------*/
800 SizeT
CSMViewportBase::getBinSize(ConstFieldMaskArg whichField
)
802 SizeT returnValue
= Inherited::getBinSize(whichField
);
804 if(FieldBits::NoField
!= (RootFieldMask
& whichField
))
806 returnValue
+= _sfRoot
.getBinSize();
808 if(FieldBits::NoField
!= (CameraFieldMask
& whichField
))
810 returnValue
+= _sfCamera
.getBinSize();
812 if(FieldBits::NoField
!= (BackgroundFieldMask
& whichField
))
814 returnValue
+= _sfBackground
.getBinSize();
816 if(FieldBits::NoField
!= (ForegroundsFieldMask
& whichField
))
818 returnValue
+= _mfForegrounds
.getBinSize();
820 if(FieldBits::NoField
!= (LeftBottomFieldMask
& whichField
))
822 returnValue
+= _sfLeftBottom
.getBinSize();
824 if(FieldBits::NoField
!= (RightTopFieldMask
& whichField
))
826 returnValue
+= _sfRightTop
.getBinSize();
828 if(FieldBits::NoField
!= (TravMaskFieldMask
& whichField
))
830 returnValue
+= _sfTravMask
.getBinSize();
832 if(FieldBits::NoField
!= (RenderOptionsFieldMask
& whichField
))
834 returnValue
+= _sfRenderOptions
.getBinSize();
836 if(FieldBits::NoField
!= (StereoModeFieldMask
& whichField
))
838 returnValue
+= _sfStereoMode
.getBinSize();
840 if(FieldBits::NoField
!= (PassiveFieldMask
& whichField
))
842 returnValue
+= _sfPassive
.getBinSize();
844 if(FieldBits::NoField
!= (ServerIdFieldMask
& whichField
))
846 returnValue
+= _sfServerId
.getBinSize();
848 if(FieldBits::NoField
!= (MouseDataVCFieldMask
& whichField
))
850 returnValue
+= _sfMouseDataVC
.getBinSize();
852 if(FieldBits::NoField
!= (MTouchDataVCFieldMask
& whichField
))
854 returnValue
+= _sfMTouchDataVC
.getBinSize();
860 void CSMViewportBase::copyToBin(BinaryDataHandler
&pMem
,
861 ConstFieldMaskArg whichField
)
863 Inherited::copyToBin(pMem
, whichField
);
865 if(FieldBits::NoField
!= (RootFieldMask
& whichField
))
867 _sfRoot
.copyToBin(pMem
);
869 if(FieldBits::NoField
!= (CameraFieldMask
& whichField
))
871 _sfCamera
.copyToBin(pMem
);
873 if(FieldBits::NoField
!= (BackgroundFieldMask
& whichField
))
875 _sfBackground
.copyToBin(pMem
);
877 if(FieldBits::NoField
!= (ForegroundsFieldMask
& whichField
))
879 _mfForegrounds
.copyToBin(pMem
);
881 if(FieldBits::NoField
!= (LeftBottomFieldMask
& whichField
))
883 _sfLeftBottom
.copyToBin(pMem
);
885 if(FieldBits::NoField
!= (RightTopFieldMask
& whichField
))
887 _sfRightTop
.copyToBin(pMem
);
889 if(FieldBits::NoField
!= (TravMaskFieldMask
& whichField
))
891 _sfTravMask
.copyToBin(pMem
);
893 if(FieldBits::NoField
!= (RenderOptionsFieldMask
& whichField
))
895 _sfRenderOptions
.copyToBin(pMem
);
897 if(FieldBits::NoField
!= (StereoModeFieldMask
& whichField
))
899 _sfStereoMode
.copyToBin(pMem
);
901 if(FieldBits::NoField
!= (PassiveFieldMask
& whichField
))
903 _sfPassive
.copyToBin(pMem
);
905 if(FieldBits::NoField
!= (ServerIdFieldMask
& whichField
))
907 _sfServerId
.copyToBin(pMem
);
909 if(FieldBits::NoField
!= (MouseDataVCFieldMask
& whichField
))
911 _sfMouseDataVC
.copyToBin(pMem
);
913 if(FieldBits::NoField
!= (MTouchDataVCFieldMask
& whichField
))
915 _sfMTouchDataVC
.copyToBin(pMem
);
919 void CSMViewportBase::copyFromBin(BinaryDataHandler
&pMem
,
920 ConstFieldMaskArg whichField
)
922 Inherited::copyFromBin(pMem
, whichField
);
924 if(FieldBits::NoField
!= (RootFieldMask
& whichField
))
926 editSField(RootFieldMask
);
927 _sfRoot
.copyFromBin(pMem
);
929 if(FieldBits::NoField
!= (CameraFieldMask
& whichField
))
931 editSField(CameraFieldMask
);
932 _sfCamera
.copyFromBin(pMem
);
934 if(FieldBits::NoField
!= (BackgroundFieldMask
& whichField
))
936 editSField(BackgroundFieldMask
);
937 _sfBackground
.copyFromBin(pMem
);
939 if(FieldBits::NoField
!= (ForegroundsFieldMask
& whichField
))
941 editMField(ForegroundsFieldMask
, _mfForegrounds
);
942 _mfForegrounds
.copyFromBin(pMem
);
944 if(FieldBits::NoField
!= (LeftBottomFieldMask
& whichField
))
946 editSField(LeftBottomFieldMask
);
947 _sfLeftBottom
.copyFromBin(pMem
);
949 if(FieldBits::NoField
!= (RightTopFieldMask
& whichField
))
951 editSField(RightTopFieldMask
);
952 _sfRightTop
.copyFromBin(pMem
);
954 if(FieldBits::NoField
!= (TravMaskFieldMask
& whichField
))
956 editSField(TravMaskFieldMask
);
957 _sfTravMask
.copyFromBin(pMem
);
959 if(FieldBits::NoField
!= (RenderOptionsFieldMask
& whichField
))
961 editSField(RenderOptionsFieldMask
);
962 _sfRenderOptions
.copyFromBin(pMem
);
964 if(FieldBits::NoField
!= (StereoModeFieldMask
& whichField
))
966 editSField(StereoModeFieldMask
);
967 _sfStereoMode
.copyFromBin(pMem
);
969 if(FieldBits::NoField
!= (PassiveFieldMask
& whichField
))
971 editSField(PassiveFieldMask
);
972 _sfPassive
.copyFromBin(pMem
);
974 if(FieldBits::NoField
!= (ServerIdFieldMask
& whichField
))
976 editSField(ServerIdFieldMask
);
977 _sfServerId
.copyFromBin(pMem
);
979 if(FieldBits::NoField
!= (MouseDataVCFieldMask
& whichField
))
981 editSField(MouseDataVCFieldMask
);
982 _sfMouseDataVC
.copyFromBin(pMem
);
984 if(FieldBits::NoField
!= (MTouchDataVCFieldMask
& whichField
))
986 editSField(MTouchDataVCFieldMask
);
987 _sfMTouchDataVC
.copyFromBin(pMem
);
991 //! create a new instance of the class
992 CSMViewportTransitPtr
CSMViewportBase::createLocal(BitVector bFlags
)
994 CSMViewportTransitPtr fc
;
996 if(getClassType().getPrototype() != NULL
)
998 FieldContainerTransitPtr tmpPtr
=
999 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
1001 fc
= dynamic_pointer_cast
<CSMViewport
>(tmpPtr
);
1007 //! create a new instance of the class, copy the container flags
1008 CSMViewportTransitPtr
CSMViewportBase::createDependent(BitVector bFlags
)
1010 CSMViewportTransitPtr fc
;
1012 if(getClassType().getPrototype() != NULL
)
1014 FieldContainerTransitPtr tmpPtr
=
1015 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
1017 fc
= dynamic_pointer_cast
<CSMViewport
>(tmpPtr
);
1023 //! create a new instance of the class
1024 CSMViewportTransitPtr
CSMViewportBase::create(void)
1026 return createLocal();
1029 CSMViewport
*CSMViewportBase::createEmptyLocal(BitVector bFlags
)
1031 CSMViewport
*returnValue
;
1033 newPtr
<CSMViewport
>(returnValue
, bFlags
);
1035 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
1040 //! create an empty new instance of the class, do not copy the prototype
1041 CSMViewport
*CSMViewportBase::createEmpty(void)
1043 return createEmptyLocal();
1047 FieldContainerTransitPtr
CSMViewportBase::shallowCopyLocal(
1048 BitVector bFlags
) const
1050 CSMViewport
*tmpPtr
;
1052 newPtr(tmpPtr
, dynamic_cast<const CSMViewport
*>(this), bFlags
);
1054 FieldContainerTransitPtr
returnValue(tmpPtr
);
1056 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
1061 FieldContainerTransitPtr
CSMViewportBase::shallowCopyDependent(
1062 BitVector bFlags
) const
1064 CSMViewport
*tmpPtr
;
1066 newPtr(tmpPtr
, dynamic_cast<const CSMViewport
*>(this), ~bFlags
);
1068 FieldContainerTransitPtr
returnValue(tmpPtr
);
1070 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
1075 FieldContainerTransitPtr
CSMViewportBase::shallowCopy(void) const
1077 return shallowCopyLocal();
1083 /*------------------------- constructors ----------------------------------*/
1085 CSMViewportBase::CSMViewportBase(void) :
1089 _sfBackground (NULL
),
1091 _sfLeftBottom (Vec2f(0.f
, 0.f
)),
1092 _sfRightTop (Vec2f(1.f
, 1.f
)),
1093 _sfTravMask (UInt32(TypeTraits
<UInt32
>::BitsSet
& ~TraversalMasks::FindNamedComponentTraversal
)),
1094 _sfRenderOptions (NULL
),
1095 _sfStereoMode (std::string("none")),
1096 _sfPassive (bool(false)),
1097 _sfServerId (Int32(-1)),
1103 CSMViewportBase::CSMViewportBase(const CSMViewportBase
&source
) :
1107 _sfBackground (NULL
),
1109 _sfLeftBottom (source
._sfLeftBottom
),
1110 _sfRightTop (source
._sfRightTop
),
1111 _sfTravMask (source
._sfTravMask
),
1112 _sfRenderOptions (NULL
),
1113 _sfStereoMode (source
._sfStereoMode
),
1114 _sfPassive (source
._sfPassive
),
1115 _sfServerId (source
._sfServerId
),
1116 _sfMouseDataVC (source
._sfMouseDataVC
),
1117 _sfMTouchDataVC (source
._sfMTouchDataVC
)
1122 /*-------------------------- destructors ----------------------------------*/
1124 CSMViewportBase::~CSMViewportBase(void)
1128 void CSMViewportBase::onCreate(const CSMViewport
*source
)
1130 Inherited::onCreate(source
);
1134 CSMViewport
*pThis
= static_cast<CSMViewport
*>(this);
1136 pThis
->setRoot(source
->getRoot());
1138 pThis
->setCamera(source
->getCamera());
1140 pThis
->setBackground(source
->getBackground());
1142 MFUnrecForegroundPtr::const_iterator ForegroundsIt
=
1143 source
->_mfForegrounds
.begin();
1144 MFUnrecForegroundPtr::const_iterator ForegroundsEnd
=
1145 source
->_mfForegrounds
.end ();
1147 while(ForegroundsIt
!= ForegroundsEnd
)
1149 pThis
->pushToForegrounds(*ForegroundsIt
);
1154 pThis
->setRenderOptions(source
->getRenderOptions());
1158 GetFieldHandlePtr
CSMViewportBase::getHandleRoot (void) const
1160 SFUnrecNodePtr::GetHandlePtr
returnValue(
1161 new SFUnrecNodePtr::GetHandle(
1163 this->getType().getFieldDesc(RootFieldId
),
1164 const_cast<CSMViewportBase
*>(this)));
1169 EditFieldHandlePtr
CSMViewportBase::editHandleRoot (void)
1171 SFUnrecNodePtr::EditHandlePtr
returnValue(
1172 new SFUnrecNodePtr::EditHandle(
1174 this->getType().getFieldDesc(RootFieldId
),
1177 returnValue
->setSetMethod(
1178 boost::bind(&CSMViewport::setRoot
,
1179 static_cast<CSMViewport
*>(this), _1
));
1181 editSField(RootFieldMask
);
1186 GetFieldHandlePtr
CSMViewportBase::getHandleCamera (void) const
1188 SFUnrecCameraPtr::GetHandlePtr
returnValue(
1189 new SFUnrecCameraPtr::GetHandle(
1191 this->getType().getFieldDesc(CameraFieldId
),
1192 const_cast<CSMViewportBase
*>(this)));
1197 EditFieldHandlePtr
CSMViewportBase::editHandleCamera (void)
1199 SFUnrecCameraPtr::EditHandlePtr
returnValue(
1200 new SFUnrecCameraPtr::EditHandle(
1202 this->getType().getFieldDesc(CameraFieldId
),
1205 returnValue
->setSetMethod(
1206 boost::bind(&CSMViewport::setCamera
,
1207 static_cast<CSMViewport
*>(this), _1
));
1209 editSField(CameraFieldMask
);
1214 GetFieldHandlePtr
CSMViewportBase::getHandleBackground (void) const
1216 SFUnrecBackgroundPtr::GetHandlePtr
returnValue(
1217 new SFUnrecBackgroundPtr::GetHandle(
1219 this->getType().getFieldDesc(BackgroundFieldId
),
1220 const_cast<CSMViewportBase
*>(this)));
1225 EditFieldHandlePtr
CSMViewportBase::editHandleBackground (void)
1227 SFUnrecBackgroundPtr::EditHandlePtr
returnValue(
1228 new SFUnrecBackgroundPtr::EditHandle(
1230 this->getType().getFieldDesc(BackgroundFieldId
),
1233 returnValue
->setSetMethod(
1234 boost::bind(&CSMViewport::setBackground
,
1235 static_cast<CSMViewport
*>(this), _1
));
1237 editSField(BackgroundFieldMask
);
1242 GetFieldHandlePtr
CSMViewportBase::getHandleForegrounds (void) const
1244 MFUnrecForegroundPtr::GetHandlePtr
returnValue(
1245 new MFUnrecForegroundPtr::GetHandle(
1247 this->getType().getFieldDesc(ForegroundsFieldId
),
1248 const_cast<CSMViewportBase
*>(this)));
1253 EditFieldHandlePtr
CSMViewportBase::editHandleForegrounds (void)
1255 MFUnrecForegroundPtr::EditHandlePtr
returnValue(
1256 new MFUnrecForegroundPtr::EditHandle(
1258 this->getType().getFieldDesc(ForegroundsFieldId
),
1261 returnValue
->setAddMethod(
1262 boost::bind(&CSMViewport::pushToForegrounds
,
1263 static_cast<CSMViewport
*>(this), _1
));
1264 returnValue
->setRemoveMethod(
1265 boost::bind(&CSMViewport::removeFromForegrounds
,
1266 static_cast<CSMViewport
*>(this), _1
));
1267 returnValue
->setRemoveObjMethod(
1268 boost::bind(&CSMViewport::removeObjFromForegrounds
,
1269 static_cast<CSMViewport
*>(this), _1
));
1270 returnValue
->setClearMethod(
1271 boost::bind(&CSMViewport::clearForegrounds
,
1272 static_cast<CSMViewport
*>(this)));
1274 editMField(ForegroundsFieldMask
, _mfForegrounds
);
1279 GetFieldHandlePtr
CSMViewportBase::getHandleLeftBottom (void) const
1281 SFVec2f::GetHandlePtr
returnValue(
1282 new SFVec2f::GetHandle(
1284 this->getType().getFieldDesc(LeftBottomFieldId
),
1285 const_cast<CSMViewportBase
*>(this)));
1290 EditFieldHandlePtr
CSMViewportBase::editHandleLeftBottom (void)
1292 SFVec2f::EditHandlePtr
returnValue(
1293 new SFVec2f::EditHandle(
1295 this->getType().getFieldDesc(LeftBottomFieldId
),
1299 editSField(LeftBottomFieldMask
);
1304 GetFieldHandlePtr
CSMViewportBase::getHandleRightTop (void) const
1306 SFVec2f::GetHandlePtr
returnValue(
1307 new SFVec2f::GetHandle(
1309 this->getType().getFieldDesc(RightTopFieldId
),
1310 const_cast<CSMViewportBase
*>(this)));
1315 EditFieldHandlePtr
CSMViewportBase::editHandleRightTop (void)
1317 SFVec2f::EditHandlePtr
returnValue(
1318 new SFVec2f::EditHandle(
1320 this->getType().getFieldDesc(RightTopFieldId
),
1324 editSField(RightTopFieldMask
);
1329 GetFieldHandlePtr
CSMViewportBase::getHandleTravMask (void) const
1331 SFUInt32::GetHandlePtr
returnValue(
1332 new SFUInt32::GetHandle(
1334 this->getType().getFieldDesc(TravMaskFieldId
),
1335 const_cast<CSMViewportBase
*>(this)));
1340 EditFieldHandlePtr
CSMViewportBase::editHandleTravMask (void)
1342 SFUInt32::EditHandlePtr
returnValue(
1343 new SFUInt32::EditHandle(
1345 this->getType().getFieldDesc(TravMaskFieldId
),
1349 editSField(TravMaskFieldMask
);
1354 GetFieldHandlePtr
CSMViewportBase::getHandleRenderOptions (void) const
1356 SFUnrecRenderOptionsPtr::GetHandlePtr
returnValue(
1357 new SFUnrecRenderOptionsPtr::GetHandle(
1359 this->getType().getFieldDesc(RenderOptionsFieldId
),
1360 const_cast<CSMViewportBase
*>(this)));
1365 EditFieldHandlePtr
CSMViewportBase::editHandleRenderOptions (void)
1367 SFUnrecRenderOptionsPtr::EditHandlePtr
returnValue(
1368 new SFUnrecRenderOptionsPtr::EditHandle(
1370 this->getType().getFieldDesc(RenderOptionsFieldId
),
1373 returnValue
->setSetMethod(
1374 boost::bind(&CSMViewport::setRenderOptions
,
1375 static_cast<CSMViewport
*>(this), _1
));
1377 editSField(RenderOptionsFieldMask
);
1382 GetFieldHandlePtr
CSMViewportBase::getHandleStereoMode (void) const
1384 SFString::GetHandlePtr
returnValue(
1385 new SFString::GetHandle(
1387 this->getType().getFieldDesc(StereoModeFieldId
),
1388 const_cast<CSMViewportBase
*>(this)));
1393 EditFieldHandlePtr
CSMViewportBase::editHandleStereoMode (void)
1395 SFString::EditHandlePtr
returnValue(
1396 new SFString::EditHandle(
1398 this->getType().getFieldDesc(StereoModeFieldId
),
1402 editSField(StereoModeFieldMask
);
1407 GetFieldHandlePtr
CSMViewportBase::getHandlePassive (void) const
1409 SFBool::GetHandlePtr
returnValue(
1410 new SFBool::GetHandle(
1412 this->getType().getFieldDesc(PassiveFieldId
),
1413 const_cast<CSMViewportBase
*>(this)));
1418 EditFieldHandlePtr
CSMViewportBase::editHandlePassive (void)
1420 SFBool::EditHandlePtr
returnValue(
1421 new SFBool::EditHandle(
1423 this->getType().getFieldDesc(PassiveFieldId
),
1427 editSField(PassiveFieldMask
);
1432 GetFieldHandlePtr
CSMViewportBase::getHandleServerId (void) const
1434 SFInt32::GetHandlePtr
returnValue(
1435 new SFInt32::GetHandle(
1437 this->getType().getFieldDesc(ServerIdFieldId
),
1438 const_cast<CSMViewportBase
*>(this)));
1443 EditFieldHandlePtr
CSMViewportBase::editHandleServerId (void)
1445 SFInt32::EditHandlePtr
returnValue(
1446 new SFInt32::EditHandle(
1448 this->getType().getFieldDesc(ServerIdFieldId
),
1452 editSField(ServerIdFieldMask
);
1457 GetFieldHandlePtr
CSMViewportBase::getHandleMouseDataVC (void) const
1459 SFMouseData::GetHandlePtr
returnValue(
1460 new SFMouseData::GetHandle(
1462 this->getType().getFieldDesc(MouseDataVCFieldId
),
1463 const_cast<CSMViewportBase
*>(this)));
1468 EditFieldHandlePtr
CSMViewportBase::editHandleMouseDataVC (void)
1470 SFMouseData::EditHandlePtr
returnValue(
1471 new SFMouseData::EditHandle(
1473 this->getType().getFieldDesc(MouseDataVCFieldId
),
1477 editSField(MouseDataVCFieldMask
);
1482 GetFieldHandlePtr
CSMViewportBase::getHandleMTouchDataVC (void) const
1484 SFMTouchData::GetHandlePtr
returnValue(
1485 new SFMTouchData::GetHandle(
1487 this->getType().getFieldDesc(MTouchDataVCFieldId
),
1488 const_cast<CSMViewportBase
*>(this)));
1493 EditFieldHandlePtr
CSMViewportBase::editHandleMTouchDataVC (void)
1495 SFMTouchData::EditHandlePtr
returnValue(
1496 new SFMTouchData::EditHandle(
1498 this->getType().getFieldDesc(MTouchDataVCFieldId
),
1502 editSField(MTouchDataVCFieldMask
);
1508 #ifdef OSG_MT_CPTR_ASPECT
1509 void CSMViewportBase::execSyncV( FieldContainer
&oFrom
,
1510 ConstFieldMaskArg whichField
,
1511 AspectOffsetStore
&oOffsets
,
1512 ConstFieldMaskArg syncMode
,
1513 const UInt32 uiSyncInfo
)
1515 CSMViewport
*pThis
= static_cast<CSMViewport
*>(this);
1517 pThis
->execSync(static_cast<CSMViewport
*>(&oFrom
),
1526 #ifdef OSG_MT_CPTR_ASPECT
1527 FieldContainer
*CSMViewportBase::createAspectCopy(
1528 const FieldContainer
*pRefAspect
) const
1530 CSMViewport
*returnValue
;
1532 newAspectCopy(returnValue
,
1533 dynamic_cast<const CSMViewport
*>(pRefAspect
),
1534 dynamic_cast<const CSMViewport
*>(this));
1540 void CSMViewportBase::resolveLinks(void)
1542 Inherited::resolveLinks();
1544 static_cast<CSMViewport
*>(this)->setRoot(NULL
);
1546 static_cast<CSMViewport
*>(this)->setCamera(NULL
);
1548 static_cast<CSMViewport
*>(this)->setBackground(NULL
);
1550 static_cast<CSMViewport
*>(this)->clearForegrounds();
1552 static_cast<CSMViewport
*>(this)->setRenderOptions(NULL
);