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 OrthographicCamera!
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 "OSGOrthographicCameraBase.h"
67 #include "OSGOrthographicCamera.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::OrthographicCamera
78 A perspective camera with a symmetric frustum.
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Real32 OrthographicCameraBase::_sfVerticalSize
86 The vertical size of the camera box, in world units. Ignored when less
87 then or equal to zero.
90 /*! \var Real32 OrthographicCameraBase::_sfHorizontalSize
91 The horizontal size of the camera box, in world units. Ignored when less
92 then or equal to zero.
95 /*! \var Real32 OrthographicCameraBase::_sfAspect
96 The aspect ratio (i.e. width / height) of a pixel.
100 /***************************************************************************\
101 * FieldType/FieldTrait Instantiation *
102 \***************************************************************************/
104 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
105 PointerType FieldTraits
<OrthographicCamera
*, nsOSG
>::_type(
106 "OrthographicCameraPtr",
108 OrthographicCamera::getClassType(),
112 OSG_FIELDTRAITS_GETTYPE_NS(OrthographicCamera
*, nsOSG
)
114 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
115 OrthographicCamera
*,
118 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
119 OrthographicCamera
*,
122 /***************************************************************************\
123 * Field Description *
124 \***************************************************************************/
126 void OrthographicCameraBase::classDescInserter(TypeObject
&oType
)
128 FieldDescriptionBase
*pDesc
= NULL
;
131 pDesc
= new SFReal32::Description(
132 SFReal32::getClassType(),
134 "The vertical size of the camera box, in world units. Ignored when less\n"
135 "then or equal to zero. \n",
136 VerticalSizeFieldId
, VerticalSizeFieldMask
,
138 (Field::SFDefaultFlags
| Field::FStdAccess
),
139 static_cast<FieldEditMethodSig
>(&OrthographicCamera::editHandleVerticalSize
),
140 static_cast<FieldGetMethodSig
>(&OrthographicCamera::getHandleVerticalSize
));
142 oType
.addInitialDesc(pDesc
);
144 pDesc
= new SFReal32::Description(
145 SFReal32::getClassType(),
147 "The horizontal size of the camera box, in world units. Ignored when less\n"
148 "then or equal to zero. \n",
149 HorizontalSizeFieldId
, HorizontalSizeFieldMask
,
151 (Field::SFDefaultFlags
| Field::FStdAccess
),
152 static_cast<FieldEditMethodSig
>(&OrthographicCamera::editHandleHorizontalSize
),
153 static_cast<FieldGetMethodSig
>(&OrthographicCamera::getHandleHorizontalSize
));
155 oType
.addInitialDesc(pDesc
);
157 pDesc
= new SFReal32::Description(
158 SFReal32::getClassType(),
160 "The aspect ratio (i.e. width / height) of a pixel.\n",
161 AspectFieldId
, AspectFieldMask
,
163 (Field::SFDefaultFlags
| Field::FStdAccess
),
164 static_cast<FieldEditMethodSig
>(&OrthographicCamera::editHandleAspect
),
165 static_cast<FieldGetMethodSig
>(&OrthographicCamera::getHandleAspect
));
167 oType
.addInitialDesc(pDesc
);
171 OrthographicCameraBase::TypeObject
OrthographicCameraBase::_type(
172 OrthographicCameraBase::getClassname(),
173 Inherited::getClassname(),
176 reinterpret_cast<PrototypeCreateF
>(&OrthographicCameraBase::createEmptyLocal
),
177 reinterpret_cast<InitContainerF
>(&OrthographicCamera::initMethod
),
178 reinterpret_cast<ExitContainerF
>(&OrthographicCamera::exitMethod
),
179 reinterpret_cast<InitalInsertDescFunc
>(
180 reinterpret_cast<void *>(&OrthographicCamera::classDescInserter
)),
183 "<?xml version=\"1.0\" ?>\n"
186 " name=\"OrthographicCamera\"\n"
187 " parent=\"Camera\"\n"
188 " library=\"Window\"\n"
189 " structure=\"concrete\"\n"
190 " pointerfieldtypes=\"both\"\n"
191 " systemcomponent=\"true\"\n"
192 " parentsystemcomponent=\"true\"\n"
193 " docGroupBase=\"GrpWindowCamera\"\n"
195 " A perspective camera with a symmetric frustum.\n"
197 "\t name=\"verticalSize\"\n"
198 "\t type=\"Real32\"\n"
199 "\t cardinality=\"single\"\n"
200 "\t visibility=\"external\"\n"
202 "\tThe vertical size of the camera box, in world units. Ignored when less\n"
203 "\tthen or equal to zero. \n"
206 "\t name=\"horizontalSize\"\n"
207 "\t type=\"Real32\"\n"
208 "\t cardinality=\"single\"\n"
209 "\t visibility=\"external\"\n"
210 " defaultValue=\"-1\"\n"
212 "\tThe horizontal size of the camera box, in world units. Ignored when less\n"
213 "\tthen or equal to zero. \n"
216 "\t name=\"aspect\"\n"
217 "\t type=\"Real32\"\n"
218 "\t cardinality=\"single\"\n"
219 "\t visibility=\"external\"\n"
220 " defaultValue=\"1\"\n"
222 "\tThe aspect ratio (i.e. width / height) of a pixel.\n"
224 "</FieldContainer>\n",
225 "A perspective camera with a symmetric frustum.\n"
228 /*------------------------------ get -----------------------------------*/
230 FieldContainerType
&OrthographicCameraBase::getType(void)
235 const FieldContainerType
&OrthographicCameraBase::getType(void) const
240 UInt32
OrthographicCameraBase::getContainerSize(void) const
242 return sizeof(OrthographicCamera
);
245 /*------------------------- decorator get ------------------------------*/
248 SFReal32
*OrthographicCameraBase::editSFVerticalSize(void)
250 editSField(VerticalSizeFieldMask
);
252 return &_sfVerticalSize
;
255 const SFReal32
*OrthographicCameraBase::getSFVerticalSize(void) const
257 return &_sfVerticalSize
;
261 SFReal32
*OrthographicCameraBase::editSFHorizontalSize(void)
263 editSField(HorizontalSizeFieldMask
);
265 return &_sfHorizontalSize
;
268 const SFReal32
*OrthographicCameraBase::getSFHorizontalSize(void) const
270 return &_sfHorizontalSize
;
274 SFReal32
*OrthographicCameraBase::editSFAspect(void)
276 editSField(AspectFieldMask
);
281 const SFReal32
*OrthographicCameraBase::getSFAspect(void) const
291 /*------------------------------ access -----------------------------------*/
293 SizeT
OrthographicCameraBase::getBinSize(ConstFieldMaskArg whichField
)
295 SizeT returnValue
= Inherited::getBinSize(whichField
);
297 if(FieldBits::NoField
!= (VerticalSizeFieldMask
& whichField
))
299 returnValue
+= _sfVerticalSize
.getBinSize();
301 if(FieldBits::NoField
!= (HorizontalSizeFieldMask
& whichField
))
303 returnValue
+= _sfHorizontalSize
.getBinSize();
305 if(FieldBits::NoField
!= (AspectFieldMask
& whichField
))
307 returnValue
+= _sfAspect
.getBinSize();
313 void OrthographicCameraBase::copyToBin(BinaryDataHandler
&pMem
,
314 ConstFieldMaskArg whichField
)
316 Inherited::copyToBin(pMem
, whichField
);
318 if(FieldBits::NoField
!= (VerticalSizeFieldMask
& whichField
))
320 _sfVerticalSize
.copyToBin(pMem
);
322 if(FieldBits::NoField
!= (HorizontalSizeFieldMask
& whichField
))
324 _sfHorizontalSize
.copyToBin(pMem
);
326 if(FieldBits::NoField
!= (AspectFieldMask
& whichField
))
328 _sfAspect
.copyToBin(pMem
);
332 void OrthographicCameraBase::copyFromBin(BinaryDataHandler
&pMem
,
333 ConstFieldMaskArg whichField
)
335 Inherited::copyFromBin(pMem
, whichField
);
337 if(FieldBits::NoField
!= (VerticalSizeFieldMask
& whichField
))
339 editSField(VerticalSizeFieldMask
);
340 _sfVerticalSize
.copyFromBin(pMem
);
342 if(FieldBits::NoField
!= (HorizontalSizeFieldMask
& whichField
))
344 editSField(HorizontalSizeFieldMask
);
345 _sfHorizontalSize
.copyFromBin(pMem
);
347 if(FieldBits::NoField
!= (AspectFieldMask
& whichField
))
349 editSField(AspectFieldMask
);
350 _sfAspect
.copyFromBin(pMem
);
354 //! create a new instance of the class
355 OrthographicCameraTransitPtr
OrthographicCameraBase::createLocal(BitVector bFlags
)
357 OrthographicCameraTransitPtr fc
;
359 if(getClassType().getPrototype() != NULL
)
361 FieldContainerTransitPtr tmpPtr
=
362 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
364 fc
= dynamic_pointer_cast
<OrthographicCamera
>(tmpPtr
);
370 //! create a new instance of the class, copy the container flags
371 OrthographicCameraTransitPtr
OrthographicCameraBase::createDependent(BitVector bFlags
)
373 OrthographicCameraTransitPtr fc
;
375 if(getClassType().getPrototype() != NULL
)
377 FieldContainerTransitPtr tmpPtr
=
378 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
380 fc
= dynamic_pointer_cast
<OrthographicCamera
>(tmpPtr
);
386 //! create a new instance of the class
387 OrthographicCameraTransitPtr
OrthographicCameraBase::create(void)
389 OrthographicCameraTransitPtr fc
;
391 if(getClassType().getPrototype() != NULL
)
393 FieldContainerTransitPtr tmpPtr
=
394 getClassType().getPrototype()-> shallowCopy();
396 fc
= dynamic_pointer_cast
<OrthographicCamera
>(tmpPtr
);
402 OrthographicCamera
*OrthographicCameraBase::createEmptyLocal(BitVector bFlags
)
404 OrthographicCamera
*returnValue
;
406 newPtr
<OrthographicCamera
>(returnValue
, bFlags
);
408 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
413 //! create an empty new instance of the class, do not copy the prototype
414 OrthographicCamera
*OrthographicCameraBase::createEmpty(void)
416 OrthographicCamera
*returnValue
;
418 newPtr
<OrthographicCamera
>(returnValue
, Thread::getCurrentLocalFlags());
420 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
421 ~Thread::getCurrentLocalFlags();
427 FieldContainerTransitPtr
OrthographicCameraBase::shallowCopyLocal(
428 BitVector bFlags
) const
430 OrthographicCamera
*tmpPtr
;
432 newPtr(tmpPtr
, dynamic_cast<const OrthographicCamera
*>(this), bFlags
);
434 FieldContainerTransitPtr
returnValue(tmpPtr
);
436 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
441 FieldContainerTransitPtr
OrthographicCameraBase::shallowCopyDependent(
442 BitVector bFlags
) const
444 OrthographicCamera
*tmpPtr
;
446 newPtr(tmpPtr
, dynamic_cast<const OrthographicCamera
*>(this), ~bFlags
);
448 FieldContainerTransitPtr
returnValue(tmpPtr
);
450 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
455 FieldContainerTransitPtr
OrthographicCameraBase::shallowCopy(void) const
457 OrthographicCamera
*tmpPtr
;
460 dynamic_cast<const OrthographicCamera
*>(this),
461 Thread::getCurrentLocalFlags());
463 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
465 FieldContainerTransitPtr
returnValue(tmpPtr
);
473 /*------------------------- constructors ----------------------------------*/
475 OrthographicCameraBase::OrthographicCameraBase(void) :
478 _sfHorizontalSize (Real32(-1)),
479 _sfAspect (Real32(1))
483 OrthographicCameraBase::OrthographicCameraBase(const OrthographicCameraBase
&source
) :
485 _sfVerticalSize (source
._sfVerticalSize
),
486 _sfHorizontalSize (source
._sfHorizontalSize
),
487 _sfAspect (source
._sfAspect
)
492 /*-------------------------- destructors ----------------------------------*/
494 OrthographicCameraBase::~OrthographicCameraBase(void)
499 GetFieldHandlePtr
OrthographicCameraBase::getHandleVerticalSize (void) const
501 SFReal32::GetHandlePtr
returnValue(
502 new SFReal32::GetHandle(
504 this->getType().getFieldDesc(VerticalSizeFieldId
),
505 const_cast<OrthographicCameraBase
*>(this)));
510 EditFieldHandlePtr
OrthographicCameraBase::editHandleVerticalSize (void)
512 SFReal32::EditHandlePtr
returnValue(
513 new SFReal32::EditHandle(
515 this->getType().getFieldDesc(VerticalSizeFieldId
),
519 editSField(VerticalSizeFieldMask
);
524 GetFieldHandlePtr
OrthographicCameraBase::getHandleHorizontalSize (void) const
526 SFReal32::GetHandlePtr
returnValue(
527 new SFReal32::GetHandle(
529 this->getType().getFieldDesc(HorizontalSizeFieldId
),
530 const_cast<OrthographicCameraBase
*>(this)));
535 EditFieldHandlePtr
OrthographicCameraBase::editHandleHorizontalSize (void)
537 SFReal32::EditHandlePtr
returnValue(
538 new SFReal32::EditHandle(
540 this->getType().getFieldDesc(HorizontalSizeFieldId
),
544 editSField(HorizontalSizeFieldMask
);
549 GetFieldHandlePtr
OrthographicCameraBase::getHandleAspect (void) const
551 SFReal32::GetHandlePtr
returnValue(
552 new SFReal32::GetHandle(
554 this->getType().getFieldDesc(AspectFieldId
),
555 const_cast<OrthographicCameraBase
*>(this)));
560 EditFieldHandlePtr
OrthographicCameraBase::editHandleAspect (void)
562 SFReal32::EditHandlePtr
returnValue(
563 new SFReal32::EditHandle(
565 this->getType().getFieldDesc(AspectFieldId
),
569 editSField(AspectFieldMask
);
575 #ifdef OSG_MT_CPTR_ASPECT
576 void OrthographicCameraBase::execSyncV( FieldContainer
&oFrom
,
577 ConstFieldMaskArg whichField
,
578 AspectOffsetStore
&oOffsets
,
579 ConstFieldMaskArg syncMode
,
580 const UInt32 uiSyncInfo
)
582 OrthographicCamera
*pThis
= static_cast<OrthographicCamera
*>(this);
584 pThis
->execSync(static_cast<OrthographicCamera
*>(&oFrom
),
593 #ifdef OSG_MT_CPTR_ASPECT
594 FieldContainer
*OrthographicCameraBase::createAspectCopy(
595 const FieldContainer
*pRefAspect
) const
597 OrthographicCamera
*returnValue
;
599 newAspectCopy(returnValue
,
600 dynamic_cast<const OrthographicCamera
*>(pRefAspect
),
601 dynamic_cast<const OrthographicCamera
*>(this));
607 void OrthographicCameraBase::resolveLinks(void)
609 Inherited::resolveLinks();