changed: gcc8 base update
[opensg.git] / Source / System / Window / Base / OSGStereoCameraDecoratorBase.cpp
blob6c6838a85ea5e3780cf935c74196cefa0e29ac07
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 StereoCameraDecorator!
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 "OSGStereoCameraDecoratorBase.h"
67 #include "OSGStereoCameraDecorator.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
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(),
106 nsOSG);
107 #endif
109 OSG_FIELDTRAITS_GETTYPE_NS(StereoCameraDecorator *, nsOSG)
111 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
112 StereoCameraDecorator *,
113 nsOSG)
115 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
116 StereoCameraDecorator *,
117 nsOSG)
119 /***************************************************************************\
120 * Field Description *
121 \***************************************************************************/
123 void StereoCameraDecoratorBase::classDescInserter(TypeObject &oType)
125 FieldDescriptionBase *pDesc = NULL;
128 pDesc = new SFBool::Description(
129 SFBool::getClassType(),
130 "leftEye",
131 "Flag to distinguish between left and right eye views.\n",
132 LeftEyeFieldId, LeftEyeFieldMask,
133 false,
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(),
142 "eyeSeparation",
143 "The distance between the two eyes.\n",
144 EyeSeparationFieldId, EyeSeparationFieldMask,
145 false,
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(),
157 "NULL",
158 nsOSG, //Namespace
159 NULL,
160 reinterpret_cast<InitContainerF>(&StereoCameraDecorator::initMethod),
161 reinterpret_cast<ExitContainerF>(&StereoCameraDecorator::exitMethod),
162 reinterpret_cast<InitalInsertDescFunc>(
163 reinterpret_cast<void *>(&StereoCameraDecorator::classDescInserter)),
164 false,
166 "<?xml version=\"1.0\"?>\n"
167 "\n"
168 "<FieldContainer\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"
178 " >\n"
179 "\n"
180 "The abstract base class for stereo camera decorators, see \\ref\n"
181 "PageSystemWindowCameraDecoratorsStereo for a description.\n"
182 "\n"
183 "The basic parameters are given by the _sfEyeSeparation and _sfLeftEye fields.\n"
184 "\t<Field\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"
190 "\t>\n"
191 "\tFlag to distinguish between left and right eye views.\n"
192 "\t</Field>\n"
193 "\t<Field\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"
199 "\t>\n"
200 "\tThe distance between the two eyes.\n"
201 "\t</Field>\n"
202 "</FieldContainer>\n",
203 "The abstract base class for stereo camera decorators, see \\ref\n"
204 "PageSystemWindowCameraDecoratorsStereo for a description.\n"
205 "\n"
206 "The basic parameters are given by the _sfEyeSeparation and _sfLeftEye fields.\n"
209 /*------------------------------ get -----------------------------------*/
211 FieldContainerType &StereoCameraDecoratorBase::getType(void)
213 return _type;
216 const FieldContainerType &StereoCameraDecoratorBase::getType(void) const
218 return _type;
221 UInt32 StereoCameraDecoratorBase::getContainerSize(void) const
223 return sizeof(StereoCameraDecorator);
226 /*------------------------- decorator get ------------------------------*/
229 SFBool *StereoCameraDecoratorBase::editSFLeftEye(void)
231 editSField(LeftEyeFieldMask);
233 return &_sfLeftEye;
236 const SFBool *StereoCameraDecoratorBase::getSFLeftEye(void) const
238 return &_sfLeftEye;
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();
274 return returnValue;
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) :
315 Inherited(),
316 _sfLeftEye (),
317 _sfEyeSeparation ()
321 StereoCameraDecoratorBase::StereoCameraDecoratorBase(const StereoCameraDecoratorBase &source) :
322 Inherited(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(
340 &_sfLeftEye,
341 this->getType().getFieldDesc(LeftEyeFieldId),
342 const_cast<StereoCameraDecoratorBase *>(this)));
344 return returnValue;
347 EditFieldHandlePtr StereoCameraDecoratorBase::editHandleLeftEye (void)
349 SFBool::EditHandlePtr returnValue(
350 new SFBool::EditHandle(
351 &_sfLeftEye,
352 this->getType().getFieldDesc(LeftEyeFieldId),
353 this));
356 editSField(LeftEyeFieldMask);
358 return returnValue;
361 GetFieldHandlePtr StereoCameraDecoratorBase::getHandleEyeSeparation (void) const
363 SFReal32::GetHandlePtr returnValue(
364 new SFReal32::GetHandle(
365 &_sfEyeSeparation,
366 this->getType().getFieldDesc(EyeSeparationFieldId),
367 const_cast<StereoCameraDecoratorBase *>(this)));
369 return returnValue;
372 EditFieldHandlePtr StereoCameraDecoratorBase::editHandleEyeSeparation (void)
374 SFReal32::EditHandlePtr returnValue(
375 new SFReal32::EditHandle(
376 &_sfEyeSeparation,
377 this->getType().getFieldDesc(EyeSeparationFieldId),
378 this));
381 editSField(EyeSeparationFieldMask);
383 return returnValue;
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),
397 whichField,
398 oOffsets,
399 syncMode,
400 uiSyncInfo);
402 #endif
406 void StereoCameraDecoratorBase::resolveLinks(void)
408 Inherited::resolveLinks();
414 OSG_END_NAMESPACE