changed: gcc8 base update
[opensg.git] / Source / System / Window / Camera / OSGOffCenterPerspectiveCameraBase.cpp
blob578cdbe4fa3d7757f381a2124203d79013d78fbe
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 OffCenterPerspectiveCamera!
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 "OSGOffCenterPerspectiveCameraBase.h"
67 #include "OSGOffCenterPerspectiveCamera.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::OffCenterPerspectiveCamera
78 A generalized perspective camera for an asymmetric frustum.
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Vec2f OffCenterPerspectiveCameraBase::_sfPrincipalPoint
86 The relative position of the principal point.
90 /***************************************************************************\
91 * FieldType/FieldTrait Instantiation *
92 \***************************************************************************/
94 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
95 PointerType FieldTraits<OffCenterPerspectiveCamera *, nsOSG>::_type(
96 "OffCenterPerspectiveCameraPtr",
97 "PerspectiveCameraPtr",
98 OffCenterPerspectiveCamera::getClassType(),
99 nsOSG);
100 #endif
102 OSG_FIELDTRAITS_GETTYPE_NS(OffCenterPerspectiveCamera *, nsOSG)
104 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
105 OffCenterPerspectiveCamera *,
106 nsOSG)
108 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
109 OffCenterPerspectiveCamera *,
110 nsOSG)
112 /***************************************************************************\
113 * Field Description *
114 \***************************************************************************/
116 void OffCenterPerspectiveCameraBase::classDescInserter(TypeObject &oType)
118 FieldDescriptionBase *pDesc = NULL;
121 pDesc = new SFVec2f::Description(
122 SFVec2f::getClassType(),
123 "principalPoint",
124 "The relative position of the principal point.\n",
125 PrincipalPointFieldId, PrincipalPointFieldMask,
126 false,
127 (Field::SFDefaultFlags | Field::FStdAccess),
128 static_cast<FieldEditMethodSig>(&OffCenterPerspectiveCamera::editHandlePrincipalPoint),
129 static_cast<FieldGetMethodSig >(&OffCenterPerspectiveCamera::getHandlePrincipalPoint));
131 oType.addInitialDesc(pDesc);
135 OffCenterPerspectiveCameraBase::TypeObject OffCenterPerspectiveCameraBase::_type(
136 OffCenterPerspectiveCameraBase::getClassname(),
137 Inherited::getClassname(),
138 "NULL",
139 nsOSG, //Namespace
140 reinterpret_cast<PrototypeCreateF>(&OffCenterPerspectiveCameraBase::createEmptyLocal),
141 reinterpret_cast<InitContainerF>(&OffCenterPerspectiveCamera::initMethod),
142 reinterpret_cast<ExitContainerF>(&OffCenterPerspectiveCamera::exitMethod),
143 reinterpret_cast<InitalInsertDescFunc>(
144 reinterpret_cast<void *>(&OffCenterPerspectiveCamera::classDescInserter)),
145 false,
147 "<?xml version=\"1.0\" ?>\n"
148 "\n"
149 "<FieldContainer\n"
150 " name=\"OffCenterPerspectiveCamera\"\n"
151 " parent=\"PerspectiveCamera\"\n"
152 " library=\"Window\"\n"
153 " structure=\"concrete\"\n"
154 " pointerfieldtypes=\"both\"\n"
155 " systemcomponent=\"true\"\n"
156 " parentsystemcomponent=\"true\"\n"
157 " docGroupBase=\"GrpWindowCamera\"\n"
158 " >\n"
159 " A generalized perspective camera for an asymmetric frustum.\n"
160 " <Field\n"
161 "\t name=\"principalPoint\"\n"
162 "\t type=\"Vec2f\"\n"
163 "\t cardinality=\"single\"\n"
164 "\t visibility=\"external\"\n"
165 " defaultValue=\"0,0\"\n"
166 "\t >\n"
167 "\tThe relative position of the principal point.\n"
168 " </Field>\n"
169 "</FieldContainer>\n",
170 "A generalized perspective camera for an asymmetric frustum.\n"
173 /*------------------------------ get -----------------------------------*/
175 FieldContainerType &OffCenterPerspectiveCameraBase::getType(void)
177 return _type;
180 const FieldContainerType &OffCenterPerspectiveCameraBase::getType(void) const
182 return _type;
185 UInt32 OffCenterPerspectiveCameraBase::getContainerSize(void) const
187 return sizeof(OffCenterPerspectiveCamera);
190 /*------------------------- decorator get ------------------------------*/
193 SFVec2f *OffCenterPerspectiveCameraBase::editSFPrincipalPoint(void)
195 editSField(PrincipalPointFieldMask);
197 return &_sfPrincipalPoint;
200 const SFVec2f *OffCenterPerspectiveCameraBase::getSFPrincipalPoint(void) const
202 return &_sfPrincipalPoint;
210 /*------------------------------ access -----------------------------------*/
212 SizeT OffCenterPerspectiveCameraBase::getBinSize(ConstFieldMaskArg whichField)
214 SizeT returnValue = Inherited::getBinSize(whichField);
216 if(FieldBits::NoField != (PrincipalPointFieldMask & whichField))
218 returnValue += _sfPrincipalPoint.getBinSize();
221 return returnValue;
224 void OffCenterPerspectiveCameraBase::copyToBin(BinaryDataHandler &pMem,
225 ConstFieldMaskArg whichField)
227 Inherited::copyToBin(pMem, whichField);
229 if(FieldBits::NoField != (PrincipalPointFieldMask & whichField))
231 _sfPrincipalPoint.copyToBin(pMem);
235 void OffCenterPerspectiveCameraBase::copyFromBin(BinaryDataHandler &pMem,
236 ConstFieldMaskArg whichField)
238 Inherited::copyFromBin(pMem, whichField);
240 if(FieldBits::NoField != (PrincipalPointFieldMask & whichField))
242 editSField(PrincipalPointFieldMask);
243 _sfPrincipalPoint.copyFromBin(pMem);
247 //! create a new instance of the class
248 OffCenterPerspectiveCameraTransitPtr OffCenterPerspectiveCameraBase::createLocal(BitVector bFlags)
250 OffCenterPerspectiveCameraTransitPtr fc;
252 if(getClassType().getPrototype() != NULL)
254 FieldContainerTransitPtr tmpPtr =
255 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
257 fc = dynamic_pointer_cast<OffCenterPerspectiveCamera>(tmpPtr);
260 return fc;
263 //! create a new instance of the class, copy the container flags
264 OffCenterPerspectiveCameraTransitPtr OffCenterPerspectiveCameraBase::createDependent(BitVector bFlags)
266 OffCenterPerspectiveCameraTransitPtr fc;
268 if(getClassType().getPrototype() != NULL)
270 FieldContainerTransitPtr tmpPtr =
271 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
273 fc = dynamic_pointer_cast<OffCenterPerspectiveCamera>(tmpPtr);
276 return fc;
279 //! create a new instance of the class
280 OffCenterPerspectiveCameraTransitPtr OffCenterPerspectiveCameraBase::create(void)
282 OffCenterPerspectiveCameraTransitPtr fc;
284 if(getClassType().getPrototype() != NULL)
286 FieldContainerTransitPtr tmpPtr =
287 getClassType().getPrototype()-> shallowCopy();
289 fc = dynamic_pointer_cast<OffCenterPerspectiveCamera>(tmpPtr);
292 return fc;
295 OffCenterPerspectiveCamera *OffCenterPerspectiveCameraBase::createEmptyLocal(BitVector bFlags)
297 OffCenterPerspectiveCamera *returnValue;
299 newPtr<OffCenterPerspectiveCamera>(returnValue, bFlags);
301 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
303 return returnValue;
306 //! create an empty new instance of the class, do not copy the prototype
307 OffCenterPerspectiveCamera *OffCenterPerspectiveCameraBase::createEmpty(void)
309 OffCenterPerspectiveCamera *returnValue;
311 newPtr<OffCenterPerspectiveCamera>(returnValue, Thread::getCurrentLocalFlags());
313 returnValue->_pFieldFlags->_bNamespaceMask &=
314 ~Thread::getCurrentLocalFlags();
316 return returnValue;
320 FieldContainerTransitPtr OffCenterPerspectiveCameraBase::shallowCopyLocal(
321 BitVector bFlags) const
323 OffCenterPerspectiveCamera *tmpPtr;
325 newPtr(tmpPtr, dynamic_cast<const OffCenterPerspectiveCamera *>(this), bFlags);
327 FieldContainerTransitPtr returnValue(tmpPtr);
329 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
331 return returnValue;
334 FieldContainerTransitPtr OffCenterPerspectiveCameraBase::shallowCopyDependent(
335 BitVector bFlags) const
337 OffCenterPerspectiveCamera *tmpPtr;
339 newPtr(tmpPtr, dynamic_cast<const OffCenterPerspectiveCamera *>(this), ~bFlags);
341 FieldContainerTransitPtr returnValue(tmpPtr);
343 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
345 return returnValue;
348 FieldContainerTransitPtr OffCenterPerspectiveCameraBase::shallowCopy(void) const
350 OffCenterPerspectiveCamera *tmpPtr;
352 newPtr(tmpPtr,
353 dynamic_cast<const OffCenterPerspectiveCamera *>(this),
354 Thread::getCurrentLocalFlags());
356 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
358 FieldContainerTransitPtr returnValue(tmpPtr);
360 return returnValue;
366 /*------------------------- constructors ----------------------------------*/
368 OffCenterPerspectiveCameraBase::OffCenterPerspectiveCameraBase(void) :
369 Inherited(),
370 _sfPrincipalPoint (Vec2f(0,0))
374 OffCenterPerspectiveCameraBase::OffCenterPerspectiveCameraBase(const OffCenterPerspectiveCameraBase &source) :
375 Inherited(source),
376 _sfPrincipalPoint (source._sfPrincipalPoint )
381 /*-------------------------- destructors ----------------------------------*/
383 OffCenterPerspectiveCameraBase::~OffCenterPerspectiveCameraBase(void)
388 GetFieldHandlePtr OffCenterPerspectiveCameraBase::getHandlePrincipalPoint (void) const
390 SFVec2f::GetHandlePtr returnValue(
391 new SFVec2f::GetHandle(
392 &_sfPrincipalPoint,
393 this->getType().getFieldDesc(PrincipalPointFieldId),
394 const_cast<OffCenterPerspectiveCameraBase *>(this)));
396 return returnValue;
399 EditFieldHandlePtr OffCenterPerspectiveCameraBase::editHandlePrincipalPoint (void)
401 SFVec2f::EditHandlePtr returnValue(
402 new SFVec2f::EditHandle(
403 &_sfPrincipalPoint,
404 this->getType().getFieldDesc(PrincipalPointFieldId),
405 this));
408 editSField(PrincipalPointFieldMask);
410 return returnValue;
414 #ifdef OSG_MT_CPTR_ASPECT
415 void OffCenterPerspectiveCameraBase::execSyncV( FieldContainer &oFrom,
416 ConstFieldMaskArg whichField,
417 AspectOffsetStore &oOffsets,
418 ConstFieldMaskArg syncMode,
419 const UInt32 uiSyncInfo)
421 OffCenterPerspectiveCamera *pThis = static_cast<OffCenterPerspectiveCamera *>(this);
423 pThis->execSync(static_cast<OffCenterPerspectiveCamera *>(&oFrom),
424 whichField,
425 oOffsets,
426 syncMode,
427 uiSyncInfo);
429 #endif
432 #ifdef OSG_MT_CPTR_ASPECT
433 FieldContainer *OffCenterPerspectiveCameraBase::createAspectCopy(
434 const FieldContainer *pRefAspect) const
436 OffCenterPerspectiveCamera *returnValue;
438 newAspectCopy(returnValue,
439 dynamic_cast<const OffCenterPerspectiveCamera *>(pRefAspect),
440 dynamic_cast<const OffCenterPerspectiveCamera *>(this));
442 return returnValue;
444 #endif
446 void OffCenterPerspectiveCameraBase::resolveLinks(void)
448 Inherited::resolveLinks();
454 OSG_END_NAMESPACE