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
>(&CSMViewport::classDescInserter
),
345 "<?xml version=\"1.0\"?>\n"
348 " name=\"CSMViewport\"\n"
349 " parent=\"AttachmentContainer\"\n"
350 " library=\"ContribCSM\"\n"
351 " pointerfieldtypes=\"both\"\n"
352 " structure=\"concrete\"\n"
353 " systemcomponent=\"true\"\n"
354 " parentsystemcomponent=\"true\"\n"
355 " decoratable=\"false\"\n"
356 " useLocalIncludes=\"false\"\n"
357 " isNodeCore=\"false\"\n"
358 " isBundle=\"true\"\n"
363 " cardinality=\"single\"\n"
364 " visibility=\"external\"\n"
365 " defaultValue=\"NULL\"\n"
366 " access=\"public\"\n"
367 " category=\"pointer\"\n"
373 " cardinality=\"single\"\n"
374 " visibility=\"external\"\n"
375 " defaultValue=\"NULL\"\n"
376 " access=\"public\"\n"
377 " category=\"pointer\"\n"
381 " name=\"background\"\n"
382 " type=\"Background\"\n"
383 " cardinality=\"single\"\n"
384 " visibility=\"external\"\n"
385 " access=\"public\"\n"
386 " category=\"pointer\"\n"
390 " name=\"foregrounds\"\n"
391 " type=\"Foreground\"\n"
392 " cardinality=\"multi\"\n"
393 " visibility=\"external\"\n"
394 " access=\"public\"\n"
395 " category=\"pointer\"\n"
399 " name=\"leftBottom\"\n"
401 " cardinality=\"single\"\n"
402 " visibility=\"external\"\n"
403 " access=\"public\"\n"
404 " defaultValue=\"0.f, 0.f\"\n"
408 " name=\"rightTop\"\n"
410 " cardinality=\"single\"\n"
411 " visibility=\"external\"\n"
412 " access=\"public\"\n"
413 " defaultValue=\"1.f, 1.f\"\n"
417 " name=\"travMask\"\n"
419 " cardinality=\"single\"\n"
420 " visibility=\"external\"\n"
421 " access=\"public\"\n"
422 " defaultValue=\"TypeTraits<UInt32>::BitsSet & ~TraversalMasks::FindNamedComponentTraversal\"\n"
426 " name=\"renderOptions\"\n"
427 " type=\"RenderOptionsPtr\"\n"
428 " cardinality=\"single\"\n"
429 " visibility=\"external\"\n"
430 " access=\"public\"\n"
431 " defaultValue=\"NULL\"\n"
435 " name=\"stereoMode\"\n"
436 " type=\"std::string\"\n"
437 " cardinality=\"single\"\n"
438 " visibility=\"external\"\n"
439 " access=\"public\"\n"
440 " defaultValue='\"none\"'\n"
444 " name=\"passive\"\n"
446 " cardinality=\"single\"\n"
447 " visibility=\"external\"\n"
448 " access=\"public\"\n"
449 " defaultValue=\"false\"\n"
453 " name=\"serverId\"\n"
455 " cardinality=\"single\"\n"
456 " visibility=\"external\"\n"
457 " access=\"public\"\n"
458 " defaultValue=\"-1\"\n"
460 " If not -1 used by the cluster multi window to compute the corresponding\n"
465 " name=\"mouseDataVC\"\n"
466 " type=\"MouseData\"\n"
467 " cardinality=\"single\"\n"
468 " visibility=\"internal\"\n"
469 " access=\"public\"\n"
471 " MTouchData in local viewport coordinates\n"
474 " name=\"MTouchDataVC\"\n"
475 " type=\"MTouchData\"\n"
476 " cardinality=\"single\"\n"
477 " visibility=\"internal\"\n"
478 " access=\"public\"\n"
480 " MTouchData in local viewport coordinates\n"
483 "</FieldContainer>\n",
487 /*------------------------------ get -----------------------------------*/
489 FieldContainerType
&CSMViewportBase::getType(void)
494 const FieldContainerType
&CSMViewportBase::getType(void) const
499 UInt32
CSMViewportBase::getContainerSize(void) const
501 return sizeof(CSMViewport
);
504 /*------------------------- decorator get ------------------------------*/
507 //! Get the CSMViewport::_sfRoot field.
508 const SFUnrecNodePtr
*CSMViewportBase::getSFRoot(void) const
513 SFUnrecNodePtr
*CSMViewportBase::editSFRoot (void)
515 editSField(RootFieldMask
);
520 //! Get the value of the CSMViewport::_sfRoot field.
521 Node
* CSMViewportBase::getRoot(void) const
523 return _sfRoot
.getValue();
526 //! Set the value of the CSMViewport::_sfRoot field.
527 void CSMViewportBase::setRoot(Node
* const value
)
529 editSField(RootFieldMask
);
531 _sfRoot
.setValue(value
);
535 //! Get the CSMViewport::_sfCamera field.
536 const SFUnrecCameraPtr
*CSMViewportBase::getSFCamera(void) const
541 SFUnrecCameraPtr
*CSMViewportBase::editSFCamera (void)
543 editSField(CameraFieldMask
);
548 //! Get the value of the CSMViewport::_sfCamera field.
549 Camera
* CSMViewportBase::getCamera(void) const
551 return _sfCamera
.getValue();
554 //! Set the value of the CSMViewport::_sfCamera field.
555 void CSMViewportBase::setCamera(Camera
* const value
)
557 editSField(CameraFieldMask
);
559 _sfCamera
.setValue(value
);
563 //! Get the CSMViewport::_sfBackground field.
564 const SFUnrecBackgroundPtr
*CSMViewportBase::getSFBackground(void) const
566 return &_sfBackground
;
569 SFUnrecBackgroundPtr
*CSMViewportBase::editSFBackground (void)
571 editSField(BackgroundFieldMask
);
573 return &_sfBackground
;
576 //! Get the value of the CSMViewport::_sfBackground field.
577 Background
* CSMViewportBase::getBackground(void) const
579 return _sfBackground
.getValue();
582 //! Set the value of the CSMViewport::_sfBackground field.
583 void CSMViewportBase::setBackground(Background
* const value
)
585 editSField(BackgroundFieldMask
);
587 _sfBackground
.setValue(value
);
591 //! Get the CSMViewport::_mfForegrounds field.
592 const MFUnrecForegroundPtr
*CSMViewportBase::getMFForegrounds(void) const
594 return &_mfForegrounds
;
597 MFUnrecForegroundPtr
*CSMViewportBase::editMFForegrounds (void)
599 editMField(ForegroundsFieldMask
, _mfForegrounds
);
601 return &_mfForegrounds
;
603 Foreground
* CSMViewportBase::getForegrounds(const UInt32 index
) const
605 return _mfForegrounds
[index
];
608 SFVec2f
*CSMViewportBase::editSFLeftBottom(void)
610 editSField(LeftBottomFieldMask
);
612 return &_sfLeftBottom
;
615 const SFVec2f
*CSMViewportBase::getSFLeftBottom(void) const
617 return &_sfLeftBottom
;
621 SFVec2f
*CSMViewportBase::editSFRightTop(void)
623 editSField(RightTopFieldMask
);
628 const SFVec2f
*CSMViewportBase::getSFRightTop(void) const
634 SFUInt32
*CSMViewportBase::editSFTravMask(void)
636 editSField(TravMaskFieldMask
);
641 const SFUInt32
*CSMViewportBase::getSFTravMask(void) const
647 //! Get the CSMViewport::_sfRenderOptions field.
648 const SFUnrecRenderOptionsPtr
*CSMViewportBase::getSFRenderOptions(void) const
650 return &_sfRenderOptions
;
653 SFUnrecRenderOptionsPtr
*CSMViewportBase::editSFRenderOptions (void)
655 editSField(RenderOptionsFieldMask
);
657 return &_sfRenderOptions
;
660 //! Get the value of the CSMViewport::_sfRenderOptions field.
661 RenderOptions
* CSMViewportBase::getRenderOptions(void) const
663 return _sfRenderOptions
.getValue();
666 //! Set the value of the CSMViewport::_sfRenderOptions field.
667 void CSMViewportBase::setRenderOptions(RenderOptions
* const value
)
669 editSField(RenderOptionsFieldMask
);
671 _sfRenderOptions
.setValue(value
);
675 SFString
*CSMViewportBase::editSFStereoMode(void)
677 editSField(StereoModeFieldMask
);
679 return &_sfStereoMode
;
682 const SFString
*CSMViewportBase::getSFStereoMode(void) const
684 return &_sfStereoMode
;
688 SFBool
*CSMViewportBase::editSFPassive(void)
690 editSField(PassiveFieldMask
);
695 const SFBool
*CSMViewportBase::getSFPassive(void) const
701 SFInt32
*CSMViewportBase::editSFServerId(void)
703 editSField(ServerIdFieldMask
);
708 const SFInt32
*CSMViewportBase::getSFServerId(void) const
714 SFMouseData
*CSMViewportBase::editSFMouseDataVC(void)
716 editSField(MouseDataVCFieldMask
);
718 return &_sfMouseDataVC
;
721 const SFMouseData
*CSMViewportBase::getSFMouseDataVC(void) const
723 return &_sfMouseDataVC
;
727 SFMTouchData
*CSMViewportBase::editSFMTouchDataVC(void)
729 editSField(MTouchDataVCFieldMask
);
731 return &_sfMTouchDataVC
;
734 const SFMTouchData
*CSMViewportBase::getSFMTouchDataVC(void) const
736 return &_sfMTouchDataVC
;
742 void CSMViewportBase::pushToForegrounds(Foreground
* const value
)
744 editMField(ForegroundsFieldMask
, _mfForegrounds
);
746 _mfForegrounds
.push_back(value
);
749 void CSMViewportBase::assignForegrounds(const MFUnrecForegroundPtr
&value
)
751 MFUnrecForegroundPtr::const_iterator elemIt
=
753 MFUnrecForegroundPtr::const_iterator elemEnd
=
756 static_cast<CSMViewport
*>(this)->clearForegrounds();
758 while(elemIt
!= elemEnd
)
760 this->pushToForegrounds(*elemIt
);
766 void CSMViewportBase::removeFromForegrounds(UInt32 uiIndex
)
768 if(uiIndex
< _mfForegrounds
.size())
770 editMField(ForegroundsFieldMask
, _mfForegrounds
);
772 _mfForegrounds
.erase(uiIndex
);
776 void CSMViewportBase::removeObjFromForegrounds(Foreground
* const value
)
778 Int32 iElemIdx
= _mfForegrounds
.findIndex(value
);
782 editMField(ForegroundsFieldMask
, _mfForegrounds
);
784 _mfForegrounds
.erase(iElemIdx
);
787 void CSMViewportBase::clearForegrounds(void)
789 editMField(ForegroundsFieldMask
, _mfForegrounds
);
792 _mfForegrounds
.clear();
797 /*------------------------------ access -----------------------------------*/
799 SizeT
CSMViewportBase::getBinSize(ConstFieldMaskArg whichField
)
801 SizeT returnValue
= Inherited::getBinSize(whichField
);
803 if(FieldBits::NoField
!= (RootFieldMask
& whichField
))
805 returnValue
+= _sfRoot
.getBinSize();
807 if(FieldBits::NoField
!= (CameraFieldMask
& whichField
))
809 returnValue
+= _sfCamera
.getBinSize();
811 if(FieldBits::NoField
!= (BackgroundFieldMask
& whichField
))
813 returnValue
+= _sfBackground
.getBinSize();
815 if(FieldBits::NoField
!= (ForegroundsFieldMask
& whichField
))
817 returnValue
+= _mfForegrounds
.getBinSize();
819 if(FieldBits::NoField
!= (LeftBottomFieldMask
& whichField
))
821 returnValue
+= _sfLeftBottom
.getBinSize();
823 if(FieldBits::NoField
!= (RightTopFieldMask
& whichField
))
825 returnValue
+= _sfRightTop
.getBinSize();
827 if(FieldBits::NoField
!= (TravMaskFieldMask
& whichField
))
829 returnValue
+= _sfTravMask
.getBinSize();
831 if(FieldBits::NoField
!= (RenderOptionsFieldMask
& whichField
))
833 returnValue
+= _sfRenderOptions
.getBinSize();
835 if(FieldBits::NoField
!= (StereoModeFieldMask
& whichField
))
837 returnValue
+= _sfStereoMode
.getBinSize();
839 if(FieldBits::NoField
!= (PassiveFieldMask
& whichField
))
841 returnValue
+= _sfPassive
.getBinSize();
843 if(FieldBits::NoField
!= (ServerIdFieldMask
& whichField
))
845 returnValue
+= _sfServerId
.getBinSize();
847 if(FieldBits::NoField
!= (MouseDataVCFieldMask
& whichField
))
849 returnValue
+= _sfMouseDataVC
.getBinSize();
851 if(FieldBits::NoField
!= (MTouchDataVCFieldMask
& whichField
))
853 returnValue
+= _sfMTouchDataVC
.getBinSize();
859 void CSMViewportBase::copyToBin(BinaryDataHandler
&pMem
,
860 ConstFieldMaskArg whichField
)
862 Inherited::copyToBin(pMem
, whichField
);
864 if(FieldBits::NoField
!= (RootFieldMask
& whichField
))
866 _sfRoot
.copyToBin(pMem
);
868 if(FieldBits::NoField
!= (CameraFieldMask
& whichField
))
870 _sfCamera
.copyToBin(pMem
);
872 if(FieldBits::NoField
!= (BackgroundFieldMask
& whichField
))
874 _sfBackground
.copyToBin(pMem
);
876 if(FieldBits::NoField
!= (ForegroundsFieldMask
& whichField
))
878 _mfForegrounds
.copyToBin(pMem
);
880 if(FieldBits::NoField
!= (LeftBottomFieldMask
& whichField
))
882 _sfLeftBottom
.copyToBin(pMem
);
884 if(FieldBits::NoField
!= (RightTopFieldMask
& whichField
))
886 _sfRightTop
.copyToBin(pMem
);
888 if(FieldBits::NoField
!= (TravMaskFieldMask
& whichField
))
890 _sfTravMask
.copyToBin(pMem
);
892 if(FieldBits::NoField
!= (RenderOptionsFieldMask
& whichField
))
894 _sfRenderOptions
.copyToBin(pMem
);
896 if(FieldBits::NoField
!= (StereoModeFieldMask
& whichField
))
898 _sfStereoMode
.copyToBin(pMem
);
900 if(FieldBits::NoField
!= (PassiveFieldMask
& whichField
))
902 _sfPassive
.copyToBin(pMem
);
904 if(FieldBits::NoField
!= (ServerIdFieldMask
& whichField
))
906 _sfServerId
.copyToBin(pMem
);
908 if(FieldBits::NoField
!= (MouseDataVCFieldMask
& whichField
))
910 _sfMouseDataVC
.copyToBin(pMem
);
912 if(FieldBits::NoField
!= (MTouchDataVCFieldMask
& whichField
))
914 _sfMTouchDataVC
.copyToBin(pMem
);
918 void CSMViewportBase::copyFromBin(BinaryDataHandler
&pMem
,
919 ConstFieldMaskArg whichField
)
921 Inherited::copyFromBin(pMem
, whichField
);
923 if(FieldBits::NoField
!= (RootFieldMask
& whichField
))
925 editSField(RootFieldMask
);
926 _sfRoot
.copyFromBin(pMem
);
928 if(FieldBits::NoField
!= (CameraFieldMask
& whichField
))
930 editSField(CameraFieldMask
);
931 _sfCamera
.copyFromBin(pMem
);
933 if(FieldBits::NoField
!= (BackgroundFieldMask
& whichField
))
935 editSField(BackgroundFieldMask
);
936 _sfBackground
.copyFromBin(pMem
);
938 if(FieldBits::NoField
!= (ForegroundsFieldMask
& whichField
))
940 editMField(ForegroundsFieldMask
, _mfForegrounds
);
941 _mfForegrounds
.copyFromBin(pMem
);
943 if(FieldBits::NoField
!= (LeftBottomFieldMask
& whichField
))
945 editSField(LeftBottomFieldMask
);
946 _sfLeftBottom
.copyFromBin(pMem
);
948 if(FieldBits::NoField
!= (RightTopFieldMask
& whichField
))
950 editSField(RightTopFieldMask
);
951 _sfRightTop
.copyFromBin(pMem
);
953 if(FieldBits::NoField
!= (TravMaskFieldMask
& whichField
))
955 editSField(TravMaskFieldMask
);
956 _sfTravMask
.copyFromBin(pMem
);
958 if(FieldBits::NoField
!= (RenderOptionsFieldMask
& whichField
))
960 editSField(RenderOptionsFieldMask
);
961 _sfRenderOptions
.copyFromBin(pMem
);
963 if(FieldBits::NoField
!= (StereoModeFieldMask
& whichField
))
965 editSField(StereoModeFieldMask
);
966 _sfStereoMode
.copyFromBin(pMem
);
968 if(FieldBits::NoField
!= (PassiveFieldMask
& whichField
))
970 editSField(PassiveFieldMask
);
971 _sfPassive
.copyFromBin(pMem
);
973 if(FieldBits::NoField
!= (ServerIdFieldMask
& whichField
))
975 editSField(ServerIdFieldMask
);
976 _sfServerId
.copyFromBin(pMem
);
978 if(FieldBits::NoField
!= (MouseDataVCFieldMask
& whichField
))
980 editSField(MouseDataVCFieldMask
);
981 _sfMouseDataVC
.copyFromBin(pMem
);
983 if(FieldBits::NoField
!= (MTouchDataVCFieldMask
& whichField
))
985 editSField(MTouchDataVCFieldMask
);
986 _sfMTouchDataVC
.copyFromBin(pMem
);
990 //! create a new instance of the class
991 CSMViewportTransitPtr
CSMViewportBase::createLocal(BitVector bFlags
)
993 CSMViewportTransitPtr fc
;
995 if(getClassType().getPrototype() != NULL
)
997 FieldContainerTransitPtr tmpPtr
=
998 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
1000 fc
= dynamic_pointer_cast
<CSMViewport
>(tmpPtr
);
1006 //! create a new instance of the class, copy the container flags
1007 CSMViewportTransitPtr
CSMViewportBase::createDependent(BitVector bFlags
)
1009 CSMViewportTransitPtr fc
;
1011 if(getClassType().getPrototype() != NULL
)
1013 FieldContainerTransitPtr tmpPtr
=
1014 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
1016 fc
= dynamic_pointer_cast
<CSMViewport
>(tmpPtr
);
1022 //! create a new instance of the class
1023 CSMViewportTransitPtr
CSMViewportBase::create(void)
1025 return createLocal();
1028 CSMViewport
*CSMViewportBase::createEmptyLocal(BitVector bFlags
)
1030 CSMViewport
*returnValue
;
1032 newPtr
<CSMViewport
>(returnValue
, bFlags
);
1034 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
1039 //! create an empty new instance of the class, do not copy the prototype
1040 CSMViewport
*CSMViewportBase::createEmpty(void)
1042 return createEmptyLocal();
1046 FieldContainerTransitPtr
CSMViewportBase::shallowCopyLocal(
1047 BitVector bFlags
) const
1049 CSMViewport
*tmpPtr
;
1051 newPtr(tmpPtr
, dynamic_cast<const CSMViewport
*>(this), bFlags
);
1053 FieldContainerTransitPtr
returnValue(tmpPtr
);
1055 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
1060 FieldContainerTransitPtr
CSMViewportBase::shallowCopyDependent(
1061 BitVector bFlags
) const
1063 CSMViewport
*tmpPtr
;
1065 newPtr(tmpPtr
, dynamic_cast<const CSMViewport
*>(this), ~bFlags
);
1067 FieldContainerTransitPtr
returnValue(tmpPtr
);
1069 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
1074 FieldContainerTransitPtr
CSMViewportBase::shallowCopy(void) const
1076 return shallowCopyLocal();
1082 /*------------------------- constructors ----------------------------------*/
1084 CSMViewportBase::CSMViewportBase(void) :
1088 _sfBackground (NULL
),
1090 _sfLeftBottom (Vec2f(0.f
, 0.f
)),
1091 _sfRightTop (Vec2f(1.f
, 1.f
)),
1092 _sfTravMask (UInt32(TypeTraits
<UInt32
>::BitsSet
& ~TraversalMasks::FindNamedComponentTraversal
)),
1093 _sfRenderOptions (NULL
),
1094 _sfStereoMode (std::string("none")),
1095 _sfPassive (bool(false)),
1096 _sfServerId (Int32(-1)),
1102 CSMViewportBase::CSMViewportBase(const CSMViewportBase
&source
) :
1106 _sfBackground (NULL
),
1108 _sfLeftBottom (source
._sfLeftBottom
),
1109 _sfRightTop (source
._sfRightTop
),
1110 _sfTravMask (source
._sfTravMask
),
1111 _sfRenderOptions (NULL
),
1112 _sfStereoMode (source
._sfStereoMode
),
1113 _sfPassive (source
._sfPassive
),
1114 _sfServerId (source
._sfServerId
),
1115 _sfMouseDataVC (source
._sfMouseDataVC
),
1116 _sfMTouchDataVC (source
._sfMTouchDataVC
)
1121 /*-------------------------- destructors ----------------------------------*/
1123 CSMViewportBase::~CSMViewportBase(void)
1127 void CSMViewportBase::onCreate(const CSMViewport
*source
)
1129 Inherited::onCreate(source
);
1133 CSMViewport
*pThis
= static_cast<CSMViewport
*>(this);
1135 pThis
->setRoot(source
->getRoot());
1137 pThis
->setCamera(source
->getCamera());
1139 pThis
->setBackground(source
->getBackground());
1141 MFUnrecForegroundPtr::const_iterator ForegroundsIt
=
1142 source
->_mfForegrounds
.begin();
1143 MFUnrecForegroundPtr::const_iterator ForegroundsEnd
=
1144 source
->_mfForegrounds
.end ();
1146 while(ForegroundsIt
!= ForegroundsEnd
)
1148 pThis
->pushToForegrounds(*ForegroundsIt
);
1153 pThis
->setRenderOptions(source
->getRenderOptions());
1157 GetFieldHandlePtr
CSMViewportBase::getHandleRoot (void) const
1159 SFUnrecNodePtr::GetHandlePtr
returnValue(
1160 new SFUnrecNodePtr::GetHandle(
1162 this->getType().getFieldDesc(RootFieldId
),
1163 const_cast<CSMViewportBase
*>(this)));
1168 EditFieldHandlePtr
CSMViewportBase::editHandleRoot (void)
1170 SFUnrecNodePtr::EditHandlePtr
returnValue(
1171 new SFUnrecNodePtr::EditHandle(
1173 this->getType().getFieldDesc(RootFieldId
),
1176 returnValue
->setSetMethod(
1177 boost::bind(&CSMViewport::setRoot
,
1178 static_cast<CSMViewport
*>(this), _1
));
1180 editSField(RootFieldMask
);
1185 GetFieldHandlePtr
CSMViewportBase::getHandleCamera (void) const
1187 SFUnrecCameraPtr::GetHandlePtr
returnValue(
1188 new SFUnrecCameraPtr::GetHandle(
1190 this->getType().getFieldDesc(CameraFieldId
),
1191 const_cast<CSMViewportBase
*>(this)));
1196 EditFieldHandlePtr
CSMViewportBase::editHandleCamera (void)
1198 SFUnrecCameraPtr::EditHandlePtr
returnValue(
1199 new SFUnrecCameraPtr::EditHandle(
1201 this->getType().getFieldDesc(CameraFieldId
),
1204 returnValue
->setSetMethod(
1205 boost::bind(&CSMViewport::setCamera
,
1206 static_cast<CSMViewport
*>(this), _1
));
1208 editSField(CameraFieldMask
);
1213 GetFieldHandlePtr
CSMViewportBase::getHandleBackground (void) const
1215 SFUnrecBackgroundPtr::GetHandlePtr
returnValue(
1216 new SFUnrecBackgroundPtr::GetHandle(
1218 this->getType().getFieldDesc(BackgroundFieldId
),
1219 const_cast<CSMViewportBase
*>(this)));
1224 EditFieldHandlePtr
CSMViewportBase::editHandleBackground (void)
1226 SFUnrecBackgroundPtr::EditHandlePtr
returnValue(
1227 new SFUnrecBackgroundPtr::EditHandle(
1229 this->getType().getFieldDesc(BackgroundFieldId
),
1232 returnValue
->setSetMethod(
1233 boost::bind(&CSMViewport::setBackground
,
1234 static_cast<CSMViewport
*>(this), _1
));
1236 editSField(BackgroundFieldMask
);
1241 GetFieldHandlePtr
CSMViewportBase::getHandleForegrounds (void) const
1243 MFUnrecForegroundPtr::GetHandlePtr
returnValue(
1244 new MFUnrecForegroundPtr::GetHandle(
1246 this->getType().getFieldDesc(ForegroundsFieldId
),
1247 const_cast<CSMViewportBase
*>(this)));
1252 EditFieldHandlePtr
CSMViewportBase::editHandleForegrounds (void)
1254 MFUnrecForegroundPtr::EditHandlePtr
returnValue(
1255 new MFUnrecForegroundPtr::EditHandle(
1257 this->getType().getFieldDesc(ForegroundsFieldId
),
1260 returnValue
->setAddMethod(
1261 boost::bind(&CSMViewport::pushToForegrounds
,
1262 static_cast<CSMViewport
*>(this), _1
));
1263 returnValue
->setRemoveMethod(
1264 boost::bind(&CSMViewport::removeFromForegrounds
,
1265 static_cast<CSMViewport
*>(this), _1
));
1266 returnValue
->setRemoveObjMethod(
1267 boost::bind(&CSMViewport::removeObjFromForegrounds
,
1268 static_cast<CSMViewport
*>(this), _1
));
1269 returnValue
->setClearMethod(
1270 boost::bind(&CSMViewport::clearForegrounds
,
1271 static_cast<CSMViewport
*>(this)));
1273 editMField(ForegroundsFieldMask
, _mfForegrounds
);
1278 GetFieldHandlePtr
CSMViewportBase::getHandleLeftBottom (void) const
1280 SFVec2f::GetHandlePtr
returnValue(
1281 new SFVec2f::GetHandle(
1283 this->getType().getFieldDesc(LeftBottomFieldId
),
1284 const_cast<CSMViewportBase
*>(this)));
1289 EditFieldHandlePtr
CSMViewportBase::editHandleLeftBottom (void)
1291 SFVec2f::EditHandlePtr
returnValue(
1292 new SFVec2f::EditHandle(
1294 this->getType().getFieldDesc(LeftBottomFieldId
),
1298 editSField(LeftBottomFieldMask
);
1303 GetFieldHandlePtr
CSMViewportBase::getHandleRightTop (void) const
1305 SFVec2f::GetHandlePtr
returnValue(
1306 new SFVec2f::GetHandle(
1308 this->getType().getFieldDesc(RightTopFieldId
),
1309 const_cast<CSMViewportBase
*>(this)));
1314 EditFieldHandlePtr
CSMViewportBase::editHandleRightTop (void)
1316 SFVec2f::EditHandlePtr
returnValue(
1317 new SFVec2f::EditHandle(
1319 this->getType().getFieldDesc(RightTopFieldId
),
1323 editSField(RightTopFieldMask
);
1328 GetFieldHandlePtr
CSMViewportBase::getHandleTravMask (void) const
1330 SFUInt32::GetHandlePtr
returnValue(
1331 new SFUInt32::GetHandle(
1333 this->getType().getFieldDesc(TravMaskFieldId
),
1334 const_cast<CSMViewportBase
*>(this)));
1339 EditFieldHandlePtr
CSMViewportBase::editHandleTravMask (void)
1341 SFUInt32::EditHandlePtr
returnValue(
1342 new SFUInt32::EditHandle(
1344 this->getType().getFieldDesc(TravMaskFieldId
),
1348 editSField(TravMaskFieldMask
);
1353 GetFieldHandlePtr
CSMViewportBase::getHandleRenderOptions (void) const
1355 SFUnrecRenderOptionsPtr::GetHandlePtr
returnValue(
1356 new SFUnrecRenderOptionsPtr::GetHandle(
1358 this->getType().getFieldDesc(RenderOptionsFieldId
),
1359 const_cast<CSMViewportBase
*>(this)));
1364 EditFieldHandlePtr
CSMViewportBase::editHandleRenderOptions (void)
1366 SFUnrecRenderOptionsPtr::EditHandlePtr
returnValue(
1367 new SFUnrecRenderOptionsPtr::EditHandle(
1369 this->getType().getFieldDesc(RenderOptionsFieldId
),
1372 returnValue
->setSetMethod(
1373 boost::bind(&CSMViewport::setRenderOptions
,
1374 static_cast<CSMViewport
*>(this), _1
));
1376 editSField(RenderOptionsFieldMask
);
1381 GetFieldHandlePtr
CSMViewportBase::getHandleStereoMode (void) const
1383 SFString::GetHandlePtr
returnValue(
1384 new SFString::GetHandle(
1386 this->getType().getFieldDesc(StereoModeFieldId
),
1387 const_cast<CSMViewportBase
*>(this)));
1392 EditFieldHandlePtr
CSMViewportBase::editHandleStereoMode (void)
1394 SFString::EditHandlePtr
returnValue(
1395 new SFString::EditHandle(
1397 this->getType().getFieldDesc(StereoModeFieldId
),
1401 editSField(StereoModeFieldMask
);
1406 GetFieldHandlePtr
CSMViewportBase::getHandlePassive (void) const
1408 SFBool::GetHandlePtr
returnValue(
1409 new SFBool::GetHandle(
1411 this->getType().getFieldDesc(PassiveFieldId
),
1412 const_cast<CSMViewportBase
*>(this)));
1417 EditFieldHandlePtr
CSMViewportBase::editHandlePassive (void)
1419 SFBool::EditHandlePtr
returnValue(
1420 new SFBool::EditHandle(
1422 this->getType().getFieldDesc(PassiveFieldId
),
1426 editSField(PassiveFieldMask
);
1431 GetFieldHandlePtr
CSMViewportBase::getHandleServerId (void) const
1433 SFInt32::GetHandlePtr
returnValue(
1434 new SFInt32::GetHandle(
1436 this->getType().getFieldDesc(ServerIdFieldId
),
1437 const_cast<CSMViewportBase
*>(this)));
1442 EditFieldHandlePtr
CSMViewportBase::editHandleServerId (void)
1444 SFInt32::EditHandlePtr
returnValue(
1445 new SFInt32::EditHandle(
1447 this->getType().getFieldDesc(ServerIdFieldId
),
1451 editSField(ServerIdFieldMask
);
1456 GetFieldHandlePtr
CSMViewportBase::getHandleMouseDataVC (void) const
1458 SFMouseData::GetHandlePtr
returnValue(
1459 new SFMouseData::GetHandle(
1461 this->getType().getFieldDesc(MouseDataVCFieldId
),
1462 const_cast<CSMViewportBase
*>(this)));
1467 EditFieldHandlePtr
CSMViewportBase::editHandleMouseDataVC (void)
1469 SFMouseData::EditHandlePtr
returnValue(
1470 new SFMouseData::EditHandle(
1472 this->getType().getFieldDesc(MouseDataVCFieldId
),
1476 editSField(MouseDataVCFieldMask
);
1481 GetFieldHandlePtr
CSMViewportBase::getHandleMTouchDataVC (void) const
1483 SFMTouchData::GetHandlePtr
returnValue(
1484 new SFMTouchData::GetHandle(
1486 this->getType().getFieldDesc(MTouchDataVCFieldId
),
1487 const_cast<CSMViewportBase
*>(this)));
1492 EditFieldHandlePtr
CSMViewportBase::editHandleMTouchDataVC (void)
1494 SFMTouchData::EditHandlePtr
returnValue(
1495 new SFMTouchData::EditHandle(
1497 this->getType().getFieldDesc(MTouchDataVCFieldId
),
1501 editSField(MTouchDataVCFieldMask
);
1507 #ifdef OSG_MT_CPTR_ASPECT
1508 void CSMViewportBase::execSyncV( FieldContainer
&oFrom
,
1509 ConstFieldMaskArg whichField
,
1510 AspectOffsetStore
&oOffsets
,
1511 ConstFieldMaskArg syncMode
,
1512 const UInt32 uiSyncInfo
)
1514 CSMViewport
*pThis
= static_cast<CSMViewport
*>(this);
1516 pThis
->execSync(static_cast<CSMViewport
*>(&oFrom
),
1525 #ifdef OSG_MT_CPTR_ASPECT
1526 FieldContainer
*CSMViewportBase::createAspectCopy(
1527 const FieldContainer
*pRefAspect
) const
1529 CSMViewport
*returnValue
;
1531 newAspectCopy(returnValue
,
1532 dynamic_cast<const CSMViewport
*>(pRefAspect
),
1533 dynamic_cast<const CSMViewport
*>(this));
1539 void CSMViewportBase::resolveLinks(void)
1541 Inherited::resolveLinks();
1543 static_cast<CSMViewport
*>(this)->setRoot(NULL
);
1545 static_cast<CSMViewport
*>(this)->setCamera(NULL
);
1547 static_cast<CSMViewport
*>(this)->setBackground(NULL
);
1549 static_cast<CSMViewport
*>(this)->clearForegrounds();
1551 static_cast<CSMViewport
*>(this)->setRenderOptions(NULL
);