1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
42 ** This file is automatically generated. **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
47 ** Do not change this file, changes should be done in the derived **
48 ** class MultiDisplayWindow!
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"
66 #include "OSGMultiDisplayWindowBase.h"
67 #include "OSGMultiDisplayWindow.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::MultiDisplayWindow
78 Cluster rendering configuration for multible displays
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var UInt32 MultiDisplayWindowBase::_sfHServers
86 Number of horizontal servers
89 /*! \var UInt32 MultiDisplayWindowBase::_sfVServers
90 Number of vertical servers
93 /*! \var bool MultiDisplayWindowBase::_sfManageClientViewports
94 If true, duplicate all viewports into the client window
97 /*! \var Int32 MultiDisplayWindowBase::_sfXOverlap
101 /*! \var Int32 MultiDisplayWindowBase::_sfYOverlap
105 /*! \var Int32 MultiDisplayWindowBase::_sfMaxDepth
106 Maximum depth in scene to create load groups for load balancing. Bigger
107 values are more precise but slower.
111 /***************************************************************************\
112 * FieldType/FieldTrait Instantiation *
113 \***************************************************************************/
115 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
116 PointerType FieldTraits
<MultiDisplayWindow
*, nsOSG
>::_type(
117 "MultiDisplayWindowPtr",
119 MultiDisplayWindow::getClassType(),
123 OSG_FIELDTRAITS_GETTYPE_NS(MultiDisplayWindow
*, nsOSG
)
125 /***************************************************************************\
126 * Field Description *
127 \***************************************************************************/
129 void MultiDisplayWindowBase::classDescInserter(TypeObject
&oType
)
131 FieldDescriptionBase
*pDesc
= NULL
;
134 pDesc
= new SFUInt32::Description(
135 SFUInt32::getClassType(),
137 "Number of horizontal servers\n",
138 HServersFieldId
, HServersFieldMask
,
140 (Field::SFDefaultFlags
| Field::FStdAccess
),
141 static_cast<FieldEditMethodSig
>(&MultiDisplayWindow::editHandleHServers
),
142 static_cast<FieldGetMethodSig
>(&MultiDisplayWindow::getHandleHServers
));
144 oType
.addInitialDesc(pDesc
);
146 pDesc
= new SFUInt32::Description(
147 SFUInt32::getClassType(),
149 "Number of vertical servers\n",
150 VServersFieldId
, VServersFieldMask
,
152 (Field::SFDefaultFlags
| Field::FStdAccess
),
153 static_cast<FieldEditMethodSig
>(&MultiDisplayWindow::editHandleVServers
),
154 static_cast<FieldGetMethodSig
>(&MultiDisplayWindow::getHandleVServers
));
156 oType
.addInitialDesc(pDesc
);
158 pDesc
= new SFBool::Description(
159 SFBool::getClassType(),
160 "manageClientViewports",
161 "If true, duplicate all viewports into the client window\n",
162 ManageClientViewportsFieldId
, ManageClientViewportsFieldMask
,
164 (Field::SFDefaultFlags
| Field::FStdAccess
),
165 static_cast<FieldEditMethodSig
>(&MultiDisplayWindow::editHandleManageClientViewports
),
166 static_cast<FieldGetMethodSig
>(&MultiDisplayWindow::getHandleManageClientViewports
));
168 oType
.addInitialDesc(pDesc
);
170 pDesc
= new SFInt32::Description(
171 SFInt32::getClassType(),
173 "Horizontal overlap\n",
174 XOverlapFieldId
, XOverlapFieldMask
,
176 (Field::SFDefaultFlags
| Field::FStdAccess
),
177 static_cast<FieldEditMethodSig
>(&MultiDisplayWindow::editHandleXOverlap
),
178 static_cast<FieldGetMethodSig
>(&MultiDisplayWindow::getHandleXOverlap
));
180 oType
.addInitialDesc(pDesc
);
182 pDesc
= new SFInt32::Description(
183 SFInt32::getClassType(),
185 "Vertical overlap\n",
186 YOverlapFieldId
, YOverlapFieldMask
,
188 (Field::SFDefaultFlags
| Field::FStdAccess
),
189 static_cast<FieldEditMethodSig
>(&MultiDisplayWindow::editHandleYOverlap
),
190 static_cast<FieldGetMethodSig
>(&MultiDisplayWindow::getHandleYOverlap
));
192 oType
.addInitialDesc(pDesc
);
194 pDesc
= new SFInt32::Description(
195 SFInt32::getClassType(),
197 "Maximum depth in scene to create load groups for load balancing. Bigger\n"
198 "values are more precise but slower. \n",
199 MaxDepthFieldId
, MaxDepthFieldMask
,
201 (Field::SFDefaultFlags
| Field::FStdAccess
),
202 static_cast<FieldEditMethodSig
>(&MultiDisplayWindow::editHandleMaxDepth
),
203 static_cast<FieldGetMethodSig
>(&MultiDisplayWindow::getHandleMaxDepth
));
205 oType
.addInitialDesc(pDesc
);
209 MultiDisplayWindowBase::TypeObject
MultiDisplayWindowBase::_type(
210 MultiDisplayWindowBase::getClassname(),
211 Inherited::getClassname(),
214 reinterpret_cast<PrototypeCreateF
>(&MultiDisplayWindowBase::createEmptyLocal
),
215 reinterpret_cast<InitContainerF
>(&MultiDisplayWindow::initMethod
),
216 reinterpret_cast<ExitContainerF
>(&MultiDisplayWindow::exitMethod
),
217 reinterpret_cast<InitalInsertDescFunc
>(
218 reinterpret_cast<void *>(&MultiDisplayWindow::classDescInserter
)),
221 "<?xml version=\"1.0\"?>\n"
224 " name=\"MultiDisplayWindow\"\n"
225 " parent=\"ClusterWindow\"\n"
226 " library=\"Cluster\"\n"
227 " pointerfieldtypes=\"none\"\n"
228 " structure=\"concrete\"\n"
229 " systemcomponent=\"true\"\n"
230 " parentsystemcomponent=\"true\"\n"
231 " decoratable=\"false\"\n"
232 " useLocalIncludes=\"false\"\n"
233 " docGroupBase=\"GrpClusterWindow\"\n"
235 " Cluster rendering configuration for multible displays\n"
237 "\t name=\"hServers\"\n"
238 "\t type=\"UInt32\"\n"
239 "\t cardinality=\"single\"\n"
240 "\t visibility=\"external\"\n"
241 "\t access=\"public\"\n"
243 "\tNumber of horizontal servers\n"
246 "\t name=\"vServers\"\n"
247 "\t type=\"UInt32\"\n"
248 "\t cardinality=\"single\"\n"
249 "\t visibility=\"external\"\n"
250 "\t access=\"public\"\n"
252 "\tNumber of vertical servers\n"
255 "\t name=\"manageClientViewports\"\n"
257 "\t cardinality=\"single\"\n"
258 "\t visibility=\"external\"\n"
259 "\t defaultValue=\"true\"\n"
260 "\t access=\"public\"\n"
262 "\tIf true, duplicate all viewports into the client window\n"
265 "\t name=\"xOverlap\"\n"
266 "\t type=\"Int32\"\n"
267 "\t cardinality=\"single\"\n"
268 "\t visibility=\"external\"\n"
269 "\t defaultValue=\"0\"\n"
270 "\t access=\"public\"\n"
272 "\tHorizontal overlap\n"
275 "\t name=\"yOverlap\"\n"
276 "\t type=\"Int32\"\n"
277 "\t cardinality=\"single\"\n"
278 "\t visibility=\"external\"\n"
279 "\t defaultValue=\"0\"\n"
280 "\t access=\"public\"\n"
282 "\tVertical overlap\n"
285 "\t name=\"maxDepth\"\n"
286 "\t type=\"Int32\"\n"
287 " cardinality=\"single\"\n"
288 "\t visibility=\"external\"\n"
289 "\t defaultValue=\"999\"\n"
290 " access=\"public\"\n"
292 " Maximum depth in scene to create load groups for load balancing. Bigger\n"
293 "\tvalues are more precise but slower. \n"
295 "</FieldContainer>\n",
296 "Cluster rendering configuration for multible displays\n"
299 /*------------------------------ get -----------------------------------*/
301 FieldContainerType
&MultiDisplayWindowBase::getType(void)
306 const FieldContainerType
&MultiDisplayWindowBase::getType(void) const
311 UInt32
MultiDisplayWindowBase::getContainerSize(void) const
313 return sizeof(MultiDisplayWindow
);
316 /*------------------------- decorator get ------------------------------*/
319 SFUInt32
*MultiDisplayWindowBase::editSFHServers(void)
321 editSField(HServersFieldMask
);
326 const SFUInt32
*MultiDisplayWindowBase::getSFHServers(void) const
332 SFUInt32
*MultiDisplayWindowBase::editSFVServers(void)
334 editSField(VServersFieldMask
);
339 const SFUInt32
*MultiDisplayWindowBase::getSFVServers(void) const
345 SFBool
*MultiDisplayWindowBase::editSFManageClientViewports(void)
347 editSField(ManageClientViewportsFieldMask
);
349 return &_sfManageClientViewports
;
352 const SFBool
*MultiDisplayWindowBase::getSFManageClientViewports(void) const
354 return &_sfManageClientViewports
;
358 SFInt32
*MultiDisplayWindowBase::editSFXOverlap(void)
360 editSField(XOverlapFieldMask
);
365 const SFInt32
*MultiDisplayWindowBase::getSFXOverlap(void) const
371 SFInt32
*MultiDisplayWindowBase::editSFYOverlap(void)
373 editSField(YOverlapFieldMask
);
378 const SFInt32
*MultiDisplayWindowBase::getSFYOverlap(void) const
384 SFInt32
*MultiDisplayWindowBase::editSFMaxDepth(void)
386 editSField(MaxDepthFieldMask
);
391 const SFInt32
*MultiDisplayWindowBase::getSFMaxDepth(void) const
401 /*------------------------------ access -----------------------------------*/
403 SizeT
MultiDisplayWindowBase::getBinSize(ConstFieldMaskArg whichField
)
405 SizeT returnValue
= Inherited::getBinSize(whichField
);
407 if(FieldBits::NoField
!= (HServersFieldMask
& whichField
))
409 returnValue
+= _sfHServers
.getBinSize();
411 if(FieldBits::NoField
!= (VServersFieldMask
& whichField
))
413 returnValue
+= _sfVServers
.getBinSize();
415 if(FieldBits::NoField
!= (ManageClientViewportsFieldMask
& whichField
))
417 returnValue
+= _sfManageClientViewports
.getBinSize();
419 if(FieldBits::NoField
!= (XOverlapFieldMask
& whichField
))
421 returnValue
+= _sfXOverlap
.getBinSize();
423 if(FieldBits::NoField
!= (YOverlapFieldMask
& whichField
))
425 returnValue
+= _sfYOverlap
.getBinSize();
427 if(FieldBits::NoField
!= (MaxDepthFieldMask
& whichField
))
429 returnValue
+= _sfMaxDepth
.getBinSize();
435 void MultiDisplayWindowBase::copyToBin(BinaryDataHandler
&pMem
,
436 ConstFieldMaskArg whichField
)
438 Inherited::copyToBin(pMem
, whichField
);
440 if(FieldBits::NoField
!= (HServersFieldMask
& whichField
))
442 _sfHServers
.copyToBin(pMem
);
444 if(FieldBits::NoField
!= (VServersFieldMask
& whichField
))
446 _sfVServers
.copyToBin(pMem
);
448 if(FieldBits::NoField
!= (ManageClientViewportsFieldMask
& whichField
))
450 _sfManageClientViewports
.copyToBin(pMem
);
452 if(FieldBits::NoField
!= (XOverlapFieldMask
& whichField
))
454 _sfXOverlap
.copyToBin(pMem
);
456 if(FieldBits::NoField
!= (YOverlapFieldMask
& whichField
))
458 _sfYOverlap
.copyToBin(pMem
);
460 if(FieldBits::NoField
!= (MaxDepthFieldMask
& whichField
))
462 _sfMaxDepth
.copyToBin(pMem
);
466 void MultiDisplayWindowBase::copyFromBin(BinaryDataHandler
&pMem
,
467 ConstFieldMaskArg whichField
)
469 Inherited::copyFromBin(pMem
, whichField
);
471 if(FieldBits::NoField
!= (HServersFieldMask
& whichField
))
473 editSField(HServersFieldMask
);
474 _sfHServers
.copyFromBin(pMem
);
476 if(FieldBits::NoField
!= (VServersFieldMask
& whichField
))
478 editSField(VServersFieldMask
);
479 _sfVServers
.copyFromBin(pMem
);
481 if(FieldBits::NoField
!= (ManageClientViewportsFieldMask
& whichField
))
483 editSField(ManageClientViewportsFieldMask
);
484 _sfManageClientViewports
.copyFromBin(pMem
);
486 if(FieldBits::NoField
!= (XOverlapFieldMask
& whichField
))
488 editSField(XOverlapFieldMask
);
489 _sfXOverlap
.copyFromBin(pMem
);
491 if(FieldBits::NoField
!= (YOverlapFieldMask
& whichField
))
493 editSField(YOverlapFieldMask
);
494 _sfYOverlap
.copyFromBin(pMem
);
496 if(FieldBits::NoField
!= (MaxDepthFieldMask
& whichField
))
498 editSField(MaxDepthFieldMask
);
499 _sfMaxDepth
.copyFromBin(pMem
);
503 //! create a new instance of the class
504 MultiDisplayWindowTransitPtr
MultiDisplayWindowBase::createLocal(BitVector bFlags
)
506 MultiDisplayWindowTransitPtr fc
;
508 if(getClassType().getPrototype() != NULL
)
510 FieldContainerTransitPtr tmpPtr
=
511 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
513 fc
= dynamic_pointer_cast
<MultiDisplayWindow
>(tmpPtr
);
519 //! create a new instance of the class, copy the container flags
520 MultiDisplayWindowTransitPtr
MultiDisplayWindowBase::createDependent(BitVector bFlags
)
522 MultiDisplayWindowTransitPtr fc
;
524 if(getClassType().getPrototype() != NULL
)
526 FieldContainerTransitPtr tmpPtr
=
527 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
529 fc
= dynamic_pointer_cast
<MultiDisplayWindow
>(tmpPtr
);
535 //! create a new instance of the class
536 MultiDisplayWindowTransitPtr
MultiDisplayWindowBase::create(void)
538 MultiDisplayWindowTransitPtr fc
;
540 if(getClassType().getPrototype() != NULL
)
542 FieldContainerTransitPtr tmpPtr
=
543 getClassType().getPrototype()-> shallowCopy();
545 fc
= dynamic_pointer_cast
<MultiDisplayWindow
>(tmpPtr
);
551 MultiDisplayWindow
*MultiDisplayWindowBase::createEmptyLocal(BitVector bFlags
)
553 MultiDisplayWindow
*returnValue
;
555 newPtr
<MultiDisplayWindow
>(returnValue
, bFlags
);
557 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
562 //! create an empty new instance of the class, do not copy the prototype
563 MultiDisplayWindow
*MultiDisplayWindowBase::createEmpty(void)
565 MultiDisplayWindow
*returnValue
;
567 newPtr
<MultiDisplayWindow
>(returnValue
, Thread::getCurrentLocalFlags());
569 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
570 ~Thread::getCurrentLocalFlags();
576 FieldContainerTransitPtr
MultiDisplayWindowBase::shallowCopyLocal(
577 BitVector bFlags
) const
579 MultiDisplayWindow
*tmpPtr
;
581 newPtr(tmpPtr
, dynamic_cast<const MultiDisplayWindow
*>(this), bFlags
);
583 FieldContainerTransitPtr
returnValue(tmpPtr
);
585 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
590 FieldContainerTransitPtr
MultiDisplayWindowBase::shallowCopyDependent(
591 BitVector bFlags
) const
593 MultiDisplayWindow
*tmpPtr
;
595 newPtr(tmpPtr
, dynamic_cast<const MultiDisplayWindow
*>(this), ~bFlags
);
597 FieldContainerTransitPtr
returnValue(tmpPtr
);
599 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
604 FieldContainerTransitPtr
MultiDisplayWindowBase::shallowCopy(void) const
606 MultiDisplayWindow
*tmpPtr
;
609 dynamic_cast<const MultiDisplayWindow
*>(this),
610 Thread::getCurrentLocalFlags());
612 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
614 FieldContainerTransitPtr
returnValue(tmpPtr
);
622 /*------------------------- constructors ----------------------------------*/
624 MultiDisplayWindowBase::MultiDisplayWindowBase(void) :
628 _sfManageClientViewports (bool(true)),
629 _sfXOverlap (Int32(0)),
630 _sfYOverlap (Int32(0)),
631 _sfMaxDepth (Int32(999))
635 MultiDisplayWindowBase::MultiDisplayWindowBase(const MultiDisplayWindowBase
&source
) :
637 _sfHServers (source
._sfHServers
),
638 _sfVServers (source
._sfVServers
),
639 _sfManageClientViewports (source
._sfManageClientViewports
),
640 _sfXOverlap (source
._sfXOverlap
),
641 _sfYOverlap (source
._sfYOverlap
),
642 _sfMaxDepth (source
._sfMaxDepth
)
647 /*-------------------------- destructors ----------------------------------*/
649 MultiDisplayWindowBase::~MultiDisplayWindowBase(void)
654 GetFieldHandlePtr
MultiDisplayWindowBase::getHandleHServers (void) const
656 SFUInt32::GetHandlePtr
returnValue(
657 new SFUInt32::GetHandle(
659 this->getType().getFieldDesc(HServersFieldId
),
660 const_cast<MultiDisplayWindowBase
*>(this)));
665 EditFieldHandlePtr
MultiDisplayWindowBase::editHandleHServers (void)
667 SFUInt32::EditHandlePtr
returnValue(
668 new SFUInt32::EditHandle(
670 this->getType().getFieldDesc(HServersFieldId
),
674 editSField(HServersFieldMask
);
679 GetFieldHandlePtr
MultiDisplayWindowBase::getHandleVServers (void) const
681 SFUInt32::GetHandlePtr
returnValue(
682 new SFUInt32::GetHandle(
684 this->getType().getFieldDesc(VServersFieldId
),
685 const_cast<MultiDisplayWindowBase
*>(this)));
690 EditFieldHandlePtr
MultiDisplayWindowBase::editHandleVServers (void)
692 SFUInt32::EditHandlePtr
returnValue(
693 new SFUInt32::EditHandle(
695 this->getType().getFieldDesc(VServersFieldId
),
699 editSField(VServersFieldMask
);
704 GetFieldHandlePtr
MultiDisplayWindowBase::getHandleManageClientViewports (void) const
706 SFBool::GetHandlePtr
returnValue(
707 new SFBool::GetHandle(
708 &_sfManageClientViewports
,
709 this->getType().getFieldDesc(ManageClientViewportsFieldId
),
710 const_cast<MultiDisplayWindowBase
*>(this)));
715 EditFieldHandlePtr
MultiDisplayWindowBase::editHandleManageClientViewports(void)
717 SFBool::EditHandlePtr
returnValue(
718 new SFBool::EditHandle(
719 &_sfManageClientViewports
,
720 this->getType().getFieldDesc(ManageClientViewportsFieldId
),
724 editSField(ManageClientViewportsFieldMask
);
729 GetFieldHandlePtr
MultiDisplayWindowBase::getHandleXOverlap (void) const
731 SFInt32::GetHandlePtr
returnValue(
732 new SFInt32::GetHandle(
734 this->getType().getFieldDesc(XOverlapFieldId
),
735 const_cast<MultiDisplayWindowBase
*>(this)));
740 EditFieldHandlePtr
MultiDisplayWindowBase::editHandleXOverlap (void)
742 SFInt32::EditHandlePtr
returnValue(
743 new SFInt32::EditHandle(
745 this->getType().getFieldDesc(XOverlapFieldId
),
749 editSField(XOverlapFieldMask
);
754 GetFieldHandlePtr
MultiDisplayWindowBase::getHandleYOverlap (void) const
756 SFInt32::GetHandlePtr
returnValue(
757 new SFInt32::GetHandle(
759 this->getType().getFieldDesc(YOverlapFieldId
),
760 const_cast<MultiDisplayWindowBase
*>(this)));
765 EditFieldHandlePtr
MultiDisplayWindowBase::editHandleYOverlap (void)
767 SFInt32::EditHandlePtr
returnValue(
768 new SFInt32::EditHandle(
770 this->getType().getFieldDesc(YOverlapFieldId
),
774 editSField(YOverlapFieldMask
);
779 GetFieldHandlePtr
MultiDisplayWindowBase::getHandleMaxDepth (void) const
781 SFInt32::GetHandlePtr
returnValue(
782 new SFInt32::GetHandle(
784 this->getType().getFieldDesc(MaxDepthFieldId
),
785 const_cast<MultiDisplayWindowBase
*>(this)));
790 EditFieldHandlePtr
MultiDisplayWindowBase::editHandleMaxDepth (void)
792 SFInt32::EditHandlePtr
returnValue(
793 new SFInt32::EditHandle(
795 this->getType().getFieldDesc(MaxDepthFieldId
),
799 editSField(MaxDepthFieldMask
);
805 #ifdef OSG_MT_CPTR_ASPECT
806 void MultiDisplayWindowBase::execSyncV( FieldContainer
&oFrom
,
807 ConstFieldMaskArg whichField
,
808 AspectOffsetStore
&oOffsets
,
809 ConstFieldMaskArg syncMode
,
810 const UInt32 uiSyncInfo
)
812 MultiDisplayWindow
*pThis
= static_cast<MultiDisplayWindow
*>(this);
814 pThis
->execSync(static_cast<MultiDisplayWindow
*>(&oFrom
),
823 #ifdef OSG_MT_CPTR_ASPECT
824 FieldContainer
*MultiDisplayWindowBase::createAspectCopy(
825 const FieldContainer
*pRefAspect
) const
827 MultiDisplayWindow
*returnValue
;
829 newAspectCopy(returnValue
,
830 dynamic_cast<const MultiDisplayWindow
*>(pRefAspect
),
831 dynamic_cast<const MultiDisplayWindow
*>(this));
837 void MultiDisplayWindowBase::resolveLinks(void)
839 Inherited::resolveLinks();