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 ComponentTransform!
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 "OSGComponentTransformBase.h"
67 #include "OSGComponentTransform.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::ComponentTransform
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Vec3f ComponentTransformBase::_sfCenter
89 /*! \var Quaternion ComponentTransformBase::_sfRotation
93 /*! \var Vec3f ComponentTransformBase::_sfScale
97 /*! \var Quaternion ComponentTransformBase::_sfScaleOrientation
101 /*! \var Vec3f ComponentTransformBase::_sfTranslation
106 /***************************************************************************\
107 * FieldType/FieldTrait Instantiation *
108 \***************************************************************************/
110 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
111 PointerType FieldTraits
<ComponentTransform
*, nsOSG
>::_type(
112 "ComponentTransformPtr",
114 ComponentTransform::getClassType(),
118 OSG_FIELDTRAITS_GETTYPE_NS(ComponentTransform
*, nsOSG
)
120 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
121 ComponentTransform
*,
124 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
125 ComponentTransform
*,
128 /***************************************************************************\
129 * Field Description *
130 \***************************************************************************/
132 void ComponentTransformBase::classDescInserter(TypeObject
&oType
)
134 FieldDescriptionBase
*pDesc
= NULL
;
137 pDesc
= new SFVec3f::Description(
138 SFVec3f::getClassType(),
141 CenterFieldId
, CenterFieldMask
,
143 (Field::SFDefaultFlags
| Field::FStdAccess
),
144 static_cast<FieldEditMethodSig
>(&ComponentTransform::editHandleCenter
),
145 static_cast<FieldGetMethodSig
>(&ComponentTransform::getHandleCenter
));
147 oType
.addInitialDesc(pDesc
);
149 pDesc
= new SFQuaternion::Description(
150 SFQuaternion::getClassType(),
153 RotationFieldId
, RotationFieldMask
,
155 (Field::SFDefaultFlags
| Field::FStdAccess
),
156 static_cast<FieldEditMethodSig
>(&ComponentTransform::editHandleRotation
),
157 static_cast<FieldGetMethodSig
>(&ComponentTransform::getHandleRotation
));
159 oType
.addInitialDesc(pDesc
);
161 pDesc
= new SFVec3f::Description(
162 SFVec3f::getClassType(),
165 ScaleFieldId
, ScaleFieldMask
,
167 (Field::SFDefaultFlags
| Field::FStdAccess
),
168 static_cast<FieldEditMethodSig
>(&ComponentTransform::editHandleScale
),
169 static_cast<FieldGetMethodSig
>(&ComponentTransform::getHandleScale
));
171 oType
.addInitialDesc(pDesc
);
173 pDesc
= new SFQuaternion::Description(
174 SFQuaternion::getClassType(),
177 ScaleOrientationFieldId
, ScaleOrientationFieldMask
,
179 (Field::SFDefaultFlags
| Field::FStdAccess
),
180 static_cast<FieldEditMethodSig
>(&ComponentTransform::editHandleScaleOrientation
),
181 static_cast<FieldGetMethodSig
>(&ComponentTransform::getHandleScaleOrientation
));
183 oType
.addInitialDesc(pDesc
);
185 pDesc
= new SFVec3f::Description(
186 SFVec3f::getClassType(),
189 TranslationFieldId
, TranslationFieldMask
,
191 (Field::SFDefaultFlags
| Field::FStdAccess
),
192 static_cast<FieldEditMethodSig
>(&ComponentTransform::editHandleTranslation
),
193 static_cast<FieldGetMethodSig
>(&ComponentTransform::getHandleTranslation
));
195 oType
.addInitialDesc(pDesc
);
199 ComponentTransformBase::TypeObject
ComponentTransformBase::_type(
200 ComponentTransformBase::getClassname(),
201 Inherited::getClassname(),
204 reinterpret_cast<PrototypeCreateF
>(&ComponentTransformBase::createEmptyLocal
),
205 reinterpret_cast<InitContainerF
>(&ComponentTransform::initMethod
),
206 reinterpret_cast<ExitContainerF
>(&ComponentTransform::exitMethod
),
207 reinterpret_cast<InitalInsertDescFunc
>(
208 reinterpret_cast<void *>(&ComponentTransform::classDescInserter
)),
211 "<?xml version=\"1.0\" ?>\n"
214 " name=\"ComponentTransform\"\n"
215 " parent=\"Transform\"\n"
216 " library=\"Group\"\n"
217 " structure=\"concrete\"\n"
218 " pointerfieldtypes=\"both\"\n"
219 " systemcomponent=\"true\"\n"
220 " parentsystemcomponent=\"true\"\n"
221 " isNodeCore=\"true\"\n"
222 " docGroupBase=\"GrpGroupMisc\"\n"
225 "\t name=\"center\"\n"
226 "\t type=\"Vec3f\"\n"
227 "\t cardinality=\"single\"\n"
228 "\t visibility=\"external\"\n"
232 "\t name=\"rotation\"\n"
233 "\t type=\"Quaternion\"\n"
234 "\t cardinality=\"single\"\n"
235 "\t visibility=\"external\"\n"
239 "\t name=\"scale\"\n"
240 "\t type=\"Vec3f\"\n"
241 "\t cardinality=\"single\"\n"
242 "\t visibility=\"external\"\n"
246 "\t name=\"scaleOrientation\"\n"
247 "\t type=\"Quaternion\"\n"
248 "\t cardinality=\"single\"\n"
249 "\t visibility=\"external\"\n"
253 "\t name=\"translation\"\n"
254 "\t type=\"Vec3f\"\n"
255 "\t cardinality=\"single\"\n"
256 "\t visibility=\"external\"\n"
259 "</FieldContainer>\n",
263 /*------------------------------ get -----------------------------------*/
265 FieldContainerType
&ComponentTransformBase::getType(void)
270 const FieldContainerType
&ComponentTransformBase::getType(void) const
275 UInt32
ComponentTransformBase::getContainerSize(void) const
277 return sizeof(ComponentTransform
);
280 /*------------------------- decorator get ------------------------------*/
283 SFVec3f
*ComponentTransformBase::editSFCenter(void)
285 editSField(CenterFieldMask
);
290 const SFVec3f
*ComponentTransformBase::getSFCenter(void) const
296 SFQuaternion
*ComponentTransformBase::editSFRotation(void)
298 editSField(RotationFieldMask
);
303 const SFQuaternion
*ComponentTransformBase::getSFRotation(void) const
309 SFVec3f
*ComponentTransformBase::editSFScale(void)
311 editSField(ScaleFieldMask
);
316 const SFVec3f
*ComponentTransformBase::getSFScale(void) const
322 SFQuaternion
*ComponentTransformBase::editSFScaleOrientation(void)
324 editSField(ScaleOrientationFieldMask
);
326 return &_sfScaleOrientation
;
329 const SFQuaternion
*ComponentTransformBase::getSFScaleOrientation(void) const
331 return &_sfScaleOrientation
;
335 SFVec3f
*ComponentTransformBase::editSFTranslation(void)
337 editSField(TranslationFieldMask
);
339 return &_sfTranslation
;
342 const SFVec3f
*ComponentTransformBase::getSFTranslation(void) const
344 return &_sfTranslation
;
352 /*------------------------------ access -----------------------------------*/
354 SizeT
ComponentTransformBase::getBinSize(ConstFieldMaskArg whichField
)
356 SizeT returnValue
= Inherited::getBinSize(whichField
);
358 if(FieldBits::NoField
!= (CenterFieldMask
& whichField
))
360 returnValue
+= _sfCenter
.getBinSize();
362 if(FieldBits::NoField
!= (RotationFieldMask
& whichField
))
364 returnValue
+= _sfRotation
.getBinSize();
366 if(FieldBits::NoField
!= (ScaleFieldMask
& whichField
))
368 returnValue
+= _sfScale
.getBinSize();
370 if(FieldBits::NoField
!= (ScaleOrientationFieldMask
& whichField
))
372 returnValue
+= _sfScaleOrientation
.getBinSize();
374 if(FieldBits::NoField
!= (TranslationFieldMask
& whichField
))
376 returnValue
+= _sfTranslation
.getBinSize();
382 void ComponentTransformBase::copyToBin(BinaryDataHandler
&pMem
,
383 ConstFieldMaskArg whichField
)
385 Inherited::copyToBin(pMem
, whichField
);
387 if(FieldBits::NoField
!= (CenterFieldMask
& whichField
))
389 _sfCenter
.copyToBin(pMem
);
391 if(FieldBits::NoField
!= (RotationFieldMask
& whichField
))
393 _sfRotation
.copyToBin(pMem
);
395 if(FieldBits::NoField
!= (ScaleFieldMask
& whichField
))
397 _sfScale
.copyToBin(pMem
);
399 if(FieldBits::NoField
!= (ScaleOrientationFieldMask
& whichField
))
401 _sfScaleOrientation
.copyToBin(pMem
);
403 if(FieldBits::NoField
!= (TranslationFieldMask
& whichField
))
405 _sfTranslation
.copyToBin(pMem
);
409 void ComponentTransformBase::copyFromBin(BinaryDataHandler
&pMem
,
410 ConstFieldMaskArg whichField
)
412 Inherited::copyFromBin(pMem
, whichField
);
414 if(FieldBits::NoField
!= (CenterFieldMask
& whichField
))
416 editSField(CenterFieldMask
);
417 _sfCenter
.copyFromBin(pMem
);
419 if(FieldBits::NoField
!= (RotationFieldMask
& whichField
))
421 editSField(RotationFieldMask
);
422 _sfRotation
.copyFromBin(pMem
);
424 if(FieldBits::NoField
!= (ScaleFieldMask
& whichField
))
426 editSField(ScaleFieldMask
);
427 _sfScale
.copyFromBin(pMem
);
429 if(FieldBits::NoField
!= (ScaleOrientationFieldMask
& whichField
))
431 editSField(ScaleOrientationFieldMask
);
432 _sfScaleOrientation
.copyFromBin(pMem
);
434 if(FieldBits::NoField
!= (TranslationFieldMask
& whichField
))
436 editSField(TranslationFieldMask
);
437 _sfTranslation
.copyFromBin(pMem
);
441 //! create a new instance of the class
442 ComponentTransformTransitPtr
ComponentTransformBase::createLocal(BitVector bFlags
)
444 ComponentTransformTransitPtr fc
;
446 if(getClassType().getPrototype() != NULL
)
448 FieldContainerTransitPtr tmpPtr
=
449 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
451 fc
= dynamic_pointer_cast
<ComponentTransform
>(tmpPtr
);
457 //! create a new instance of the class, copy the container flags
458 ComponentTransformTransitPtr
ComponentTransformBase::createDependent(BitVector bFlags
)
460 ComponentTransformTransitPtr fc
;
462 if(getClassType().getPrototype() != NULL
)
464 FieldContainerTransitPtr tmpPtr
=
465 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
467 fc
= dynamic_pointer_cast
<ComponentTransform
>(tmpPtr
);
473 //! create a new instance of the class
474 ComponentTransformTransitPtr
ComponentTransformBase::create(void)
476 ComponentTransformTransitPtr fc
;
478 if(getClassType().getPrototype() != NULL
)
480 FieldContainerTransitPtr tmpPtr
=
481 getClassType().getPrototype()-> shallowCopy();
483 fc
= dynamic_pointer_cast
<ComponentTransform
>(tmpPtr
);
489 ComponentTransform
*ComponentTransformBase::createEmptyLocal(BitVector bFlags
)
491 ComponentTransform
*returnValue
;
493 newPtr
<ComponentTransform
>(returnValue
, bFlags
);
495 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
500 //! create an empty new instance of the class, do not copy the prototype
501 ComponentTransform
*ComponentTransformBase::createEmpty(void)
503 ComponentTransform
*returnValue
;
505 newPtr
<ComponentTransform
>(returnValue
, Thread::getCurrentLocalFlags());
507 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
508 ~Thread::getCurrentLocalFlags();
514 FieldContainerTransitPtr
ComponentTransformBase::shallowCopyLocal(
515 BitVector bFlags
) const
517 ComponentTransform
*tmpPtr
;
519 newPtr(tmpPtr
, dynamic_cast<const ComponentTransform
*>(this), bFlags
);
521 FieldContainerTransitPtr
returnValue(tmpPtr
);
523 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
528 FieldContainerTransitPtr
ComponentTransformBase::shallowCopyDependent(
529 BitVector bFlags
) const
531 ComponentTransform
*tmpPtr
;
533 newPtr(tmpPtr
, dynamic_cast<const ComponentTransform
*>(this), ~bFlags
);
535 FieldContainerTransitPtr
returnValue(tmpPtr
);
537 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
542 FieldContainerTransitPtr
ComponentTransformBase::shallowCopy(void) const
544 ComponentTransform
*tmpPtr
;
547 dynamic_cast<const ComponentTransform
*>(this),
548 Thread::getCurrentLocalFlags());
550 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
552 FieldContainerTransitPtr
returnValue(tmpPtr
);
560 /*------------------------- constructors ----------------------------------*/
562 ComponentTransformBase::ComponentTransformBase(void) :
567 _sfScaleOrientation (),
572 ComponentTransformBase::ComponentTransformBase(const ComponentTransformBase
&source
) :
574 _sfCenter (source
._sfCenter
),
575 _sfRotation (source
._sfRotation
),
576 _sfScale (source
._sfScale
),
577 _sfScaleOrientation (source
._sfScaleOrientation
),
578 _sfTranslation (source
._sfTranslation
)
583 /*-------------------------- destructors ----------------------------------*/
585 ComponentTransformBase::~ComponentTransformBase(void)
590 GetFieldHandlePtr
ComponentTransformBase::getHandleCenter (void) const
592 SFVec3f::GetHandlePtr
returnValue(
593 new SFVec3f::GetHandle(
595 this->getType().getFieldDesc(CenterFieldId
),
596 const_cast<ComponentTransformBase
*>(this)));
601 EditFieldHandlePtr
ComponentTransformBase::editHandleCenter (void)
603 SFVec3f::EditHandlePtr
returnValue(
604 new SFVec3f::EditHandle(
606 this->getType().getFieldDesc(CenterFieldId
),
610 editSField(CenterFieldMask
);
615 GetFieldHandlePtr
ComponentTransformBase::getHandleRotation (void) const
617 SFQuaternion::GetHandlePtr
returnValue(
618 new SFQuaternion::GetHandle(
620 this->getType().getFieldDesc(RotationFieldId
),
621 const_cast<ComponentTransformBase
*>(this)));
626 EditFieldHandlePtr
ComponentTransformBase::editHandleRotation (void)
628 SFQuaternion::EditHandlePtr
returnValue(
629 new SFQuaternion::EditHandle(
631 this->getType().getFieldDesc(RotationFieldId
),
635 editSField(RotationFieldMask
);
640 GetFieldHandlePtr
ComponentTransformBase::getHandleScale (void) const
642 SFVec3f::GetHandlePtr
returnValue(
643 new SFVec3f::GetHandle(
645 this->getType().getFieldDesc(ScaleFieldId
),
646 const_cast<ComponentTransformBase
*>(this)));
651 EditFieldHandlePtr
ComponentTransformBase::editHandleScale (void)
653 SFVec3f::EditHandlePtr
returnValue(
654 new SFVec3f::EditHandle(
656 this->getType().getFieldDesc(ScaleFieldId
),
660 editSField(ScaleFieldMask
);
665 GetFieldHandlePtr
ComponentTransformBase::getHandleScaleOrientation (void) const
667 SFQuaternion::GetHandlePtr
returnValue(
668 new SFQuaternion::GetHandle(
669 &_sfScaleOrientation
,
670 this->getType().getFieldDesc(ScaleOrientationFieldId
),
671 const_cast<ComponentTransformBase
*>(this)));
676 EditFieldHandlePtr
ComponentTransformBase::editHandleScaleOrientation(void)
678 SFQuaternion::EditHandlePtr
returnValue(
679 new SFQuaternion::EditHandle(
680 &_sfScaleOrientation
,
681 this->getType().getFieldDesc(ScaleOrientationFieldId
),
685 editSField(ScaleOrientationFieldMask
);
690 GetFieldHandlePtr
ComponentTransformBase::getHandleTranslation (void) const
692 SFVec3f::GetHandlePtr
returnValue(
693 new SFVec3f::GetHandle(
695 this->getType().getFieldDesc(TranslationFieldId
),
696 const_cast<ComponentTransformBase
*>(this)));
701 EditFieldHandlePtr
ComponentTransformBase::editHandleTranslation (void)
703 SFVec3f::EditHandlePtr
returnValue(
704 new SFVec3f::EditHandle(
706 this->getType().getFieldDesc(TranslationFieldId
),
710 editSField(TranslationFieldMask
);
716 #ifdef OSG_MT_CPTR_ASPECT
717 void ComponentTransformBase::execSyncV( FieldContainer
&oFrom
,
718 ConstFieldMaskArg whichField
,
719 AspectOffsetStore
&oOffsets
,
720 ConstFieldMaskArg syncMode
,
721 const UInt32 uiSyncInfo
)
723 ComponentTransform
*pThis
= static_cast<ComponentTransform
*>(this);
725 pThis
->execSync(static_cast<ComponentTransform
*>(&oFrom
),
734 #ifdef OSG_MT_CPTR_ASPECT
735 FieldContainer
*ComponentTransformBase::createAspectCopy(
736 const FieldContainer
*pRefAspect
) const
738 ComponentTransform
*returnValue
;
740 newAspectCopy(returnValue
,
741 dynamic_cast<const ComponentTransform
*>(pRefAspect
),
742 dynamic_cast<const ComponentTransform
*>(this));
748 void ComponentTransformBase::resolveLinks(void)
750 Inherited::resolveLinks();