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 "OSGFieldContainer.h" // Parent Class
66 #include "OSGCamera.h" // Camera Class
67 #include "OSGNode.h" // Root Class
68 #include "OSGBackground.h" // Background Class
69 #include "OSGForeground.h" // Foregrounds Class
71 #include "OSGViewportBase.h"
72 #include "OSGViewport.h"
74 #include <boost/bind.hpp>
78 /***************************************************************************\
80 \***************************************************************************/
82 /*! \class OSG::Viewport
83 A Viewport is a part of the Window it is attached to used for rendering. See
84 \ref PageSystemWindowViewports for a description.
86 The size of the viewport is defined by the _sfLeft, _sfRight, _sfBottom and
87 _sfTop Fields. The Window this Viewport is attached is stored in _sfWindow.
88 _sfBackground defines the background clearing method, the
89 _sfRoot and _sfCamera Fields the scene being rendered and the camera used to
90 view it. The optional _mfForegrounds define which information are added or
91 actions are executed after the Viewport has been rendered.
95 To create a new Viewport the draw and render methods should be overridden.
101 When adding fields to the Viewport, make sure to add the code to copy them to
102 all the different ClusterWindows!
107 /***************************************************************************\
108 * Field Documentation *
109 \***************************************************************************/
111 /*! \var FieldContainer * ViewportBase::_sfParent
112 The Window this viewport is contained in.
115 /*! \var Camera * ViewportBase::_sfCamera
116 The Camera used to render the viewport.
119 /*! \var Node * ViewportBase::_sfRoot
120 The root of the tree that is displayed in this viewport.
123 /*! \var Background * ViewportBase::_sfBackground
124 The background used to clear this viewport.
127 /*! \var Foreground * ViewportBase::_mfForegrounds
128 The foreground additions to the rendered image.
132 /***************************************************************************\
133 * FieldType/FieldTrait Instantiation *
134 \***************************************************************************/
136 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
137 PointerType FieldTraits
<Viewport
*, nsOSG
>::_type(
140 Viewport::getClassType(),
144 OSG_FIELDTRAITS_GETTYPE_NS(Viewport
*, nsOSG
)
146 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
150 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
154 DataType
&FieldTraits
< Viewport
*, nsOSG
+ 1 >::getType(void)
156 return FieldTraits
<Viewport
*, nsOSG
>::getType();
160 OSG_EXPORT_PTR_MFIELD(ChildPointerMField
,
162 UnrecordedRefCountPolicy
,
166 /***************************************************************************\
167 * Field Description *
168 \***************************************************************************/
170 void ViewportBase::classDescInserter(TypeObject
&oType
)
172 FieldDescriptionBase
*pDesc
= NULL
;
175 pDesc
= new SFParentFieldContainerPtr::Description(
176 SFParentFieldContainerPtr::getClassType(),
178 "The Window this viewport is contained in.\n",
179 ParentFieldId
, ParentFieldMask
,
181 (Field::SFDefaultFlags
| Field::FStdAccess
),
182 static_cast <FieldEditMethodSig
>(&Viewport::invalidEditField
),
183 static_cast <FieldGetMethodSig
>(&Viewport::invalidGetField
));
185 oType
.addInitialDesc(pDesc
);
187 pDesc
= new SFUnrecCameraPtr::Description(
188 SFUnrecCameraPtr::getClassType(),
190 "The Camera used to render the viewport.\n",
191 CameraFieldId
, CameraFieldMask
,
193 (Field::SFDefaultFlags
| Field::FStdAccess
),
194 static_cast<FieldEditMethodSig
>(&Viewport::editHandleCamera
),
195 static_cast<FieldGetMethodSig
>(&Viewport::getHandleCamera
));
197 oType
.addInitialDesc(pDesc
);
199 pDesc
= new SFUnrecNodePtr::Description(
200 SFUnrecNodePtr::getClassType(),
202 "The root of the tree that is displayed in this viewport.\n",
203 RootFieldId
, RootFieldMask
,
205 (Field::SFDefaultFlags
| Field::FStdAccess
),
206 static_cast<FieldEditMethodSig
>(&Viewport::editHandleRoot
),
207 static_cast<FieldGetMethodSig
>(&Viewport::getHandleRoot
));
209 oType
.addInitialDesc(pDesc
);
211 pDesc
= new SFUnrecBackgroundPtr::Description(
212 SFUnrecBackgroundPtr::getClassType(),
214 "The background used to clear this viewport.\n",
215 BackgroundFieldId
, BackgroundFieldMask
,
217 (Field::SFDefaultFlags
| Field::FStdAccess
),
218 static_cast<FieldEditMethodSig
>(&Viewport::editHandleBackground
),
219 static_cast<FieldGetMethodSig
>(&Viewport::getHandleBackground
));
221 oType
.addInitialDesc(pDesc
);
223 pDesc
= new MFUnrecForegroundPtr::Description(
224 MFUnrecForegroundPtr::getClassType(),
226 "The foreground additions to the rendered image.\n",
227 ForegroundsFieldId
, ForegroundsFieldMask
,
229 (Field::MFDefaultFlags
| Field::FStdAccess
),
230 static_cast<FieldEditMethodSig
>(&Viewport::editHandleForegrounds
),
231 static_cast<FieldGetMethodSig
>(&Viewport::getHandleForegrounds
));
233 oType
.addInitialDesc(pDesc
);
237 ViewportBase::TypeObject
ViewportBase::_type(
238 ViewportBase::getClassname(),
239 Inherited::getClassname(),
242 reinterpret_cast<PrototypeCreateF
>(&ViewportBase::createEmptyLocal
),
243 reinterpret_cast<InitContainerF
>(&Viewport::initMethod
),
244 reinterpret_cast<ExitContainerF
>(&Viewport::exitMethod
),
245 reinterpret_cast<InitalInsertDescFunc
>(
246 reinterpret_cast<void *>(&Viewport::classDescInserter
)),
249 "<?xml version=\"1.0\"?>\n"
252 " name=\"Viewport\"\n"
253 " parent=\"Viewarea\"\n"
254 " library=\"System\"\n"
255 " pointerfieldtypes=\"both\"\n"
256 " structure=\"concrete\"\n"
257 " systemcomponent=\"true\"\n"
258 " parentsystemcomponent=\"true\"\n"
259 " childFields=\"multi\"\n"
260 " docGroupBase=\"GrpSystemWindow\"\n"
263 " A Viewport is a part of the Window it is attached to used for rendering. See\n"
264 " \\ref PageSystemWindowViewports for a description.\n"
266 " The size of the viewport is defined by the _sfLeft, _sfRight, _sfBottom and\n"
267 " _sfTop Fields. The Window this Viewport is attached is stored in _sfWindow.\n"
268 " _sfBackground defines the background clearing method, the\n"
269 " _sfRoot and _sfCamera Fields the scene being rendered and the camera used to\n"
270 " view it. The optional _mfForegrounds define which information are added or\n"
271 " actions are executed after the Viewport has been rendered.\n"
275 " To create a new Viewport the draw and render methods should be overridden. \n"
281 " When adding fields to the Viewport, make sure to add the code to copy them to\n"
282 " all the different ClusterWindows!\n"
288 " type=\"FieldContainer\"\n"
289 " cardinality=\"single\"\n"
290 " visibility=\"external\"\n"
292 " category=\"parentpointer\"\n"
294 " The Window this viewport is contained in.\n"
298 " type=\"CameraPtr\"\n"
299 " cardinality=\"single\"\n"
300 " visibility=\"external\"\n"
301 " access=\"public\"\n"
303 " The Camera used to render the viewport.\n"
307 " type=\"NodePtr\"\n"
308 " cardinality=\"single\"\n"
309 " visibility=\"external\"\n"
310 " access=\"public\"\n"
312 " The root of the tree that is displayed in this viewport.\n"
315 " name=\"background\"\n"
316 " type=\"BackgroundPtr\"\n"
317 " cardinality=\"single\"\n"
318 " visibility=\"external\"\n"
319 " access=\"public\"\n"
321 " The background used to clear this viewport.\n"
324 " name=\"foregrounds\"\n"
325 " type=\"ForegroundPtr\"\n"
326 " cardinality=\"multi\"\n"
327 " visibility=\"external\"\n"
328 " access=\"public\"\n"
329 " pushToFieldAs=\"addForeground\"\n"
331 " The foreground additions to the rendered image.\n"
333 "</FieldContainer>\n",
334 "A Viewport is a part of the Window it is attached to used for rendering. See\n"
335 "\\ref PageSystemWindowViewports for a description.\n"
337 "The size of the viewport is defined by the _sfLeft, _sfRight, _sfBottom and\n"
338 "_sfTop Fields. The Window this Viewport is attached is stored in _sfWindow.\n"
339 "_sfBackground defines the background clearing method, the\n"
340 "_sfRoot and _sfCamera Fields the scene being rendered and the camera used to\n"
341 "view it. The optional _mfForegrounds define which information are added or\n"
342 "actions are executed after the Viewport has been rendered.\n"
346 "To create a new Viewport the draw and render methods should be overridden. \n"
352 "When adding fields to the Viewport, make sure to add the code to copy them to\n"
353 "all the different ClusterWindows!\n"
358 /*------------------------------ get -----------------------------------*/
360 FieldContainerType
&ViewportBase::getType(void)
365 const FieldContainerType
&ViewportBase::getType(void) const
370 UInt32
ViewportBase::getContainerSize(void) const
372 return sizeof(Viewport
);
375 /*------------------------- decorator get ------------------------------*/
379 //! Get the Viewport::_sfCamera field.
380 const SFUnrecCameraPtr
*ViewportBase::getSFCamera(void) const
385 SFUnrecCameraPtr
*ViewportBase::editSFCamera (void)
387 editSField(CameraFieldMask
);
392 //! Get the value of the Viewport::_sfCamera field.
393 Camera
* ViewportBase::getCamera(void) const
395 return _sfCamera
.getValue();
398 //! Set the value of the Viewport::_sfCamera field.
399 void ViewportBase::setCamera(Camera
* const value
)
401 editSField(CameraFieldMask
);
403 _sfCamera
.setValue(value
);
407 //! Get the Viewport::_sfRoot field.
408 const SFUnrecNodePtr
*ViewportBase::getSFRoot(void) const
413 SFUnrecNodePtr
*ViewportBase::editSFRoot (void)
415 editSField(RootFieldMask
);
420 //! Get the value of the Viewport::_sfRoot field.
421 Node
* ViewportBase::getRoot(void) const
423 return _sfRoot
.getValue();
426 //! Set the value of the Viewport::_sfRoot field.
427 void ViewportBase::setRoot(Node
* const value
)
429 editSField(RootFieldMask
);
431 _sfRoot
.setValue(value
);
435 //! Get the Viewport::_sfBackground field.
436 const SFUnrecBackgroundPtr
*ViewportBase::getSFBackground(void) const
438 return &_sfBackground
;
441 SFUnrecBackgroundPtr
*ViewportBase::editSFBackground (void)
443 editSField(BackgroundFieldMask
);
445 return &_sfBackground
;
448 //! Get the value of the Viewport::_sfBackground field.
449 Background
* ViewportBase::getBackground(void) const
451 return _sfBackground
.getValue();
454 //! Set the value of the Viewport::_sfBackground field.
455 void ViewportBase::setBackground(Background
* const value
)
457 editSField(BackgroundFieldMask
);
459 _sfBackground
.setValue(value
);
463 //! Get the Viewport::_mfForegrounds field.
464 const MFUnrecForegroundPtr
*ViewportBase::getMFForegrounds(void) const
466 return &_mfForegrounds
;
469 MFUnrecForegroundPtr
*ViewportBase::editMFForegrounds (void)
471 editMField(ForegroundsFieldMask
, _mfForegrounds
);
473 return &_mfForegrounds
;
475 Foreground
* ViewportBase::getForegrounds(const UInt32 index
) const
477 return _mfForegrounds
[index
];
482 void ViewportBase::addForeground(Foreground
* const value
)
484 editMField(ForegroundsFieldMask
, _mfForegrounds
);
486 _mfForegrounds
.push_back(value
);
489 void ViewportBase::assignForegrounds(const MFUnrecForegroundPtr
&value
)
491 MFUnrecForegroundPtr::const_iterator elemIt
=
493 MFUnrecForegroundPtr::const_iterator elemEnd
=
496 static_cast<Viewport
*>(this)->clearForegrounds();
498 while(elemIt
!= elemEnd
)
500 this->addForeground(*elemIt
);
506 void ViewportBase::removeFromForegrounds(UInt32 uiIndex
)
508 if(uiIndex
< _mfForegrounds
.size())
510 editMField(ForegroundsFieldMask
, _mfForegrounds
);
512 _mfForegrounds
.erase(uiIndex
);
516 void ViewportBase::removeObjFromForegrounds(Foreground
* const value
)
518 Int32 iElemIdx
= _mfForegrounds
.findIndex(value
);
522 editMField(ForegroundsFieldMask
, _mfForegrounds
);
524 _mfForegrounds
.erase(iElemIdx
);
527 void ViewportBase::clearForegrounds(void)
529 editMField(ForegroundsFieldMask
, _mfForegrounds
);
532 _mfForegrounds
.clear();
537 /*------------------------------ access -----------------------------------*/
539 SizeT
ViewportBase::getBinSize(ConstFieldMaskArg whichField
)
541 SizeT returnValue
= Inherited::getBinSize(whichField
);
543 if(FieldBits::NoField
!= (ParentFieldMask
& whichField
))
545 returnValue
+= _sfParent
.getBinSize();
547 if(FieldBits::NoField
!= (CameraFieldMask
& whichField
))
549 returnValue
+= _sfCamera
.getBinSize();
551 if(FieldBits::NoField
!= (RootFieldMask
& whichField
))
553 returnValue
+= _sfRoot
.getBinSize();
555 if(FieldBits::NoField
!= (BackgroundFieldMask
& whichField
))
557 returnValue
+= _sfBackground
.getBinSize();
559 if(FieldBits::NoField
!= (ForegroundsFieldMask
& whichField
))
561 returnValue
+= _mfForegrounds
.getBinSize();
567 void ViewportBase::copyToBin(BinaryDataHandler
&pMem
,
568 ConstFieldMaskArg whichField
)
570 Inherited::copyToBin(pMem
, whichField
);
572 if(FieldBits::NoField
!= (ParentFieldMask
& whichField
))
574 _sfParent
.copyToBin(pMem
);
576 if(FieldBits::NoField
!= (CameraFieldMask
& whichField
))
578 _sfCamera
.copyToBin(pMem
);
580 if(FieldBits::NoField
!= (RootFieldMask
& whichField
))
582 _sfRoot
.copyToBin(pMem
);
584 if(FieldBits::NoField
!= (BackgroundFieldMask
& whichField
))
586 _sfBackground
.copyToBin(pMem
);
588 if(FieldBits::NoField
!= (ForegroundsFieldMask
& whichField
))
590 _mfForegrounds
.copyToBin(pMem
);
594 void ViewportBase::copyFromBin(BinaryDataHandler
&pMem
,
595 ConstFieldMaskArg whichField
)
597 Inherited::copyFromBin(pMem
, whichField
);
599 if(FieldBits::NoField
!= (ParentFieldMask
& whichField
))
601 editSField(ParentFieldMask
);
602 _sfParent
.copyFromBin(pMem
);
604 if(FieldBits::NoField
!= (CameraFieldMask
& whichField
))
606 editSField(CameraFieldMask
);
607 _sfCamera
.copyFromBin(pMem
);
609 if(FieldBits::NoField
!= (RootFieldMask
& whichField
))
611 editSField(RootFieldMask
);
612 _sfRoot
.copyFromBin(pMem
);
614 if(FieldBits::NoField
!= (BackgroundFieldMask
& whichField
))
616 editSField(BackgroundFieldMask
);
617 _sfBackground
.copyFromBin(pMem
);
619 if(FieldBits::NoField
!= (ForegroundsFieldMask
& whichField
))
621 editMField(ForegroundsFieldMask
, _mfForegrounds
);
622 _mfForegrounds
.copyFromBin(pMem
);
626 //! create a new instance of the class
627 ViewportTransitPtr
ViewportBase::createLocal(BitVector bFlags
)
629 ViewportTransitPtr fc
;
631 if(getClassType().getPrototype() != NULL
)
633 FieldContainerTransitPtr tmpPtr
=
634 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
636 fc
= dynamic_pointer_cast
<Viewport
>(tmpPtr
);
642 //! create a new instance of the class, copy the container flags
643 ViewportTransitPtr
ViewportBase::createDependent(BitVector bFlags
)
645 ViewportTransitPtr fc
;
647 if(getClassType().getPrototype() != NULL
)
649 FieldContainerTransitPtr tmpPtr
=
650 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
652 fc
= dynamic_pointer_cast
<Viewport
>(tmpPtr
);
658 //! create a new instance of the class
659 ViewportTransitPtr
ViewportBase::create(void)
661 ViewportTransitPtr fc
;
663 if(getClassType().getPrototype() != NULL
)
665 FieldContainerTransitPtr tmpPtr
=
666 getClassType().getPrototype()-> shallowCopy();
668 fc
= dynamic_pointer_cast
<Viewport
>(tmpPtr
);
674 Viewport
*ViewportBase::createEmptyLocal(BitVector bFlags
)
676 Viewport
*returnValue
;
678 newPtr
<Viewport
>(returnValue
, bFlags
);
680 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
685 //! create an empty new instance of the class, do not copy the prototype
686 Viewport
*ViewportBase::createEmpty(void)
688 Viewport
*returnValue
;
690 newPtr
<Viewport
>(returnValue
, Thread::getCurrentLocalFlags());
692 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
693 ~Thread::getCurrentLocalFlags();
699 FieldContainerTransitPtr
ViewportBase::shallowCopyLocal(
700 BitVector bFlags
) const
704 newPtr(tmpPtr
, dynamic_cast<const Viewport
*>(this), bFlags
);
706 FieldContainerTransitPtr
returnValue(tmpPtr
);
708 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
713 FieldContainerTransitPtr
ViewportBase::shallowCopyDependent(
714 BitVector bFlags
) const
718 newPtr(tmpPtr
, dynamic_cast<const Viewport
*>(this), ~bFlags
);
720 FieldContainerTransitPtr
returnValue(tmpPtr
);
722 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
727 FieldContainerTransitPtr
ViewportBase::shallowCopy(void) const
732 dynamic_cast<const Viewport
*>(this),
733 Thread::getCurrentLocalFlags());
735 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
737 FieldContainerTransitPtr
returnValue(tmpPtr
);
745 /*------------------------- constructors ----------------------------------*/
747 ViewportBase::ViewportBase(void) :
752 _sfBackground (NULL
),
757 ViewportBase::ViewportBase(const ViewportBase
&source
) :
762 _sfBackground (NULL
),
768 /*-------------------------- destructors ----------------------------------*/
770 ViewportBase::~ViewportBase(void)
773 /*-------------------------------------------------------------------------*/
776 bool ViewportBase::linkParent(
777 FieldContainer
* const pParent
,
778 UInt16
const childFieldId
,
779 UInt16
const parentFieldId
)
781 if(parentFieldId
== ParentFieldId
)
783 FieldContainer
* pTypedParent
=
784 dynamic_cast< FieldContainer
* >(pParent
);
786 if(pTypedParent
!= NULL
)
788 FieldContainer
*pOldParent
=
789 _sfParent
.getValue ();
791 UInt16 oldChildFieldId
=
792 _sfParent
.getParentFieldPos();
794 if(pOldParent
!= NULL
)
796 pOldParent
->unlinkChild(this, oldChildFieldId
);
799 editSField(ParentFieldMask
);
801 _sfParent
.setValue(static_cast<FieldContainer
*>(pParent
), childFieldId
);
809 return Inherited::linkParent(pParent
, childFieldId
, parentFieldId
);
812 bool ViewportBase::unlinkParent(
813 FieldContainer
* const pParent
,
814 UInt16
const parentFieldId
)
816 if(parentFieldId
== ParentFieldId
)
818 FieldContainer
* pTypedParent
=
819 dynamic_cast< FieldContainer
* >(pParent
);
821 if(pTypedParent
!= NULL
)
823 if(_sfParent
.getValue() == pTypedParent
)
825 editSField(ParentFieldMask
);
827 _sfParent
.setValue(NULL
, 0xFFFF);
832 SWARNING
<< "Child ([" << this
833 << "] id [" << this->getId()
834 << "] type [" << this->getType().getCName()
835 << "] parentFieldId [" << parentFieldId
836 << "]) - Parent ([" << pParent
837 << "] id [" << pParent
->getId()
838 << "] type [" << pParent
->getType().getCName()
839 << "]): link inconsistent!"
848 return Inherited::unlinkParent(pParent
, parentFieldId
);
852 void ViewportBase::onCreate(const Viewport
*source
)
854 Inherited::onCreate(source
);
858 Viewport
*pThis
= static_cast<Viewport
*>(this);
860 pThis
->setCamera(source
->getCamera());
862 pThis
->setRoot(source
->getRoot());
864 pThis
->setBackground(source
->getBackground());
866 MFUnrecForegroundPtr::const_iterator ForegroundsIt
=
867 source
->_mfForegrounds
.begin();
868 MFUnrecForegroundPtr::const_iterator ForegroundsEnd
=
869 source
->_mfForegrounds
.end ();
871 while(ForegroundsIt
!= ForegroundsEnd
)
873 pThis
->addForeground(*ForegroundsIt
);
880 GetFieldHandlePtr
ViewportBase::getHandleParent (void) const
882 SFParentFieldContainerPtr::GetHandlePtr returnValue
;
887 EditFieldHandlePtr
ViewportBase::editHandleParent (void)
889 EditFieldHandlePtr returnValue
;
894 GetFieldHandlePtr
ViewportBase::getHandleCamera (void) const
896 SFUnrecCameraPtr::GetHandlePtr
returnValue(
897 new SFUnrecCameraPtr::GetHandle(
899 this->getType().getFieldDesc(CameraFieldId
),
900 const_cast<ViewportBase
*>(this)));
905 EditFieldHandlePtr
ViewportBase::editHandleCamera (void)
907 SFUnrecCameraPtr::EditHandlePtr
returnValue(
908 new SFUnrecCameraPtr::EditHandle(
910 this->getType().getFieldDesc(CameraFieldId
),
913 returnValue
->setSetMethod(
914 boost::bind(&Viewport::setCamera
,
915 static_cast<Viewport
*>(this), _1
));
917 editSField(CameraFieldMask
);
922 GetFieldHandlePtr
ViewportBase::getHandleRoot (void) const
924 SFUnrecNodePtr::GetHandlePtr
returnValue(
925 new SFUnrecNodePtr::GetHandle(
927 this->getType().getFieldDesc(RootFieldId
),
928 const_cast<ViewportBase
*>(this)));
933 EditFieldHandlePtr
ViewportBase::editHandleRoot (void)
935 SFUnrecNodePtr::EditHandlePtr
returnValue(
936 new SFUnrecNodePtr::EditHandle(
938 this->getType().getFieldDesc(RootFieldId
),
941 returnValue
->setSetMethod(
942 boost::bind(&Viewport::setRoot
,
943 static_cast<Viewport
*>(this), _1
));
945 editSField(RootFieldMask
);
950 GetFieldHandlePtr
ViewportBase::getHandleBackground (void) const
952 SFUnrecBackgroundPtr::GetHandlePtr
returnValue(
953 new SFUnrecBackgroundPtr::GetHandle(
955 this->getType().getFieldDesc(BackgroundFieldId
),
956 const_cast<ViewportBase
*>(this)));
961 EditFieldHandlePtr
ViewportBase::editHandleBackground (void)
963 SFUnrecBackgroundPtr::EditHandlePtr
returnValue(
964 new SFUnrecBackgroundPtr::EditHandle(
966 this->getType().getFieldDesc(BackgroundFieldId
),
969 returnValue
->setSetMethod(
970 boost::bind(&Viewport::setBackground
,
971 static_cast<Viewport
*>(this), _1
));
973 editSField(BackgroundFieldMask
);
978 GetFieldHandlePtr
ViewportBase::getHandleForegrounds (void) const
980 MFUnrecForegroundPtr::GetHandlePtr
returnValue(
981 new MFUnrecForegroundPtr::GetHandle(
983 this->getType().getFieldDesc(ForegroundsFieldId
),
984 const_cast<ViewportBase
*>(this)));
989 EditFieldHandlePtr
ViewportBase::editHandleForegrounds (void)
991 MFUnrecForegroundPtr::EditHandlePtr
returnValue(
992 new MFUnrecForegroundPtr::EditHandle(
994 this->getType().getFieldDesc(ForegroundsFieldId
),
997 returnValue
->setAddMethod(
998 boost::bind(&Viewport::addForeground
,
999 static_cast<Viewport
*>(this), _1
));
1000 returnValue
->setRemoveMethod(
1001 boost::bind(&Viewport::removeFromForegrounds
,
1002 static_cast<Viewport
*>(this), _1
));
1003 returnValue
->setRemoveObjMethod(
1004 boost::bind(&Viewport::removeObjFromForegrounds
,
1005 static_cast<Viewport
*>(this), _1
));
1006 returnValue
->setClearMethod(
1007 boost::bind(&Viewport::clearForegrounds
,
1008 static_cast<Viewport
*>(this)));
1010 editMField(ForegroundsFieldMask
, _mfForegrounds
);
1016 #ifdef OSG_MT_CPTR_ASPECT
1017 void ViewportBase::execSyncV( FieldContainer
&oFrom
,
1018 ConstFieldMaskArg whichField
,
1019 AspectOffsetStore
&oOffsets
,
1020 ConstFieldMaskArg syncMode
,
1021 const UInt32 uiSyncInfo
)
1023 Viewport
*pThis
= static_cast<Viewport
*>(this);
1025 pThis
->execSync(static_cast<Viewport
*>(&oFrom
),
1034 #ifdef OSG_MT_CPTR_ASPECT
1035 FieldContainer
*ViewportBase::createAspectCopy(
1036 const FieldContainer
*pRefAspect
) const
1038 Viewport
*returnValue
;
1040 newAspectCopy(returnValue
,
1041 dynamic_cast<const Viewport
*>(pRefAspect
),
1042 dynamic_cast<const Viewport
*>(this));
1048 void ViewportBase::resolveLinks(void)
1050 Inherited::resolveLinks();
1052 static_cast<Viewport
*>(this)->setCamera(NULL
);
1054 static_cast<Viewport
*>(this)->setRoot(NULL
);
1056 static_cast<Viewport
*>(this)->setBackground(NULL
);
1058 static_cast<Viewport
*>(this)->clearForegrounds();