changed: gcc8 base update
[opensg.git] / Source / System / Window / Viewport / OSGStereoBufferViewportBase.cpp
blobcf1b87bebc17cd08cd33734681028a23f6a0f5d0
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
41 ** **
42 ** This file is automatically generated. **
43 ** **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
46 ** **
47 ** Do not change this file, changes should be done in the derived **
48 ** class StereoBufferViewport!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #ifdef WIN32
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
59 #endif
61 #include "OSGConfig.h"
66 #include "OSGStereoBufferViewportBase.h"
67 #include "OSGStereoBufferViewport.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
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
82 Fields.
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",
105 "ViewportPtr",
106 StereoBufferViewport::getClassType(),
107 nsOSG);
108 #endif
110 OSG_FIELDTRAITS_GETTYPE_NS(StereoBufferViewport *, nsOSG)
112 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
113 StereoBufferViewport *,
114 nsOSG)
116 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
117 StereoBufferViewport *,
118 nsOSG)
120 /***************************************************************************\
121 * Field Description *
122 \***************************************************************************/
124 void StereoBufferViewportBase::classDescInserter(TypeObject &oType)
126 FieldDescriptionBase *pDesc = NULL;
129 pDesc = new SFBool::Description(
130 SFBool::getClassType(),
131 "leftBuffer",
132 "Defines whether the left buffer is written to.\n",
133 LeftBufferFieldId, LeftBufferFieldMask,
134 false,
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(),
143 "rightBuffer",
144 "Defines whether the right buffer is written to.\n",
145 RightBufferFieldId, RightBufferFieldMask,
146 false,
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(),
158 "NULL",
159 nsOSG, //Namespace
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)),
165 false,
167 "<?xml version=\"1.0\"?>\n"
168 "\n"
169 "<FieldContainer\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"
179 " >\n"
180 " Viewport for quad-buffered stereo rendering, see \\ref\n"
181 " PageSystemWindowViewports for a description.\n"
182 "\n"
183 " The active buffers are selected using the _sfLeftBuffer and _sfRightBuffer\n"
184 " Fields.\n"
185 " <Field\n"
186 "\t name=\"leftBuffer\"\n"
187 "\t type=\"bool\"\n"
188 "\t cardinality=\"single\"\n"
189 "\t visibility=\"external\"\n"
190 "\t defaultValue=\"true\"\n"
191 "\t access=\"public\"\n"
192 "\t >\n"
193 " Defines whether the left buffer is written to.\n"
194 " </Field>\n"
195 " <Field\n"
196 "\t name=\"rightBuffer\"\n"
197 "\t type=\"bool\"\n"
198 "\t cardinality=\"single\"\n"
199 "\t visibility=\"external\"\n"
200 "\t defaultValue=\"true\"\n"
201 "\t access=\"public\"\n"
202 "\t >\n"
203 " Defines whether the right buffer is written to.\n"
204 " </Field>\n"
205 "</FieldContainer>\n",
206 "Viewport for quad-buffered stereo rendering, see \\ref\n"
207 "PageSystemWindowViewports for a description.\n"
208 "\n"
209 "The active buffers are selected using the _sfLeftBuffer and _sfRightBuffer\n"
210 "Fields.\n"
213 /*------------------------------ get -----------------------------------*/
215 FieldContainerType &StereoBufferViewportBase::getType(void)
217 return _type;
220 const FieldContainerType &StereoBufferViewportBase::getType(void) const
222 return _type;
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();
278 return returnValue;
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);
326 return fc;
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);
342 return fc;
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);
358 return fc;
361 StereoBufferViewport *StereoBufferViewportBase::createEmptyLocal(BitVector bFlags)
363 StereoBufferViewport *returnValue;
365 newPtr<StereoBufferViewport>(returnValue, bFlags);
367 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
369 return returnValue;
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();
382 return returnValue;
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;
397 return returnValue;
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;
411 return returnValue;
414 FieldContainerTransitPtr StereoBufferViewportBase::shallowCopy(void) const
416 StereoBufferViewport *tmpPtr;
418 newPtr(tmpPtr,
419 dynamic_cast<const StereoBufferViewport *>(this),
420 Thread::getCurrentLocalFlags());
422 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
424 FieldContainerTransitPtr returnValue(tmpPtr);
426 return returnValue;
432 /*------------------------- constructors ----------------------------------*/
434 StereoBufferViewportBase::StereoBufferViewportBase(void) :
435 Inherited(),
436 _sfLeftBuffer (bool(true)),
437 _sfRightBuffer (bool(true))
441 StereoBufferViewportBase::StereoBufferViewportBase(const StereoBufferViewportBase &source) :
442 Inherited(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(
460 &_sfLeftBuffer,
461 this->getType().getFieldDesc(LeftBufferFieldId),
462 const_cast<StereoBufferViewportBase *>(this)));
464 return returnValue;
467 EditFieldHandlePtr StereoBufferViewportBase::editHandleLeftBuffer (void)
469 SFBool::EditHandlePtr returnValue(
470 new SFBool::EditHandle(
471 &_sfLeftBuffer,
472 this->getType().getFieldDesc(LeftBufferFieldId),
473 this));
476 editSField(LeftBufferFieldMask);
478 return returnValue;
481 GetFieldHandlePtr StereoBufferViewportBase::getHandleRightBuffer (void) const
483 SFBool::GetHandlePtr returnValue(
484 new SFBool::GetHandle(
485 &_sfRightBuffer,
486 this->getType().getFieldDesc(RightBufferFieldId),
487 const_cast<StereoBufferViewportBase *>(this)));
489 return returnValue;
492 EditFieldHandlePtr StereoBufferViewportBase::editHandleRightBuffer (void)
494 SFBool::EditHandlePtr returnValue(
495 new SFBool::EditHandle(
496 &_sfRightBuffer,
497 this->getType().getFieldDesc(RightBufferFieldId),
498 this));
501 editSField(RightBufferFieldMask);
503 return returnValue;
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),
517 whichField,
518 oOffsets,
519 syncMode,
520 uiSyncInfo);
522 #endif
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));
535 return returnValue;
537 #endif
539 void StereoBufferViewportBase::resolveLinks(void)
541 Inherited::resolveLinks();
547 OSG_END_NAMESPACE