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 **
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 "OSGBillboardBase.h"
67 #include "OSGBillboard.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::Billboard
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Vec3f BillboardBase::_sfAxisOfRotation
89 /*! \var bool BillboardBase::_sfFocusOnCamera
93 /*! \var bool BillboardBase::_sfAlignToScreen
97 /*! \var Real32 BillboardBase::_sfMinAngle
101 /*! \var Real32 BillboardBase::_sfMaxAngle
106 /***************************************************************************\
107 * FieldType/FieldTrait Instantiation *
108 \***************************************************************************/
110 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
111 PointerType FieldTraits
<Billboard
*, nsOSG
>::_type(
114 Billboard::getClassType(),
118 OSG_FIELDTRAITS_GETTYPE_NS(Billboard
*, nsOSG
)
120 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
124 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
128 /***************************************************************************\
129 * Field Description *
130 \***************************************************************************/
132 void BillboardBase::classDescInserter(TypeObject
&oType
)
134 FieldDescriptionBase
*pDesc
= NULL
;
137 pDesc
= new SFVec3f::Description(
138 SFVec3f::getClassType(),
141 AxisOfRotationFieldId
, AxisOfRotationFieldMask
,
143 (Field::SFDefaultFlags
| Field::FStdAccess
),
144 static_cast<FieldEditMethodSig
>(&Billboard::editHandleAxisOfRotation
),
145 static_cast<FieldGetMethodSig
>(&Billboard::getHandleAxisOfRotation
));
147 oType
.addInitialDesc(pDesc
);
149 pDesc
= new SFBool::Description(
150 SFBool::getClassType(),
153 FocusOnCameraFieldId
, FocusOnCameraFieldMask
,
155 (Field::SFDefaultFlags
| Field::FStdAccess
),
156 static_cast<FieldEditMethodSig
>(&Billboard::editHandleFocusOnCamera
),
157 static_cast<FieldGetMethodSig
>(&Billboard::getHandleFocusOnCamera
));
159 oType
.addInitialDesc(pDesc
);
161 pDesc
= new SFBool::Description(
162 SFBool::getClassType(),
165 AlignToScreenFieldId
, AlignToScreenFieldMask
,
167 (Field::SFDefaultFlags
| Field::FStdAccess
),
168 static_cast<FieldEditMethodSig
>(&Billboard::editHandleAlignToScreen
),
169 static_cast<FieldGetMethodSig
>(&Billboard::getHandleAlignToScreen
));
171 oType
.addInitialDesc(pDesc
);
173 pDesc
= new SFReal32::Description(
174 SFReal32::getClassType(),
177 MinAngleFieldId
, MinAngleFieldMask
,
179 (Field::SFDefaultFlags
| Field::FStdAccess
),
180 static_cast<FieldEditMethodSig
>(&Billboard::editHandleMinAngle
),
181 static_cast<FieldGetMethodSig
>(&Billboard::getHandleMinAngle
));
183 oType
.addInitialDesc(pDesc
);
185 pDesc
= new SFReal32::Description(
186 SFReal32::getClassType(),
189 MaxAngleFieldId
, MaxAngleFieldMask
,
191 (Field::SFDefaultFlags
| Field::FStdAccess
),
192 static_cast<FieldEditMethodSig
>(&Billboard::editHandleMaxAngle
),
193 static_cast<FieldGetMethodSig
>(&Billboard::getHandleMaxAngle
));
195 oType
.addInitialDesc(pDesc
);
199 BillboardBase::TypeObject
BillboardBase::_type(
200 BillboardBase::getClassname(),
201 Inherited::getClassname(),
204 reinterpret_cast<PrototypeCreateF
>(&BillboardBase::createEmptyLocal
),
205 reinterpret_cast<InitContainerF
>(&Billboard::initMethod
),
206 reinterpret_cast<ExitContainerF
>(&Billboard::exitMethod
),
207 reinterpret_cast<InitalInsertDescFunc
>(
208 reinterpret_cast<void *>(&Billboard::classDescInserter
)),
211 "<?xml version=\"1.0\"?>\n"
214 " name=\"Billboard\"\n"
215 " parent=\"Group\"\n"
216 " library=\"Group\"\n"
217 " pointerfieldtypes=\"both\"\n"
218 " structure=\"concrete\"\n"
219 " systemcomponent=\"true\"\n"
220 " parentsystemcomponent=\"true\"\n"
221 " isNodeCore=\"true\"\n"
222 " docGroupBase=\"GrpGroupMisc\"\n"
225 "\t name=\"axisOfRotation\"\n"
226 "\t type=\"Vec3f\"\n"
227 "\t cardinality=\"single\"\n"
228 "\t visibility=\"external\"\n"
229 "\t defaultValue=\"0.f, 1.f, 0.f\"\n"
230 "\t access=\"public\"\n"
234 "\t name=\"focusOnCamera\"\n"
236 "\t cardinality=\"single\"\n"
237 "\t visibility=\"external\"\n"
238 "\t defaultValue=\"true\"\n"
239 "\t access=\"public\"\n"
243 "\t name=\"alignToScreen\"\n"
245 "\t cardinality=\"single\"\n"
246 "\t visibility=\"external\"\n"
247 "\t defaultValue=\"false\"\n"
248 "\t access=\"public\"\n"
252 "\t name=\"minAngle\"\n"
253 "\t type=\"Real32\"\n"
254 "\t cardinality=\"single\"\n"
255 "\t visibility=\"external\"\n"
256 "\t defaultValue=\"0.0f\"\n"
257 "\t access=\"public\"\n"
261 "\t name=\"maxAngle\"\n"
262 "\t type=\"Real32\"\n"
263 "\t cardinality=\"single\"\n"
264 "\t visibility=\"external\"\n"
265 "\t defaultValue=\"-1.0f\"\n"
266 "\t access=\"public\"\n"
269 "</FieldContainer>\n",
273 /*------------------------------ get -----------------------------------*/
275 FieldContainerType
&BillboardBase::getType(void)
280 const FieldContainerType
&BillboardBase::getType(void) const
285 UInt32
BillboardBase::getContainerSize(void) const
287 return sizeof(Billboard
);
290 /*------------------------- decorator get ------------------------------*/
293 SFVec3f
*BillboardBase::editSFAxisOfRotation(void)
295 editSField(AxisOfRotationFieldMask
);
297 return &_sfAxisOfRotation
;
300 const SFVec3f
*BillboardBase::getSFAxisOfRotation(void) const
302 return &_sfAxisOfRotation
;
306 SFBool
*BillboardBase::editSFFocusOnCamera(void)
308 editSField(FocusOnCameraFieldMask
);
310 return &_sfFocusOnCamera
;
313 const SFBool
*BillboardBase::getSFFocusOnCamera(void) const
315 return &_sfFocusOnCamera
;
319 SFBool
*BillboardBase::editSFAlignToScreen(void)
321 editSField(AlignToScreenFieldMask
);
323 return &_sfAlignToScreen
;
326 const SFBool
*BillboardBase::getSFAlignToScreen(void) const
328 return &_sfAlignToScreen
;
332 SFReal32
*BillboardBase::editSFMinAngle(void)
334 editSField(MinAngleFieldMask
);
339 const SFReal32
*BillboardBase::getSFMinAngle(void) const
345 SFReal32
*BillboardBase::editSFMaxAngle(void)
347 editSField(MaxAngleFieldMask
);
352 const SFReal32
*BillboardBase::getSFMaxAngle(void) const
362 /*------------------------------ access -----------------------------------*/
364 SizeT
BillboardBase::getBinSize(ConstFieldMaskArg whichField
)
366 SizeT returnValue
= Inherited::getBinSize(whichField
);
368 if(FieldBits::NoField
!= (AxisOfRotationFieldMask
& whichField
))
370 returnValue
+= _sfAxisOfRotation
.getBinSize();
372 if(FieldBits::NoField
!= (FocusOnCameraFieldMask
& whichField
))
374 returnValue
+= _sfFocusOnCamera
.getBinSize();
376 if(FieldBits::NoField
!= (AlignToScreenFieldMask
& whichField
))
378 returnValue
+= _sfAlignToScreen
.getBinSize();
380 if(FieldBits::NoField
!= (MinAngleFieldMask
& whichField
))
382 returnValue
+= _sfMinAngle
.getBinSize();
384 if(FieldBits::NoField
!= (MaxAngleFieldMask
& whichField
))
386 returnValue
+= _sfMaxAngle
.getBinSize();
392 void BillboardBase::copyToBin(BinaryDataHandler
&pMem
,
393 ConstFieldMaskArg whichField
)
395 Inherited::copyToBin(pMem
, whichField
);
397 if(FieldBits::NoField
!= (AxisOfRotationFieldMask
& whichField
))
399 _sfAxisOfRotation
.copyToBin(pMem
);
401 if(FieldBits::NoField
!= (FocusOnCameraFieldMask
& whichField
))
403 _sfFocusOnCamera
.copyToBin(pMem
);
405 if(FieldBits::NoField
!= (AlignToScreenFieldMask
& whichField
))
407 _sfAlignToScreen
.copyToBin(pMem
);
409 if(FieldBits::NoField
!= (MinAngleFieldMask
& whichField
))
411 _sfMinAngle
.copyToBin(pMem
);
413 if(FieldBits::NoField
!= (MaxAngleFieldMask
& whichField
))
415 _sfMaxAngle
.copyToBin(pMem
);
419 void BillboardBase::copyFromBin(BinaryDataHandler
&pMem
,
420 ConstFieldMaskArg whichField
)
422 Inherited::copyFromBin(pMem
, whichField
);
424 if(FieldBits::NoField
!= (AxisOfRotationFieldMask
& whichField
))
426 editSField(AxisOfRotationFieldMask
);
427 _sfAxisOfRotation
.copyFromBin(pMem
);
429 if(FieldBits::NoField
!= (FocusOnCameraFieldMask
& whichField
))
431 editSField(FocusOnCameraFieldMask
);
432 _sfFocusOnCamera
.copyFromBin(pMem
);
434 if(FieldBits::NoField
!= (AlignToScreenFieldMask
& whichField
))
436 editSField(AlignToScreenFieldMask
);
437 _sfAlignToScreen
.copyFromBin(pMem
);
439 if(FieldBits::NoField
!= (MinAngleFieldMask
& whichField
))
441 editSField(MinAngleFieldMask
);
442 _sfMinAngle
.copyFromBin(pMem
);
444 if(FieldBits::NoField
!= (MaxAngleFieldMask
& whichField
))
446 editSField(MaxAngleFieldMask
);
447 _sfMaxAngle
.copyFromBin(pMem
);
451 //! create a new instance of the class
452 BillboardTransitPtr
BillboardBase::createLocal(BitVector bFlags
)
454 BillboardTransitPtr fc
;
456 if(getClassType().getPrototype() != NULL
)
458 FieldContainerTransitPtr tmpPtr
=
459 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
461 fc
= dynamic_pointer_cast
<Billboard
>(tmpPtr
);
467 //! create a new instance of the class, copy the container flags
468 BillboardTransitPtr
BillboardBase::createDependent(BitVector bFlags
)
470 BillboardTransitPtr fc
;
472 if(getClassType().getPrototype() != NULL
)
474 FieldContainerTransitPtr tmpPtr
=
475 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
477 fc
= dynamic_pointer_cast
<Billboard
>(tmpPtr
);
483 //! create a new instance of the class
484 BillboardTransitPtr
BillboardBase::create(void)
486 BillboardTransitPtr fc
;
488 if(getClassType().getPrototype() != NULL
)
490 FieldContainerTransitPtr tmpPtr
=
491 getClassType().getPrototype()-> shallowCopy();
493 fc
= dynamic_pointer_cast
<Billboard
>(tmpPtr
);
499 Billboard
*BillboardBase::createEmptyLocal(BitVector bFlags
)
501 Billboard
*returnValue
;
503 newPtr
<Billboard
>(returnValue
, bFlags
);
505 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
510 //! create an empty new instance of the class, do not copy the prototype
511 Billboard
*BillboardBase::createEmpty(void)
513 Billboard
*returnValue
;
515 newPtr
<Billboard
>(returnValue
, Thread::getCurrentLocalFlags());
517 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
518 ~Thread::getCurrentLocalFlags();
524 FieldContainerTransitPtr
BillboardBase::shallowCopyLocal(
525 BitVector bFlags
) const
529 newPtr(tmpPtr
, dynamic_cast<const Billboard
*>(this), bFlags
);
531 FieldContainerTransitPtr
returnValue(tmpPtr
);
533 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
538 FieldContainerTransitPtr
BillboardBase::shallowCopyDependent(
539 BitVector bFlags
) const
543 newPtr(tmpPtr
, dynamic_cast<const Billboard
*>(this), ~bFlags
);
545 FieldContainerTransitPtr
returnValue(tmpPtr
);
547 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
552 FieldContainerTransitPtr
BillboardBase::shallowCopy(void) const
557 dynamic_cast<const Billboard
*>(this),
558 Thread::getCurrentLocalFlags());
560 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
562 FieldContainerTransitPtr
returnValue(tmpPtr
);
570 /*------------------------- constructors ----------------------------------*/
572 BillboardBase::BillboardBase(void) :
574 _sfAxisOfRotation (Vec3f(0.f
, 1.f
, 0.f
)),
575 _sfFocusOnCamera (bool(true)),
576 _sfAlignToScreen (bool(false)),
577 _sfMinAngle (Real32(0.0f
)),
578 _sfMaxAngle (Real32(-1.0f
))
582 BillboardBase::BillboardBase(const BillboardBase
&source
) :
584 _sfAxisOfRotation (source
._sfAxisOfRotation
),
585 _sfFocusOnCamera (source
._sfFocusOnCamera
),
586 _sfAlignToScreen (source
._sfAlignToScreen
),
587 _sfMinAngle (source
._sfMinAngle
),
588 _sfMaxAngle (source
._sfMaxAngle
)
593 /*-------------------------- destructors ----------------------------------*/
595 BillboardBase::~BillboardBase(void)
600 GetFieldHandlePtr
BillboardBase::getHandleAxisOfRotation (void) const
602 SFVec3f::GetHandlePtr
returnValue(
603 new SFVec3f::GetHandle(
605 this->getType().getFieldDesc(AxisOfRotationFieldId
),
606 const_cast<BillboardBase
*>(this)));
611 EditFieldHandlePtr
BillboardBase::editHandleAxisOfRotation (void)
613 SFVec3f::EditHandlePtr
returnValue(
614 new SFVec3f::EditHandle(
616 this->getType().getFieldDesc(AxisOfRotationFieldId
),
620 editSField(AxisOfRotationFieldMask
);
625 GetFieldHandlePtr
BillboardBase::getHandleFocusOnCamera (void) const
627 SFBool::GetHandlePtr
returnValue(
628 new SFBool::GetHandle(
630 this->getType().getFieldDesc(FocusOnCameraFieldId
),
631 const_cast<BillboardBase
*>(this)));
636 EditFieldHandlePtr
BillboardBase::editHandleFocusOnCamera (void)
638 SFBool::EditHandlePtr
returnValue(
639 new SFBool::EditHandle(
641 this->getType().getFieldDesc(FocusOnCameraFieldId
),
645 editSField(FocusOnCameraFieldMask
);
650 GetFieldHandlePtr
BillboardBase::getHandleAlignToScreen (void) const
652 SFBool::GetHandlePtr
returnValue(
653 new SFBool::GetHandle(
655 this->getType().getFieldDesc(AlignToScreenFieldId
),
656 const_cast<BillboardBase
*>(this)));
661 EditFieldHandlePtr
BillboardBase::editHandleAlignToScreen (void)
663 SFBool::EditHandlePtr
returnValue(
664 new SFBool::EditHandle(
666 this->getType().getFieldDesc(AlignToScreenFieldId
),
670 editSField(AlignToScreenFieldMask
);
675 GetFieldHandlePtr
BillboardBase::getHandleMinAngle (void) const
677 SFReal32::GetHandlePtr
returnValue(
678 new SFReal32::GetHandle(
680 this->getType().getFieldDesc(MinAngleFieldId
),
681 const_cast<BillboardBase
*>(this)));
686 EditFieldHandlePtr
BillboardBase::editHandleMinAngle (void)
688 SFReal32::EditHandlePtr
returnValue(
689 new SFReal32::EditHandle(
691 this->getType().getFieldDesc(MinAngleFieldId
),
695 editSField(MinAngleFieldMask
);
700 GetFieldHandlePtr
BillboardBase::getHandleMaxAngle (void) const
702 SFReal32::GetHandlePtr
returnValue(
703 new SFReal32::GetHandle(
705 this->getType().getFieldDesc(MaxAngleFieldId
),
706 const_cast<BillboardBase
*>(this)));
711 EditFieldHandlePtr
BillboardBase::editHandleMaxAngle (void)
713 SFReal32::EditHandlePtr
returnValue(
714 new SFReal32::EditHandle(
716 this->getType().getFieldDesc(MaxAngleFieldId
),
720 editSField(MaxAngleFieldMask
);
726 #ifdef OSG_MT_CPTR_ASPECT
727 void BillboardBase::execSyncV( FieldContainer
&oFrom
,
728 ConstFieldMaskArg whichField
,
729 AspectOffsetStore
&oOffsets
,
730 ConstFieldMaskArg syncMode
,
731 const UInt32 uiSyncInfo
)
733 Billboard
*pThis
= static_cast<Billboard
*>(this);
735 pThis
->execSync(static_cast<Billboard
*>(&oFrom
),
744 #ifdef OSG_MT_CPTR_ASPECT
745 FieldContainer
*BillboardBase::createAspectCopy(
746 const FieldContainer
*pRefAspect
) const
748 Billboard
*returnValue
;
750 newAspectCopy(returnValue
,
751 dynamic_cast<const Billboard
*>(pRefAspect
),
752 dynamic_cast<const Billboard
*>(this));
758 void BillboardBase::resolveLinks(void)
760 Inherited::resolveLinks();