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 CSMPerspectiveCamera!
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"
65 #include "OSGNode.h" // HeadBeacon Class
67 #include "OSGCSMPerspectiveCameraBase.h"
68 #include "OSGCSMPerspectiveCamera.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::CSMPerspectiveCamera
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var Real32 CSMPerspectiveCameraBase::_sfEyeSeparation
90 /*! \var Real32 CSMPerspectiveCameraBase::_sfZeroParallax
94 /*! \var Node * CSMPerspectiveCameraBase::_sfHeadBeacon
99 /***************************************************************************\
100 * FieldType/FieldTrait Instantiation *
101 \***************************************************************************/
103 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
104 PointerType FieldTraits
<CSMPerspectiveCamera
*, nsOSG
>::_type(
105 "CSMPerspectiveCameraPtr",
106 "PerspectiveCameraPtr",
107 CSMPerspectiveCamera::getClassType(),
111 OSG_FIELDTRAITS_GETTYPE_NS(CSMPerspectiveCamera
*, nsOSG
)
113 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
114 CSMPerspectiveCamera
*,
117 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
118 CSMPerspectiveCamera
*,
121 /***************************************************************************\
122 * Field Description *
123 \***************************************************************************/
125 void CSMPerspectiveCameraBase::classDescInserter(TypeObject
&oType
)
127 FieldDescriptionBase
*pDesc
= NULL
;
130 pDesc
= new SFReal32::Description(
131 SFReal32::getClassType(),
134 EyeSeparationFieldId
, EyeSeparationFieldMask
,
136 (Field::SFDefaultFlags
| Field::FStdAccess
),
137 static_cast<FieldEditMethodSig
>(&CSMPerspectiveCamera::editHandleEyeSeparation
),
138 static_cast<FieldGetMethodSig
>(&CSMPerspectiveCamera::getHandleEyeSeparation
));
140 oType
.addInitialDesc(pDesc
);
142 pDesc
= new SFReal32::Description(
143 SFReal32::getClassType(),
146 ZeroParallaxFieldId
, ZeroParallaxFieldMask
,
148 (Field::SFDefaultFlags
| Field::FStdAccess
),
149 static_cast<FieldEditMethodSig
>(&CSMPerspectiveCamera::editHandleZeroParallax
),
150 static_cast<FieldGetMethodSig
>(&CSMPerspectiveCamera::getHandleZeroParallax
));
152 oType
.addInitialDesc(pDesc
);
154 pDesc
= new SFWeakNodePtr::Description(
155 SFWeakNodePtr::getClassType(),
158 HeadBeaconFieldId
, HeadBeaconFieldMask
,
160 (Field::SFDefaultFlags
| Field::FStdAccess
),
161 static_cast<FieldEditMethodSig
>(&CSMPerspectiveCamera::editHandleHeadBeacon
),
162 static_cast<FieldGetMethodSig
>(&CSMPerspectiveCamera::getHandleHeadBeacon
));
164 oType
.addInitialDesc(pDesc
);
168 CSMPerspectiveCameraBase::TypeObject
CSMPerspectiveCameraBase::_type(
169 CSMPerspectiveCameraBase::getClassname(),
170 Inherited::getClassname(),
173 reinterpret_cast<PrototypeCreateF
>(&CSMPerspectiveCameraBase::createEmptyLocal
),
174 reinterpret_cast<InitContainerF
>(&CSMPerspectiveCamera::initMethod
),
175 reinterpret_cast<ExitContainerF
>(&CSMPerspectiveCamera::exitMethod
),
176 reinterpret_cast<InitalInsertDescFunc
>(&CSMPerspectiveCamera::classDescInserter
),
179 "<?xml version=\"1.0\"?>\n"
182 " name=\"CSMPerspectiveCamera\"\n"
183 " parent=\"PerspectiveCamera\"\n"
184 " library=\"ContribCSM\"\n"
185 " pointerfieldtypes=\"both\"\n"
186 " structure=\"concrete\"\n"
187 " systemcomponent=\"true\"\n"
188 " parentsystemcomponent=\"true\"\n"
189 " decoratable=\"false\"\n"
190 " useLocalIncludes=\"false\"\n"
191 " isNodeCore=\"false\"\n"
192 " isBundle=\"false\"\n"
195 "\t\tname=\"eyeSeparation\"\n"
196 "\t\ttype=\"Real32\"\n"
197 "\t\tcardinality=\"single\"\n"
198 "\t\tvisibility=\"external\"\n"
199 "\t\taccess=\"public\"\n"
200 " defaultValue=\"0.5f\"\n"
204 "\t\tname=\"zeroParallax\"\n"
205 "\t\ttype=\"Real32\"\n"
206 "\t\tcardinality=\"single\"\n"
207 "\t\tvisibility=\"external\"\n"
208 "\t\taccess=\"public\"\n"
209 " defaultValue=\"10.0f\"\n"
213 " name=\"headBeacon\"\n"
215 " category=\"weakpointer\"\n"
216 " cardinality=\"single\"\n"
217 " visibility=\"external\"\n"
220 "</FieldContainer>\n",
224 /*------------------------------ get -----------------------------------*/
226 FieldContainerType
&CSMPerspectiveCameraBase::getType(void)
231 const FieldContainerType
&CSMPerspectiveCameraBase::getType(void) const
236 UInt32
CSMPerspectiveCameraBase::getContainerSize(void) const
238 return sizeof(CSMPerspectiveCamera
);
241 /*------------------------- decorator get ------------------------------*/
244 SFReal32
*CSMPerspectiveCameraBase::editSFEyeSeparation(void)
246 editSField(EyeSeparationFieldMask
);
248 return &_sfEyeSeparation
;
251 const SFReal32
*CSMPerspectiveCameraBase::getSFEyeSeparation(void) const
253 return &_sfEyeSeparation
;
257 SFReal32
*CSMPerspectiveCameraBase::editSFZeroParallax(void)
259 editSField(ZeroParallaxFieldMask
);
261 return &_sfZeroParallax
;
264 const SFReal32
*CSMPerspectiveCameraBase::getSFZeroParallax(void) const
266 return &_sfZeroParallax
;
270 //! Get the CSMPerspectiveCamera::_sfHeadBeacon field.
271 const SFWeakNodePtr
*CSMPerspectiveCameraBase::getSFHeadBeacon(void) const
273 return &_sfHeadBeacon
;
276 SFWeakNodePtr
*CSMPerspectiveCameraBase::editSFHeadBeacon (void)
278 editSField(HeadBeaconFieldMask
);
280 return &_sfHeadBeacon
;
283 //! Get the value of the CSMPerspectiveCamera::_sfHeadBeacon field.
284 Node
* CSMPerspectiveCameraBase::getHeadBeacon(void) const
286 return _sfHeadBeacon
.getValue();
289 //! Set the value of the CSMPerspectiveCamera::_sfHeadBeacon field.
290 void CSMPerspectiveCameraBase::setHeadBeacon(Node
* const value
)
292 editSField(HeadBeaconFieldMask
);
294 _sfHeadBeacon
.setValue(value
);
302 /*------------------------------ access -----------------------------------*/
304 SizeT
CSMPerspectiveCameraBase::getBinSize(ConstFieldMaskArg whichField
)
306 SizeT returnValue
= Inherited::getBinSize(whichField
);
308 if(FieldBits::NoField
!= (EyeSeparationFieldMask
& whichField
))
310 returnValue
+= _sfEyeSeparation
.getBinSize();
312 if(FieldBits::NoField
!= (ZeroParallaxFieldMask
& whichField
))
314 returnValue
+= _sfZeroParallax
.getBinSize();
316 if(FieldBits::NoField
!= (HeadBeaconFieldMask
& whichField
))
318 returnValue
+= _sfHeadBeacon
.getBinSize();
324 void CSMPerspectiveCameraBase::copyToBin(BinaryDataHandler
&pMem
,
325 ConstFieldMaskArg whichField
)
327 Inherited::copyToBin(pMem
, whichField
);
329 if(FieldBits::NoField
!= (EyeSeparationFieldMask
& whichField
))
331 _sfEyeSeparation
.copyToBin(pMem
);
333 if(FieldBits::NoField
!= (ZeroParallaxFieldMask
& whichField
))
335 _sfZeroParallax
.copyToBin(pMem
);
337 if(FieldBits::NoField
!= (HeadBeaconFieldMask
& whichField
))
339 _sfHeadBeacon
.copyToBin(pMem
);
343 void CSMPerspectiveCameraBase::copyFromBin(BinaryDataHandler
&pMem
,
344 ConstFieldMaskArg whichField
)
346 Inherited::copyFromBin(pMem
, whichField
);
348 if(FieldBits::NoField
!= (EyeSeparationFieldMask
& whichField
))
350 editSField(EyeSeparationFieldMask
);
351 _sfEyeSeparation
.copyFromBin(pMem
);
353 if(FieldBits::NoField
!= (ZeroParallaxFieldMask
& whichField
))
355 editSField(ZeroParallaxFieldMask
);
356 _sfZeroParallax
.copyFromBin(pMem
);
358 if(FieldBits::NoField
!= (HeadBeaconFieldMask
& whichField
))
360 editSField(HeadBeaconFieldMask
);
361 _sfHeadBeacon
.copyFromBin(pMem
);
365 //! create a new instance of the class
366 CSMPerspectiveCameraTransitPtr
CSMPerspectiveCameraBase::createLocal(BitVector bFlags
)
368 CSMPerspectiveCameraTransitPtr fc
;
370 if(getClassType().getPrototype() != NULL
)
372 FieldContainerTransitPtr tmpPtr
=
373 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
375 fc
= dynamic_pointer_cast
<CSMPerspectiveCamera
>(tmpPtr
);
381 //! create a new instance of the class, copy the container flags
382 CSMPerspectiveCameraTransitPtr
CSMPerspectiveCameraBase::createDependent(BitVector bFlags
)
384 CSMPerspectiveCameraTransitPtr fc
;
386 if(getClassType().getPrototype() != NULL
)
388 FieldContainerTransitPtr tmpPtr
=
389 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
391 fc
= dynamic_pointer_cast
<CSMPerspectiveCamera
>(tmpPtr
);
397 //! create a new instance of the class
398 CSMPerspectiveCameraTransitPtr
CSMPerspectiveCameraBase::create(void)
400 CSMPerspectiveCameraTransitPtr fc
;
402 if(getClassType().getPrototype() != NULL
)
404 FieldContainerTransitPtr tmpPtr
=
405 getClassType().getPrototype()-> shallowCopy();
407 fc
= dynamic_pointer_cast
<CSMPerspectiveCamera
>(tmpPtr
);
413 CSMPerspectiveCamera
*CSMPerspectiveCameraBase::createEmptyLocal(BitVector bFlags
)
415 CSMPerspectiveCamera
*returnValue
;
417 newPtr
<CSMPerspectiveCamera
>(returnValue
, bFlags
);
419 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
424 //! create an empty new instance of the class, do not copy the prototype
425 CSMPerspectiveCamera
*CSMPerspectiveCameraBase::createEmpty(void)
427 CSMPerspectiveCamera
*returnValue
;
429 newPtr
<CSMPerspectiveCamera
>(returnValue
, Thread::getCurrentLocalFlags());
431 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
432 ~Thread::getCurrentLocalFlags();
438 FieldContainerTransitPtr
CSMPerspectiveCameraBase::shallowCopyLocal(
439 BitVector bFlags
) const
441 CSMPerspectiveCamera
*tmpPtr
;
443 newPtr(tmpPtr
, dynamic_cast<const CSMPerspectiveCamera
*>(this), bFlags
);
445 FieldContainerTransitPtr
returnValue(tmpPtr
);
447 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
452 FieldContainerTransitPtr
CSMPerspectiveCameraBase::shallowCopyDependent(
453 BitVector bFlags
) const
455 CSMPerspectiveCamera
*tmpPtr
;
457 newPtr(tmpPtr
, dynamic_cast<const CSMPerspectiveCamera
*>(this), ~bFlags
);
459 FieldContainerTransitPtr
returnValue(tmpPtr
);
461 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
466 FieldContainerTransitPtr
CSMPerspectiveCameraBase::shallowCopy(void) const
468 CSMPerspectiveCamera
*tmpPtr
;
471 dynamic_cast<const CSMPerspectiveCamera
*>(this),
472 Thread::getCurrentLocalFlags());
474 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
476 FieldContainerTransitPtr
returnValue(tmpPtr
);
484 /*------------------------- constructors ----------------------------------*/
486 CSMPerspectiveCameraBase::CSMPerspectiveCameraBase(void) :
488 _sfEyeSeparation (Real32(0.5f
)),
489 _sfZeroParallax (Real32(10.0f
)),
494 CSMPerspectiveCameraBase::CSMPerspectiveCameraBase(const CSMPerspectiveCameraBase
&source
) :
496 _sfEyeSeparation (source
._sfEyeSeparation
),
497 _sfZeroParallax (source
._sfZeroParallax
),
503 /*-------------------------- destructors ----------------------------------*/
505 CSMPerspectiveCameraBase::~CSMPerspectiveCameraBase(void)
509 void CSMPerspectiveCameraBase::onCreate(const CSMPerspectiveCamera
*source
)
511 Inherited::onCreate(source
);
515 CSMPerspectiveCamera
*pThis
= static_cast<CSMPerspectiveCamera
*>(this);
517 pThis
->setHeadBeacon(source
->getHeadBeacon());
521 GetFieldHandlePtr
CSMPerspectiveCameraBase::getHandleEyeSeparation (void) const
523 SFReal32::GetHandlePtr
returnValue(
524 new SFReal32::GetHandle(
526 this->getType().getFieldDesc(EyeSeparationFieldId
),
527 const_cast<CSMPerspectiveCameraBase
*>(this)));
532 EditFieldHandlePtr
CSMPerspectiveCameraBase::editHandleEyeSeparation (void)
534 SFReal32::EditHandlePtr
returnValue(
535 new SFReal32::EditHandle(
537 this->getType().getFieldDesc(EyeSeparationFieldId
),
541 editSField(EyeSeparationFieldMask
);
546 GetFieldHandlePtr
CSMPerspectiveCameraBase::getHandleZeroParallax (void) const
548 SFReal32::GetHandlePtr
returnValue(
549 new SFReal32::GetHandle(
551 this->getType().getFieldDesc(ZeroParallaxFieldId
),
552 const_cast<CSMPerspectiveCameraBase
*>(this)));
557 EditFieldHandlePtr
CSMPerspectiveCameraBase::editHandleZeroParallax (void)
559 SFReal32::EditHandlePtr
returnValue(
560 new SFReal32::EditHandle(
562 this->getType().getFieldDesc(ZeroParallaxFieldId
),
566 editSField(ZeroParallaxFieldMask
);
571 GetFieldHandlePtr
CSMPerspectiveCameraBase::getHandleHeadBeacon (void) const
573 SFWeakNodePtr::GetHandlePtr
returnValue(
574 new SFWeakNodePtr::GetHandle(
576 this->getType().getFieldDesc(HeadBeaconFieldId
),
577 const_cast<CSMPerspectiveCameraBase
*>(this)));
582 EditFieldHandlePtr
CSMPerspectiveCameraBase::editHandleHeadBeacon (void)
584 SFWeakNodePtr::EditHandlePtr
returnValue(
585 new SFWeakNodePtr::EditHandle(
587 this->getType().getFieldDesc(HeadBeaconFieldId
),
590 returnValue
->setSetMethod(
591 boost::bind(&CSMPerspectiveCamera::setHeadBeacon
,
592 static_cast<CSMPerspectiveCamera
*>(this), _1
));
594 editSField(HeadBeaconFieldMask
);
600 #ifdef OSG_MT_CPTR_ASPECT
601 void CSMPerspectiveCameraBase::execSyncV( FieldContainer
&oFrom
,
602 ConstFieldMaskArg whichField
,
603 AspectOffsetStore
&oOffsets
,
604 ConstFieldMaskArg syncMode
,
605 const UInt32 uiSyncInfo
)
607 CSMPerspectiveCamera
*pThis
= static_cast<CSMPerspectiveCamera
*>(this);
609 pThis
->execSync(static_cast<CSMPerspectiveCamera
*>(&oFrom
),
618 #ifdef OSG_MT_CPTR_ASPECT
619 FieldContainer
*CSMPerspectiveCameraBase::createAspectCopy(
620 const FieldContainer
*pRefAspect
) const
622 CSMPerspectiveCamera
*returnValue
;
624 newAspectCopy(returnValue
,
625 dynamic_cast<const CSMPerspectiveCamera
*>(pRefAspect
),
626 dynamic_cast<const CSMPerspectiveCamera
*>(this));
632 void CSMPerspectiveCameraBase::resolveLinks(void)
634 Inherited::resolveLinks();
636 static_cast<CSMPerspectiveCamera
*>(this)->setHeadBeacon(NULL
);