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 StereoBufferViewport!
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 "OSGStereoBufferViewportBase.h"
67 #include "OSGStereoBufferViewport.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::StereoBufferViewport
78 Viewport for quad-buffered stereo rendering, see \ref
79 PageSystemWindowViewports for a description.
81 The active buffers are selected using the _sfLeftBuffer and _sfRightBuffer
85 /***************************************************************************\
86 * Field Documentation *
87 \***************************************************************************/
89 /*! \var bool StereoBufferViewportBase::_sfLeftBuffer
90 Defines whether the left buffer is written to.
93 /*! \var bool StereoBufferViewportBase::_sfRightBuffer
94 Defines whether the right buffer is written to.
98 /***************************************************************************\
99 * FieldType/FieldTrait Instantiation *
100 \***************************************************************************/
102 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
103 PointerType FieldTraits
<StereoBufferViewport
*, nsOSG
>::_type(
104 "StereoBufferViewportPtr",
106 StereoBufferViewport::getClassType(),
110 OSG_FIELDTRAITS_GETTYPE_NS(StereoBufferViewport
*, nsOSG
)
112 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
113 StereoBufferViewport
*,
116 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
117 StereoBufferViewport
*,
120 /***************************************************************************\
121 * Field Description *
122 \***************************************************************************/
124 void StereoBufferViewportBase::classDescInserter(TypeObject
&oType
)
126 FieldDescriptionBase
*pDesc
= NULL
;
129 pDesc
= new SFBool::Description(
130 SFBool::getClassType(),
132 "Defines whether the left buffer is written to.\n",
133 LeftBufferFieldId
, LeftBufferFieldMask
,
135 (Field::SFDefaultFlags
| Field::FStdAccess
),
136 static_cast<FieldEditMethodSig
>(&StereoBufferViewport::editHandleLeftBuffer
),
137 static_cast<FieldGetMethodSig
>(&StereoBufferViewport::getHandleLeftBuffer
));
139 oType
.addInitialDesc(pDesc
);
141 pDesc
= new SFBool::Description(
142 SFBool::getClassType(),
144 "Defines whether the right buffer is written to.\n",
145 RightBufferFieldId
, RightBufferFieldMask
,
147 (Field::SFDefaultFlags
| Field::FStdAccess
),
148 static_cast<FieldEditMethodSig
>(&StereoBufferViewport::editHandleRightBuffer
),
149 static_cast<FieldGetMethodSig
>(&StereoBufferViewport::getHandleRightBuffer
));
151 oType
.addInitialDesc(pDesc
);
155 StereoBufferViewportBase::TypeObject
StereoBufferViewportBase::_type(
156 StereoBufferViewportBase::getClassname(),
157 Inherited::getClassname(),
160 reinterpret_cast<PrototypeCreateF
>(&StereoBufferViewportBase::createEmptyLocal
),
161 reinterpret_cast<InitContainerF
>(&StereoBufferViewport::initMethod
),
162 reinterpret_cast<ExitContainerF
>(&StereoBufferViewport::exitMethod
),
163 reinterpret_cast<InitalInsertDescFunc
>(
164 reinterpret_cast<void *>(&StereoBufferViewport::classDescInserter
)),
167 "<?xml version=\"1.0\"?>\n"
170 " name=\"StereoBufferViewport\"\n"
171 " parent=\"Viewport\"\n"
172 " library=\"Window\"\n"
173 " pointerfieldtypes=\"both\"\n"
174 " structure=\"concrete\"\n"
175 " systemcomponent=\"true\"\n"
176 " parentsystemcomponent=\"true\"\n"
177 " decoratable=\"false\"\n"
178 " docGroupBase=\"GrpWindowViewport\"\n"
180 " Viewport for quad-buffered stereo rendering, see \\ref\n"
181 " PageSystemWindowViewports for a description.\n"
183 " The active buffers are selected using the _sfLeftBuffer and _sfRightBuffer\n"
186 "\t name=\"leftBuffer\"\n"
188 "\t cardinality=\"single\"\n"
189 "\t visibility=\"external\"\n"
190 "\t defaultValue=\"true\"\n"
191 "\t access=\"public\"\n"
193 " Defines whether the left buffer is written to.\n"
196 "\t name=\"rightBuffer\"\n"
198 "\t cardinality=\"single\"\n"
199 "\t visibility=\"external\"\n"
200 "\t defaultValue=\"true\"\n"
201 "\t access=\"public\"\n"
203 " Defines whether the right buffer is written to.\n"
205 "</FieldContainer>\n",
206 "Viewport for quad-buffered stereo rendering, see \\ref\n"
207 "PageSystemWindowViewports for a description.\n"
209 "The active buffers are selected using the _sfLeftBuffer and _sfRightBuffer\n"
213 /*------------------------------ get -----------------------------------*/
215 FieldContainerType
&StereoBufferViewportBase::getType(void)
220 const FieldContainerType
&StereoBufferViewportBase::getType(void) const
225 UInt32
StereoBufferViewportBase::getContainerSize(void) const
227 return sizeof(StereoBufferViewport
);
230 /*------------------------- decorator get ------------------------------*/
233 SFBool
*StereoBufferViewportBase::editSFLeftBuffer(void)
235 editSField(LeftBufferFieldMask
);
237 return &_sfLeftBuffer
;
240 const SFBool
*StereoBufferViewportBase::getSFLeftBuffer(void) const
242 return &_sfLeftBuffer
;
246 SFBool
*StereoBufferViewportBase::editSFRightBuffer(void)
248 editSField(RightBufferFieldMask
);
250 return &_sfRightBuffer
;
253 const SFBool
*StereoBufferViewportBase::getSFRightBuffer(void) const
255 return &_sfRightBuffer
;
263 /*------------------------------ access -----------------------------------*/
265 SizeT
StereoBufferViewportBase::getBinSize(ConstFieldMaskArg whichField
)
267 SizeT returnValue
= Inherited::getBinSize(whichField
);
269 if(FieldBits::NoField
!= (LeftBufferFieldMask
& whichField
))
271 returnValue
+= _sfLeftBuffer
.getBinSize();
273 if(FieldBits::NoField
!= (RightBufferFieldMask
& whichField
))
275 returnValue
+= _sfRightBuffer
.getBinSize();
281 void StereoBufferViewportBase::copyToBin(BinaryDataHandler
&pMem
,
282 ConstFieldMaskArg whichField
)
284 Inherited::copyToBin(pMem
, whichField
);
286 if(FieldBits::NoField
!= (LeftBufferFieldMask
& whichField
))
288 _sfLeftBuffer
.copyToBin(pMem
);
290 if(FieldBits::NoField
!= (RightBufferFieldMask
& whichField
))
292 _sfRightBuffer
.copyToBin(pMem
);
296 void StereoBufferViewportBase::copyFromBin(BinaryDataHandler
&pMem
,
297 ConstFieldMaskArg whichField
)
299 Inherited::copyFromBin(pMem
, whichField
);
301 if(FieldBits::NoField
!= (LeftBufferFieldMask
& whichField
))
303 editSField(LeftBufferFieldMask
);
304 _sfLeftBuffer
.copyFromBin(pMem
);
306 if(FieldBits::NoField
!= (RightBufferFieldMask
& whichField
))
308 editSField(RightBufferFieldMask
);
309 _sfRightBuffer
.copyFromBin(pMem
);
313 //! create a new instance of the class
314 StereoBufferViewportTransitPtr
StereoBufferViewportBase::createLocal(BitVector bFlags
)
316 StereoBufferViewportTransitPtr fc
;
318 if(getClassType().getPrototype() != NULL
)
320 FieldContainerTransitPtr tmpPtr
=
321 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
323 fc
= dynamic_pointer_cast
<StereoBufferViewport
>(tmpPtr
);
329 //! create a new instance of the class, copy the container flags
330 StereoBufferViewportTransitPtr
StereoBufferViewportBase::createDependent(BitVector bFlags
)
332 StereoBufferViewportTransitPtr fc
;
334 if(getClassType().getPrototype() != NULL
)
336 FieldContainerTransitPtr tmpPtr
=
337 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
339 fc
= dynamic_pointer_cast
<StereoBufferViewport
>(tmpPtr
);
345 //! create a new instance of the class
346 StereoBufferViewportTransitPtr
StereoBufferViewportBase::create(void)
348 StereoBufferViewportTransitPtr fc
;
350 if(getClassType().getPrototype() != NULL
)
352 FieldContainerTransitPtr tmpPtr
=
353 getClassType().getPrototype()-> shallowCopy();
355 fc
= dynamic_pointer_cast
<StereoBufferViewport
>(tmpPtr
);
361 StereoBufferViewport
*StereoBufferViewportBase::createEmptyLocal(BitVector bFlags
)
363 StereoBufferViewport
*returnValue
;
365 newPtr
<StereoBufferViewport
>(returnValue
, bFlags
);
367 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
372 //! create an empty new instance of the class, do not copy the prototype
373 StereoBufferViewport
*StereoBufferViewportBase::createEmpty(void)
375 StereoBufferViewport
*returnValue
;
377 newPtr
<StereoBufferViewport
>(returnValue
, Thread::getCurrentLocalFlags());
379 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
380 ~Thread::getCurrentLocalFlags();
386 FieldContainerTransitPtr
StereoBufferViewportBase::shallowCopyLocal(
387 BitVector bFlags
) const
389 StereoBufferViewport
*tmpPtr
;
391 newPtr(tmpPtr
, dynamic_cast<const StereoBufferViewport
*>(this), bFlags
);
393 FieldContainerTransitPtr
returnValue(tmpPtr
);
395 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
400 FieldContainerTransitPtr
StereoBufferViewportBase::shallowCopyDependent(
401 BitVector bFlags
) const
403 StereoBufferViewport
*tmpPtr
;
405 newPtr(tmpPtr
, dynamic_cast<const StereoBufferViewport
*>(this), ~bFlags
);
407 FieldContainerTransitPtr
returnValue(tmpPtr
);
409 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
414 FieldContainerTransitPtr
StereoBufferViewportBase::shallowCopy(void) const
416 StereoBufferViewport
*tmpPtr
;
419 dynamic_cast<const StereoBufferViewport
*>(this),
420 Thread::getCurrentLocalFlags());
422 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
424 FieldContainerTransitPtr
returnValue(tmpPtr
);
432 /*------------------------- constructors ----------------------------------*/
434 StereoBufferViewportBase::StereoBufferViewportBase(void) :
436 _sfLeftBuffer (bool(true)),
437 _sfRightBuffer (bool(true))
441 StereoBufferViewportBase::StereoBufferViewportBase(const StereoBufferViewportBase
&source
) :
443 _sfLeftBuffer (source
._sfLeftBuffer
),
444 _sfRightBuffer (source
._sfRightBuffer
)
449 /*-------------------------- destructors ----------------------------------*/
451 StereoBufferViewportBase::~StereoBufferViewportBase(void)
456 GetFieldHandlePtr
StereoBufferViewportBase::getHandleLeftBuffer (void) const
458 SFBool::GetHandlePtr
returnValue(
459 new SFBool::GetHandle(
461 this->getType().getFieldDesc(LeftBufferFieldId
),
462 const_cast<StereoBufferViewportBase
*>(this)));
467 EditFieldHandlePtr
StereoBufferViewportBase::editHandleLeftBuffer (void)
469 SFBool::EditHandlePtr
returnValue(
470 new SFBool::EditHandle(
472 this->getType().getFieldDesc(LeftBufferFieldId
),
476 editSField(LeftBufferFieldMask
);
481 GetFieldHandlePtr
StereoBufferViewportBase::getHandleRightBuffer (void) const
483 SFBool::GetHandlePtr
returnValue(
484 new SFBool::GetHandle(
486 this->getType().getFieldDesc(RightBufferFieldId
),
487 const_cast<StereoBufferViewportBase
*>(this)));
492 EditFieldHandlePtr
StereoBufferViewportBase::editHandleRightBuffer (void)
494 SFBool::EditHandlePtr
returnValue(
495 new SFBool::EditHandle(
497 this->getType().getFieldDesc(RightBufferFieldId
),
501 editSField(RightBufferFieldMask
);
507 #ifdef OSG_MT_CPTR_ASPECT
508 void StereoBufferViewportBase::execSyncV( FieldContainer
&oFrom
,
509 ConstFieldMaskArg whichField
,
510 AspectOffsetStore
&oOffsets
,
511 ConstFieldMaskArg syncMode
,
512 const UInt32 uiSyncInfo
)
514 StereoBufferViewport
*pThis
= static_cast<StereoBufferViewport
*>(this);
516 pThis
->execSync(static_cast<StereoBufferViewport
*>(&oFrom
),
525 #ifdef OSG_MT_CPTR_ASPECT
526 FieldContainer
*StereoBufferViewportBase::createAspectCopy(
527 const FieldContainer
*pRefAspect
) const
529 StereoBufferViewport
*returnValue
;
531 newAspectCopy(returnValue
,
532 dynamic_cast<const StereoBufferViewport
*>(pRefAspect
),
533 dynamic_cast<const StereoBufferViewport
*>(this));
539 void StereoBufferViewportBase::resolveLinks(void)
541 Inherited::resolveLinks();