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 ShearedStereoCameraDecorator!
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 "OSGShearedStereoCameraDecoratorBase.h"
67 #include "OSGShearedStereoCameraDecorator.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
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(),
107 OSG_FIELDTRAITS_GETTYPE_NS(ShearedStereoCameraDecorator
*, nsOSG
)
109 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
110 ShearedStereoCameraDecorator
*,
113 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
114 ShearedStereoCameraDecorator
*,
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
,
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(),
141 "The overlap between left and right eye.\n",
142 OverlapFieldId
, OverlapFieldMask
,
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(),
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
)),
164 "<?xml version=\"1.0\"?>\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"
177 " The OSG::CameraDecorator for standard sheared stereo projections, see \\ref\n"
178 " PageSystemWindowCameraDecoratorsStereoSheared for a description.\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"
187 "\tThe distance to the zero parallax plane.\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"
197 "\tThe overlap between left and right eye.\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)
211 const FieldContainerType
&ShearedStereoCameraDecoratorBase::getType(void) const
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
);
244 const SFReal32
*ShearedStereoCameraDecoratorBase::getSFOverlap(void) const
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();
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
);
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
);
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
);
352 ShearedStereoCameraDecorator
*ShearedStereoCameraDecoratorBase::createEmptyLocal(BitVector bFlags
)
354 ShearedStereoCameraDecorator
*returnValue
;
356 newPtr
<ShearedStereoCameraDecorator
>(returnValue
, bFlags
);
358 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
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();
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
;
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
;
405 FieldContainerTransitPtr
ShearedStereoCameraDecoratorBase::shallowCopy(void) const
407 ShearedStereoCameraDecorator
*tmpPtr
;
410 dynamic_cast<const ShearedStereoCameraDecorator
*>(this),
411 Thread::getCurrentLocalFlags());
413 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
415 FieldContainerTransitPtr
returnValue(tmpPtr
);
423 /*------------------------- constructors ----------------------------------*/
425 ShearedStereoCameraDecoratorBase::ShearedStereoCameraDecoratorBase(void) :
427 _sfZeroParallaxDistance (Real32(1)),
428 _sfOverlap (Real32(1))
432 ShearedStereoCameraDecoratorBase::ShearedStereoCameraDecoratorBase(const ShearedStereoCameraDecoratorBase
&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)));
458 EditFieldHandlePtr
ShearedStereoCameraDecoratorBase::editHandleZeroParallaxDistance(void)
460 SFReal32::EditHandlePtr
returnValue(
461 new SFReal32::EditHandle(
462 &_sfZeroParallaxDistance
,
463 this->getType().getFieldDesc(ZeroParallaxDistanceFieldId
),
467 editSField(ZeroParallaxDistanceFieldMask
);
472 GetFieldHandlePtr
ShearedStereoCameraDecoratorBase::getHandleOverlap (void) const
474 SFReal32::GetHandlePtr
returnValue(
475 new SFReal32::GetHandle(
477 this->getType().getFieldDesc(OverlapFieldId
),
478 const_cast<ShearedStereoCameraDecoratorBase
*>(this)));
483 EditFieldHandlePtr
ShearedStereoCameraDecoratorBase::editHandleOverlap (void)
485 SFReal32::EditHandlePtr
returnValue(
486 new SFReal32::EditHandle(
488 this->getType().getFieldDesc(OverlapFieldId
),
492 editSField(OverlapFieldMask
);
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
),
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));
530 void ShearedStereoCameraDecoratorBase::resolveLinks(void)
532 Inherited::resolveLinks();