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 StereoCameraDecorator!
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 "OSGStereoCameraDecoratorBase.h"
67 #include "OSGStereoCameraDecorator.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::StereoCameraDecorator
78 The abstract base class for stereo camera decorators, see \ref
79 PageSystemWindowCameraDecoratorsStereo for a description.
81 The basic parameters are given by the _sfEyeSeparation and _sfLeftEye fields.
84 /***************************************************************************\
85 * Field Documentation *
86 \***************************************************************************/
88 /*! \var bool StereoCameraDecoratorBase::_sfLeftEye
89 Flag to distinguish between left and right eye views.
92 /*! \var Real32 StereoCameraDecoratorBase::_sfEyeSeparation
93 The distance between the two eyes.
97 /***************************************************************************\
98 * FieldType/FieldTrait Instantiation *
99 \***************************************************************************/
101 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
102 PointerType FieldTraits
<StereoCameraDecorator
*, nsOSG
>::_type(
103 "StereoCameraDecoratorPtr",
104 "CameraDecoratorPtr",
105 StereoCameraDecorator::getClassType(),
109 OSG_FIELDTRAITS_GETTYPE_NS(StereoCameraDecorator
*, nsOSG
)
111 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
112 StereoCameraDecorator
*,
115 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
116 StereoCameraDecorator
*,
119 /***************************************************************************\
120 * Field Description *
121 \***************************************************************************/
123 void StereoCameraDecoratorBase::classDescInserter(TypeObject
&oType
)
125 FieldDescriptionBase
*pDesc
= NULL
;
128 pDesc
= new SFBool::Description(
129 SFBool::getClassType(),
131 "Flag to distinguish between left and right eye views.\n",
132 LeftEyeFieldId
, LeftEyeFieldMask
,
134 (Field::SFDefaultFlags
| Field::FStdAccess
),
135 static_cast<FieldEditMethodSig
>(&StereoCameraDecorator::editHandleLeftEye
),
136 static_cast<FieldGetMethodSig
>(&StereoCameraDecorator::getHandleLeftEye
));
138 oType
.addInitialDesc(pDesc
);
140 pDesc
= new SFReal32::Description(
141 SFReal32::getClassType(),
143 "The distance between the two eyes.\n",
144 EyeSeparationFieldId
, EyeSeparationFieldMask
,
146 (Field::SFDefaultFlags
| Field::FStdAccess
),
147 static_cast<FieldEditMethodSig
>(&StereoCameraDecorator::editHandleEyeSeparation
),
148 static_cast<FieldGetMethodSig
>(&StereoCameraDecorator::getHandleEyeSeparation
));
150 oType
.addInitialDesc(pDesc
);
154 StereoCameraDecoratorBase::TypeObject
StereoCameraDecoratorBase::_type(
155 StereoCameraDecoratorBase::getClassname(),
156 Inherited::getClassname(),
160 reinterpret_cast<InitContainerF
>(&StereoCameraDecorator::initMethod
),
161 reinterpret_cast<ExitContainerF
>(&StereoCameraDecorator::exitMethod
),
162 reinterpret_cast<InitalInsertDescFunc
>(
163 reinterpret_cast<void *>(&StereoCameraDecorator::classDescInserter
)),
166 "<?xml version=\"1.0\"?>\n"
169 " name=\"StereoCameraDecorator\"\n"
170 " parent=\"CameraDecorator\"\n"
171 " library=\"System\"\n"
172 " pointerfieldtypes=\"both\"\n"
173 " structure=\"abstract\"\n"
174 " systemcomponent=\"true\"\n"
175 " parentsystemcomponent=\"true\"\n"
176 " decoratable=\"false\"\n"
177 " docGroupBase=\"GrpSystemWindow\"\n"
180 "The abstract base class for stereo camera decorators, see \\ref\n"
181 "PageSystemWindowCameraDecoratorsStereo for a description.\n"
183 "The basic parameters are given by the _sfEyeSeparation and _sfLeftEye fields.\n"
185 "\t\tname=\"leftEye\"\n"
186 "\t\ttype=\"bool\"\n"
187 "\t\tcardinality=\"single\"\n"
188 "\t\tvisibility=\"external\"\n"
189 "\t\taccess=\"public\"\n"
191 "\tFlag to distinguish between left and right eye views.\n"
194 "\t\tname=\"eyeSeparation\"\n"
195 "\t\ttype=\"Real32\"\n"
196 "\t\tcardinality=\"single\"\n"
197 "\t\tvisibility=\"external\"\n"
198 "\t\taccess=\"public\"\n"
200 "\tThe distance between the two eyes.\n"
202 "</FieldContainer>\n",
203 "The abstract base class for stereo camera decorators, see \\ref\n"
204 "PageSystemWindowCameraDecoratorsStereo for a description.\n"
206 "The basic parameters are given by the _sfEyeSeparation and _sfLeftEye fields.\n"
209 /*------------------------------ get -----------------------------------*/
211 FieldContainerType
&StereoCameraDecoratorBase::getType(void)
216 const FieldContainerType
&StereoCameraDecoratorBase::getType(void) const
221 UInt32
StereoCameraDecoratorBase::getContainerSize(void) const
223 return sizeof(StereoCameraDecorator
);
226 /*------------------------- decorator get ------------------------------*/
229 SFBool
*StereoCameraDecoratorBase::editSFLeftEye(void)
231 editSField(LeftEyeFieldMask
);
236 const SFBool
*StereoCameraDecoratorBase::getSFLeftEye(void) const
242 SFReal32
*StereoCameraDecoratorBase::editSFEyeSeparation(void)
244 editSField(EyeSeparationFieldMask
);
246 return &_sfEyeSeparation
;
249 const SFReal32
*StereoCameraDecoratorBase::getSFEyeSeparation(void) const
251 return &_sfEyeSeparation
;
259 /*------------------------------ access -----------------------------------*/
261 SizeT
StereoCameraDecoratorBase::getBinSize(ConstFieldMaskArg whichField
)
263 SizeT returnValue
= Inherited::getBinSize(whichField
);
265 if(FieldBits::NoField
!= (LeftEyeFieldMask
& whichField
))
267 returnValue
+= _sfLeftEye
.getBinSize();
269 if(FieldBits::NoField
!= (EyeSeparationFieldMask
& whichField
))
271 returnValue
+= _sfEyeSeparation
.getBinSize();
277 void StereoCameraDecoratorBase::copyToBin(BinaryDataHandler
&pMem
,
278 ConstFieldMaskArg whichField
)
280 Inherited::copyToBin(pMem
, whichField
);
282 if(FieldBits::NoField
!= (LeftEyeFieldMask
& whichField
))
284 _sfLeftEye
.copyToBin(pMem
);
286 if(FieldBits::NoField
!= (EyeSeparationFieldMask
& whichField
))
288 _sfEyeSeparation
.copyToBin(pMem
);
292 void StereoCameraDecoratorBase::copyFromBin(BinaryDataHandler
&pMem
,
293 ConstFieldMaskArg whichField
)
295 Inherited::copyFromBin(pMem
, whichField
);
297 if(FieldBits::NoField
!= (LeftEyeFieldMask
& whichField
))
299 editSField(LeftEyeFieldMask
);
300 _sfLeftEye
.copyFromBin(pMem
);
302 if(FieldBits::NoField
!= (EyeSeparationFieldMask
& whichField
))
304 editSField(EyeSeparationFieldMask
);
305 _sfEyeSeparation
.copyFromBin(pMem
);
312 /*------------------------- constructors ----------------------------------*/
314 StereoCameraDecoratorBase::StereoCameraDecoratorBase(void) :
321 StereoCameraDecoratorBase::StereoCameraDecoratorBase(const StereoCameraDecoratorBase
&source
) :
323 _sfLeftEye (source
._sfLeftEye
),
324 _sfEyeSeparation (source
._sfEyeSeparation
)
329 /*-------------------------- destructors ----------------------------------*/
331 StereoCameraDecoratorBase::~StereoCameraDecoratorBase(void)
336 GetFieldHandlePtr
StereoCameraDecoratorBase::getHandleLeftEye (void) const
338 SFBool::GetHandlePtr
returnValue(
339 new SFBool::GetHandle(
341 this->getType().getFieldDesc(LeftEyeFieldId
),
342 const_cast<StereoCameraDecoratorBase
*>(this)));
347 EditFieldHandlePtr
StereoCameraDecoratorBase::editHandleLeftEye (void)
349 SFBool::EditHandlePtr
returnValue(
350 new SFBool::EditHandle(
352 this->getType().getFieldDesc(LeftEyeFieldId
),
356 editSField(LeftEyeFieldMask
);
361 GetFieldHandlePtr
StereoCameraDecoratorBase::getHandleEyeSeparation (void) const
363 SFReal32::GetHandlePtr
returnValue(
364 new SFReal32::GetHandle(
366 this->getType().getFieldDesc(EyeSeparationFieldId
),
367 const_cast<StereoCameraDecoratorBase
*>(this)));
372 EditFieldHandlePtr
StereoCameraDecoratorBase::editHandleEyeSeparation (void)
374 SFReal32::EditHandlePtr
returnValue(
375 new SFReal32::EditHandle(
377 this->getType().getFieldDesc(EyeSeparationFieldId
),
381 editSField(EyeSeparationFieldMask
);
387 #ifdef OSG_MT_CPTR_ASPECT
388 void StereoCameraDecoratorBase::execSyncV( FieldContainer
&oFrom
,
389 ConstFieldMaskArg whichField
,
390 AspectOffsetStore
&oOffsets
,
391 ConstFieldMaskArg syncMode
,
392 const UInt32 uiSyncInfo
)
394 StereoCameraDecorator
*pThis
= static_cast<StereoCameraDecorator
*>(this);
396 pThis
->execSync(static_cast<StereoCameraDecorator
*>(&oFrom
),
406 void StereoCameraDecoratorBase::resolveLinks(void)
408 Inherited::resolveLinks();