changed: gcc8 base update
[opensg.git] / Source / System / Window / Camera / OSGShearedStereoCameraDecoratorBase.cpp
blobd52132d13a33a5522811c9fec6cc263da552e299
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 ShearedStereoCameraDecorator!
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 "OSGShearedStereoCameraDecoratorBase.h"
67 #include "OSGShearedStereoCameraDecorator.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::ShearedStereoCameraDecorator
78 The OSG::CameraDecorator for standard sheared stereo projections, see \ref
79 PageSystemWindowCameraDecoratorsStereoSheared for a description.
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var Real32 ShearedStereoCameraDecoratorBase::_sfZeroParallaxDistance
87 The distance to the zero parallax plane.
90 /*! \var Real32 ShearedStereoCameraDecoratorBase::_sfOverlap
91 The overlap between left and right eye.
95 /***************************************************************************\
96 * FieldType/FieldTrait Instantiation *
97 \***************************************************************************/
99 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
100 PointerType FieldTraits<ShearedStereoCameraDecorator *, nsOSG>::_type(
101 "ShearedStereoCameraDecoratorPtr",
102 "StereoCameraDecoratorPtr",
103 ShearedStereoCameraDecorator::getClassType(),
104 nsOSG);
105 #endif
107 OSG_FIELDTRAITS_GETTYPE_NS(ShearedStereoCameraDecorator *, nsOSG)
109 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
110 ShearedStereoCameraDecorator *,
111 nsOSG)
113 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
114 ShearedStereoCameraDecorator *,
115 nsOSG)
117 /***************************************************************************\
118 * Field Description *
119 \***************************************************************************/
121 void ShearedStereoCameraDecoratorBase::classDescInserter(TypeObject &oType)
123 FieldDescriptionBase *pDesc = NULL;
126 pDesc = new SFReal32::Description(
127 SFReal32::getClassType(),
128 "zeroParallaxDistance",
129 "The distance to the zero parallax plane.\n",
130 ZeroParallaxDistanceFieldId, ZeroParallaxDistanceFieldMask,
131 false,
132 (Field::SFDefaultFlags | Field::FStdAccess),
133 static_cast<FieldEditMethodSig>(&ShearedStereoCameraDecorator::editHandleZeroParallaxDistance),
134 static_cast<FieldGetMethodSig >(&ShearedStereoCameraDecorator::getHandleZeroParallaxDistance));
136 oType.addInitialDesc(pDesc);
138 pDesc = new SFReal32::Description(
139 SFReal32::getClassType(),
140 "overlap",
141 "The overlap between left and right eye.\n",
142 OverlapFieldId, OverlapFieldMask,
143 false,
144 (Field::SFDefaultFlags | Field::FStdAccess),
145 static_cast<FieldEditMethodSig>(&ShearedStereoCameraDecorator::editHandleOverlap),
146 static_cast<FieldGetMethodSig >(&ShearedStereoCameraDecorator::getHandleOverlap));
148 oType.addInitialDesc(pDesc);
152 ShearedStereoCameraDecoratorBase::TypeObject ShearedStereoCameraDecoratorBase::_type(
153 ShearedStereoCameraDecoratorBase::getClassname(),
154 Inherited::getClassname(),
155 "NULL",
156 nsOSG, //Namespace
157 reinterpret_cast<PrototypeCreateF>(&ShearedStereoCameraDecoratorBase::createEmptyLocal),
158 reinterpret_cast<InitContainerF>(&ShearedStereoCameraDecorator::initMethod),
159 reinterpret_cast<ExitContainerF>(&ShearedStereoCameraDecorator::exitMethod),
160 reinterpret_cast<InitalInsertDescFunc>(
161 reinterpret_cast<void *>(&ShearedStereoCameraDecorator::classDescInserter)),
162 false,
164 "<?xml version=\"1.0\"?>\n"
165 "\n"
166 "<FieldContainer\n"
167 " name=\"ShearedStereoCameraDecorator\"\n"
168 " parent=\"StereoCameraDecorator\"\n"
169 " library=\"Window\"\n"
170 " pointerfieldtypes=\"both\"\n"
171 " structure=\"concrete\"\n"
172 " systemcomponent=\"true\"\n"
173 " parentsystemcomponent=\"true\"\n"
174 " decoratable=\"false\"\n"
175 " docGroupBase=\"GrpWindowCamera\"\n"
176 " >\n"
177 " The OSG::CameraDecorator for standard sheared stereo projections, see \\ref\n"
178 " PageSystemWindowCameraDecoratorsStereoSheared for a description.\n"
179 " <Field\n"
180 "\t name=\"zeroParallaxDistance\"\n"
181 "\t type=\"Real32\"\n"
182 "\t cardinality=\"single\"\n"
183 "\t visibility=\"external\"\n"
184 "\t defaultValue=\"1\"\n"
185 "\t access=\"public\"\n"
186 "\t >\n"
187 "\tThe distance to the zero parallax plane.\n"
188 " </Field>\n"
189 " <Field\n"
190 "\t name=\"overlap\"\n"
191 "\t type=\"Real32\"\n"
192 "\t cardinality=\"single\"\n"
193 "\t visibility=\"external\"\n"
194 "\t defaultValue=\"1\"\n"
195 "\t access=\"public\"\n"
196 "\t >\n"
197 "\tThe overlap between left and right eye.\n"
198 " </Field>\n"
199 "</FieldContainer>\n",
200 "The OSG::CameraDecorator for standard sheared stereo projections, see \\ref\n"
201 "PageSystemWindowCameraDecoratorsStereoSheared for a description.\n"
204 /*------------------------------ get -----------------------------------*/
206 FieldContainerType &ShearedStereoCameraDecoratorBase::getType(void)
208 return _type;
211 const FieldContainerType &ShearedStereoCameraDecoratorBase::getType(void) const
213 return _type;
216 UInt32 ShearedStereoCameraDecoratorBase::getContainerSize(void) const
218 return sizeof(ShearedStereoCameraDecorator);
221 /*------------------------- decorator get ------------------------------*/
224 SFReal32 *ShearedStereoCameraDecoratorBase::editSFZeroParallaxDistance(void)
226 editSField(ZeroParallaxDistanceFieldMask);
228 return &_sfZeroParallaxDistance;
231 const SFReal32 *ShearedStereoCameraDecoratorBase::getSFZeroParallaxDistance(void) const
233 return &_sfZeroParallaxDistance;
237 SFReal32 *ShearedStereoCameraDecoratorBase::editSFOverlap(void)
239 editSField(OverlapFieldMask);
241 return &_sfOverlap;
244 const SFReal32 *ShearedStereoCameraDecoratorBase::getSFOverlap(void) const
246 return &_sfOverlap;
254 /*------------------------------ access -----------------------------------*/
256 SizeT ShearedStereoCameraDecoratorBase::getBinSize(ConstFieldMaskArg whichField)
258 SizeT returnValue = Inherited::getBinSize(whichField);
260 if(FieldBits::NoField != (ZeroParallaxDistanceFieldMask & whichField))
262 returnValue += _sfZeroParallaxDistance.getBinSize();
264 if(FieldBits::NoField != (OverlapFieldMask & whichField))
266 returnValue += _sfOverlap.getBinSize();
269 return returnValue;
272 void ShearedStereoCameraDecoratorBase::copyToBin(BinaryDataHandler &pMem,
273 ConstFieldMaskArg whichField)
275 Inherited::copyToBin(pMem, whichField);
277 if(FieldBits::NoField != (ZeroParallaxDistanceFieldMask & whichField))
279 _sfZeroParallaxDistance.copyToBin(pMem);
281 if(FieldBits::NoField != (OverlapFieldMask & whichField))
283 _sfOverlap.copyToBin(pMem);
287 void ShearedStereoCameraDecoratorBase::copyFromBin(BinaryDataHandler &pMem,
288 ConstFieldMaskArg whichField)
290 Inherited::copyFromBin(pMem, whichField);
292 if(FieldBits::NoField != (ZeroParallaxDistanceFieldMask & whichField))
294 editSField(ZeroParallaxDistanceFieldMask);
295 _sfZeroParallaxDistance.copyFromBin(pMem);
297 if(FieldBits::NoField != (OverlapFieldMask & whichField))
299 editSField(OverlapFieldMask);
300 _sfOverlap.copyFromBin(pMem);
304 //! create a new instance of the class
305 ShearedStereoCameraDecoratorTransitPtr ShearedStereoCameraDecoratorBase::createLocal(BitVector bFlags)
307 ShearedStereoCameraDecoratorTransitPtr fc;
309 if(getClassType().getPrototype() != NULL)
311 FieldContainerTransitPtr tmpPtr =
312 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
314 fc = dynamic_pointer_cast<ShearedStereoCameraDecorator>(tmpPtr);
317 return fc;
320 //! create a new instance of the class, copy the container flags
321 ShearedStereoCameraDecoratorTransitPtr ShearedStereoCameraDecoratorBase::createDependent(BitVector bFlags)
323 ShearedStereoCameraDecoratorTransitPtr fc;
325 if(getClassType().getPrototype() != NULL)
327 FieldContainerTransitPtr tmpPtr =
328 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
330 fc = dynamic_pointer_cast<ShearedStereoCameraDecorator>(tmpPtr);
333 return fc;
336 //! create a new instance of the class
337 ShearedStereoCameraDecoratorTransitPtr ShearedStereoCameraDecoratorBase::create(void)
339 ShearedStereoCameraDecoratorTransitPtr fc;
341 if(getClassType().getPrototype() != NULL)
343 FieldContainerTransitPtr tmpPtr =
344 getClassType().getPrototype()-> shallowCopy();
346 fc = dynamic_pointer_cast<ShearedStereoCameraDecorator>(tmpPtr);
349 return fc;
352 ShearedStereoCameraDecorator *ShearedStereoCameraDecoratorBase::createEmptyLocal(BitVector bFlags)
354 ShearedStereoCameraDecorator *returnValue;
356 newPtr<ShearedStereoCameraDecorator>(returnValue, bFlags);
358 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
360 return returnValue;
363 //! create an empty new instance of the class, do not copy the prototype
364 ShearedStereoCameraDecorator *ShearedStereoCameraDecoratorBase::createEmpty(void)
366 ShearedStereoCameraDecorator *returnValue;
368 newPtr<ShearedStereoCameraDecorator>(returnValue, Thread::getCurrentLocalFlags());
370 returnValue->_pFieldFlags->_bNamespaceMask &=
371 ~Thread::getCurrentLocalFlags();
373 return returnValue;
377 FieldContainerTransitPtr ShearedStereoCameraDecoratorBase::shallowCopyLocal(
378 BitVector bFlags) const
380 ShearedStereoCameraDecorator *tmpPtr;
382 newPtr(tmpPtr, dynamic_cast<const ShearedStereoCameraDecorator *>(this), bFlags);
384 FieldContainerTransitPtr returnValue(tmpPtr);
386 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
388 return returnValue;
391 FieldContainerTransitPtr ShearedStereoCameraDecoratorBase::shallowCopyDependent(
392 BitVector bFlags) const
394 ShearedStereoCameraDecorator *tmpPtr;
396 newPtr(tmpPtr, dynamic_cast<const ShearedStereoCameraDecorator *>(this), ~bFlags);
398 FieldContainerTransitPtr returnValue(tmpPtr);
400 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
402 return returnValue;
405 FieldContainerTransitPtr ShearedStereoCameraDecoratorBase::shallowCopy(void) const
407 ShearedStereoCameraDecorator *tmpPtr;
409 newPtr(tmpPtr,
410 dynamic_cast<const ShearedStereoCameraDecorator *>(this),
411 Thread::getCurrentLocalFlags());
413 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
415 FieldContainerTransitPtr returnValue(tmpPtr);
417 return returnValue;
423 /*------------------------- constructors ----------------------------------*/
425 ShearedStereoCameraDecoratorBase::ShearedStereoCameraDecoratorBase(void) :
426 Inherited(),
427 _sfZeroParallaxDistance (Real32(1)),
428 _sfOverlap (Real32(1))
432 ShearedStereoCameraDecoratorBase::ShearedStereoCameraDecoratorBase(const ShearedStereoCameraDecoratorBase &source) :
433 Inherited(source),
434 _sfZeroParallaxDistance (source._sfZeroParallaxDistance ),
435 _sfOverlap (source._sfOverlap )
440 /*-------------------------- destructors ----------------------------------*/
442 ShearedStereoCameraDecoratorBase::~ShearedStereoCameraDecoratorBase(void)
447 GetFieldHandlePtr ShearedStereoCameraDecoratorBase::getHandleZeroParallaxDistance (void) const
449 SFReal32::GetHandlePtr returnValue(
450 new SFReal32::GetHandle(
451 &_sfZeroParallaxDistance,
452 this->getType().getFieldDesc(ZeroParallaxDistanceFieldId),
453 const_cast<ShearedStereoCameraDecoratorBase *>(this)));
455 return returnValue;
458 EditFieldHandlePtr ShearedStereoCameraDecoratorBase::editHandleZeroParallaxDistance(void)
460 SFReal32::EditHandlePtr returnValue(
461 new SFReal32::EditHandle(
462 &_sfZeroParallaxDistance,
463 this->getType().getFieldDesc(ZeroParallaxDistanceFieldId),
464 this));
467 editSField(ZeroParallaxDistanceFieldMask);
469 return returnValue;
472 GetFieldHandlePtr ShearedStereoCameraDecoratorBase::getHandleOverlap (void) const
474 SFReal32::GetHandlePtr returnValue(
475 new SFReal32::GetHandle(
476 &_sfOverlap,
477 this->getType().getFieldDesc(OverlapFieldId),
478 const_cast<ShearedStereoCameraDecoratorBase *>(this)));
480 return returnValue;
483 EditFieldHandlePtr ShearedStereoCameraDecoratorBase::editHandleOverlap (void)
485 SFReal32::EditHandlePtr returnValue(
486 new SFReal32::EditHandle(
487 &_sfOverlap,
488 this->getType().getFieldDesc(OverlapFieldId),
489 this));
492 editSField(OverlapFieldMask);
494 return returnValue;
498 #ifdef OSG_MT_CPTR_ASPECT
499 void ShearedStereoCameraDecoratorBase::execSyncV( FieldContainer &oFrom,
500 ConstFieldMaskArg whichField,
501 AspectOffsetStore &oOffsets,
502 ConstFieldMaskArg syncMode,
503 const UInt32 uiSyncInfo)
505 ShearedStereoCameraDecorator *pThis = static_cast<ShearedStereoCameraDecorator *>(this);
507 pThis->execSync(static_cast<ShearedStereoCameraDecorator *>(&oFrom),
508 whichField,
509 oOffsets,
510 syncMode,
511 uiSyncInfo);
513 #endif
516 #ifdef OSG_MT_CPTR_ASPECT
517 FieldContainer *ShearedStereoCameraDecoratorBase::createAspectCopy(
518 const FieldContainer *pRefAspect) const
520 ShearedStereoCameraDecorator *returnValue;
522 newAspectCopy(returnValue,
523 dynamic_cast<const ShearedStereoCameraDecorator *>(pRefAspect),
524 dynamic_cast<const ShearedStereoCameraDecorator *>(this));
526 return returnValue;
528 #endif
530 void ShearedStereoCameraDecoratorBase::resolveLinks(void)
532 Inherited::resolveLinks();
538 OSG_END_NAMESPACE