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
>(
177 reinterpret_cast<void *>(&CSMPerspectiveCamera::classDescInserter
)),
180 "<?xml version=\"1.0\"?>\n"
183 " name=\"CSMPerspectiveCamera\"\n"
184 " parent=\"PerspectiveCamera\"\n"
185 " library=\"ContribCSM\"\n"
186 " pointerfieldtypes=\"both\"\n"
187 " structure=\"concrete\"\n"
188 " systemcomponent=\"true\"\n"
189 " parentsystemcomponent=\"true\"\n"
190 " decoratable=\"false\"\n"
191 " useLocalIncludes=\"false\"\n"
192 " isNodeCore=\"false\"\n"
193 " isBundle=\"false\"\n"
196 "\t\tname=\"eyeSeparation\"\n"
197 "\t\ttype=\"Real32\"\n"
198 "\t\tcardinality=\"single\"\n"
199 "\t\tvisibility=\"external\"\n"
200 "\t\taccess=\"public\"\n"
201 " defaultValue=\"0.5f\"\n"
205 "\t\tname=\"zeroParallax\"\n"
206 "\t\ttype=\"Real32\"\n"
207 "\t\tcardinality=\"single\"\n"
208 "\t\tvisibility=\"external\"\n"
209 "\t\taccess=\"public\"\n"
210 " defaultValue=\"10.0f\"\n"
214 " name=\"headBeacon\"\n"
216 " category=\"weakpointer\"\n"
217 " cardinality=\"single\"\n"
218 " visibility=\"external\"\n"
221 "</FieldContainer>\n",
225 /*------------------------------ get -----------------------------------*/
227 FieldContainerType
&CSMPerspectiveCameraBase::getType(void)
232 const FieldContainerType
&CSMPerspectiveCameraBase::getType(void) const
237 UInt32
CSMPerspectiveCameraBase::getContainerSize(void) const
239 return sizeof(CSMPerspectiveCamera
);
242 /*------------------------- decorator get ------------------------------*/
245 SFReal32
*CSMPerspectiveCameraBase::editSFEyeSeparation(void)
247 editSField(EyeSeparationFieldMask
);
249 return &_sfEyeSeparation
;
252 const SFReal32
*CSMPerspectiveCameraBase::getSFEyeSeparation(void) const
254 return &_sfEyeSeparation
;
258 SFReal32
*CSMPerspectiveCameraBase::editSFZeroParallax(void)
260 editSField(ZeroParallaxFieldMask
);
262 return &_sfZeroParallax
;
265 const SFReal32
*CSMPerspectiveCameraBase::getSFZeroParallax(void) const
267 return &_sfZeroParallax
;
271 //! Get the CSMPerspectiveCamera::_sfHeadBeacon field.
272 const SFWeakNodePtr
*CSMPerspectiveCameraBase::getSFHeadBeacon(void) const
274 return &_sfHeadBeacon
;
277 SFWeakNodePtr
*CSMPerspectiveCameraBase::editSFHeadBeacon (void)
279 editSField(HeadBeaconFieldMask
);
281 return &_sfHeadBeacon
;
284 //! Get the value of the CSMPerspectiveCamera::_sfHeadBeacon field.
285 Node
* CSMPerspectiveCameraBase::getHeadBeacon(void) const
287 return _sfHeadBeacon
.getValue();
290 //! Set the value of the CSMPerspectiveCamera::_sfHeadBeacon field.
291 void CSMPerspectiveCameraBase::setHeadBeacon(Node
* const value
)
293 editSField(HeadBeaconFieldMask
);
295 _sfHeadBeacon
.setValue(value
);
303 /*------------------------------ access -----------------------------------*/
305 SizeT
CSMPerspectiveCameraBase::getBinSize(ConstFieldMaskArg whichField
)
307 SizeT returnValue
= Inherited::getBinSize(whichField
);
309 if(FieldBits::NoField
!= (EyeSeparationFieldMask
& whichField
))
311 returnValue
+= _sfEyeSeparation
.getBinSize();
313 if(FieldBits::NoField
!= (ZeroParallaxFieldMask
& whichField
))
315 returnValue
+= _sfZeroParallax
.getBinSize();
317 if(FieldBits::NoField
!= (HeadBeaconFieldMask
& whichField
))
319 returnValue
+= _sfHeadBeacon
.getBinSize();
325 void CSMPerspectiveCameraBase::copyToBin(BinaryDataHandler
&pMem
,
326 ConstFieldMaskArg whichField
)
328 Inherited::copyToBin(pMem
, whichField
);
330 if(FieldBits::NoField
!= (EyeSeparationFieldMask
& whichField
))
332 _sfEyeSeparation
.copyToBin(pMem
);
334 if(FieldBits::NoField
!= (ZeroParallaxFieldMask
& whichField
))
336 _sfZeroParallax
.copyToBin(pMem
);
338 if(FieldBits::NoField
!= (HeadBeaconFieldMask
& whichField
))
340 _sfHeadBeacon
.copyToBin(pMem
);
344 void CSMPerspectiveCameraBase::copyFromBin(BinaryDataHandler
&pMem
,
345 ConstFieldMaskArg whichField
)
347 Inherited::copyFromBin(pMem
, whichField
);
349 if(FieldBits::NoField
!= (EyeSeparationFieldMask
& whichField
))
351 editSField(EyeSeparationFieldMask
);
352 _sfEyeSeparation
.copyFromBin(pMem
);
354 if(FieldBits::NoField
!= (ZeroParallaxFieldMask
& whichField
))
356 editSField(ZeroParallaxFieldMask
);
357 _sfZeroParallax
.copyFromBin(pMem
);
359 if(FieldBits::NoField
!= (HeadBeaconFieldMask
& whichField
))
361 editSField(HeadBeaconFieldMask
);
362 _sfHeadBeacon
.copyFromBin(pMem
);
366 //! create a new instance of the class
367 CSMPerspectiveCameraTransitPtr
CSMPerspectiveCameraBase::createLocal(BitVector bFlags
)
369 CSMPerspectiveCameraTransitPtr fc
;
371 if(getClassType().getPrototype() != NULL
)
373 FieldContainerTransitPtr tmpPtr
=
374 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
376 fc
= dynamic_pointer_cast
<CSMPerspectiveCamera
>(tmpPtr
);
382 //! create a new instance of the class, copy the container flags
383 CSMPerspectiveCameraTransitPtr
CSMPerspectiveCameraBase::createDependent(BitVector bFlags
)
385 CSMPerspectiveCameraTransitPtr fc
;
387 if(getClassType().getPrototype() != NULL
)
389 FieldContainerTransitPtr tmpPtr
=
390 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
392 fc
= dynamic_pointer_cast
<CSMPerspectiveCamera
>(tmpPtr
);
398 //! create a new instance of the class
399 CSMPerspectiveCameraTransitPtr
CSMPerspectiveCameraBase::create(void)
401 CSMPerspectiveCameraTransitPtr fc
;
403 if(getClassType().getPrototype() != NULL
)
405 FieldContainerTransitPtr tmpPtr
=
406 getClassType().getPrototype()-> shallowCopy();
408 fc
= dynamic_pointer_cast
<CSMPerspectiveCamera
>(tmpPtr
);
414 CSMPerspectiveCamera
*CSMPerspectiveCameraBase::createEmptyLocal(BitVector bFlags
)
416 CSMPerspectiveCamera
*returnValue
;
418 newPtr
<CSMPerspectiveCamera
>(returnValue
, bFlags
);
420 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
425 //! create an empty new instance of the class, do not copy the prototype
426 CSMPerspectiveCamera
*CSMPerspectiveCameraBase::createEmpty(void)
428 CSMPerspectiveCamera
*returnValue
;
430 newPtr
<CSMPerspectiveCamera
>(returnValue
, Thread::getCurrentLocalFlags());
432 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
433 ~Thread::getCurrentLocalFlags();
439 FieldContainerTransitPtr
CSMPerspectiveCameraBase::shallowCopyLocal(
440 BitVector bFlags
) const
442 CSMPerspectiveCamera
*tmpPtr
;
444 newPtr(tmpPtr
, dynamic_cast<const CSMPerspectiveCamera
*>(this), bFlags
);
446 FieldContainerTransitPtr
returnValue(tmpPtr
);
448 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
453 FieldContainerTransitPtr
CSMPerspectiveCameraBase::shallowCopyDependent(
454 BitVector bFlags
) const
456 CSMPerspectiveCamera
*tmpPtr
;
458 newPtr(tmpPtr
, dynamic_cast<const CSMPerspectiveCamera
*>(this), ~bFlags
);
460 FieldContainerTransitPtr
returnValue(tmpPtr
);
462 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
467 FieldContainerTransitPtr
CSMPerspectiveCameraBase::shallowCopy(void) const
469 CSMPerspectiveCamera
*tmpPtr
;
472 dynamic_cast<const CSMPerspectiveCamera
*>(this),
473 Thread::getCurrentLocalFlags());
475 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
477 FieldContainerTransitPtr
returnValue(tmpPtr
);
485 /*------------------------- constructors ----------------------------------*/
487 CSMPerspectiveCameraBase::CSMPerspectiveCameraBase(void) :
489 _sfEyeSeparation (Real32(0.5f
)),
490 _sfZeroParallax (Real32(10.0f
)),
495 CSMPerspectiveCameraBase::CSMPerspectiveCameraBase(const CSMPerspectiveCameraBase
&source
) :
497 _sfEyeSeparation (source
._sfEyeSeparation
),
498 _sfZeroParallax (source
._sfZeroParallax
),
504 /*-------------------------- destructors ----------------------------------*/
506 CSMPerspectiveCameraBase::~CSMPerspectiveCameraBase(void)
510 void CSMPerspectiveCameraBase::onCreate(const CSMPerspectiveCamera
*source
)
512 Inherited::onCreate(source
);
516 CSMPerspectiveCamera
*pThis
= static_cast<CSMPerspectiveCamera
*>(this);
518 pThis
->setHeadBeacon(source
->getHeadBeacon());
522 GetFieldHandlePtr
CSMPerspectiveCameraBase::getHandleEyeSeparation (void) const
524 SFReal32::GetHandlePtr
returnValue(
525 new SFReal32::GetHandle(
527 this->getType().getFieldDesc(EyeSeparationFieldId
),
528 const_cast<CSMPerspectiveCameraBase
*>(this)));
533 EditFieldHandlePtr
CSMPerspectiveCameraBase::editHandleEyeSeparation (void)
535 SFReal32::EditHandlePtr
returnValue(
536 new SFReal32::EditHandle(
538 this->getType().getFieldDesc(EyeSeparationFieldId
),
542 editSField(EyeSeparationFieldMask
);
547 GetFieldHandlePtr
CSMPerspectiveCameraBase::getHandleZeroParallax (void) const
549 SFReal32::GetHandlePtr
returnValue(
550 new SFReal32::GetHandle(
552 this->getType().getFieldDesc(ZeroParallaxFieldId
),
553 const_cast<CSMPerspectiveCameraBase
*>(this)));
558 EditFieldHandlePtr
CSMPerspectiveCameraBase::editHandleZeroParallax (void)
560 SFReal32::EditHandlePtr
returnValue(
561 new SFReal32::EditHandle(
563 this->getType().getFieldDesc(ZeroParallaxFieldId
),
567 editSField(ZeroParallaxFieldMask
);
572 GetFieldHandlePtr
CSMPerspectiveCameraBase::getHandleHeadBeacon (void) const
574 SFWeakNodePtr::GetHandlePtr
returnValue(
575 new SFWeakNodePtr::GetHandle(
577 this->getType().getFieldDesc(HeadBeaconFieldId
),
578 const_cast<CSMPerspectiveCameraBase
*>(this)));
583 EditFieldHandlePtr
CSMPerspectiveCameraBase::editHandleHeadBeacon (void)
585 SFWeakNodePtr::EditHandlePtr
returnValue(
586 new SFWeakNodePtr::EditHandle(
588 this->getType().getFieldDesc(HeadBeaconFieldId
),
591 returnValue
->setSetMethod(
592 boost::bind(&CSMPerspectiveCamera::setHeadBeacon
,
593 static_cast<CSMPerspectiveCamera
*>(this), _1
));
595 editSField(HeadBeaconFieldMask
);
601 #ifdef OSG_MT_CPTR_ASPECT
602 void CSMPerspectiveCameraBase::execSyncV( FieldContainer
&oFrom
,
603 ConstFieldMaskArg whichField
,
604 AspectOffsetStore
&oOffsets
,
605 ConstFieldMaskArg syncMode
,
606 const UInt32 uiSyncInfo
)
608 CSMPerspectiveCamera
*pThis
= static_cast<CSMPerspectiveCamera
*>(this);
610 pThis
->execSync(static_cast<CSMPerspectiveCamera
*>(&oFrom
),
619 #ifdef OSG_MT_CPTR_ASPECT
620 FieldContainer
*CSMPerspectiveCameraBase::createAspectCopy(
621 const FieldContainer
*pRefAspect
) const
623 CSMPerspectiveCamera
*returnValue
;
625 newAspectCopy(returnValue
,
626 dynamic_cast<const CSMPerspectiveCamera
*>(pRefAspect
),
627 dynamic_cast<const CSMPerspectiveCamera
*>(this));
633 void CSMPerspectiveCameraBase::resolveLinks(void)
635 Inherited::resolveLinks();
637 static_cast<CSMPerspectiveCamera
*>(this)->setHeadBeacon(NULL
);