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 SkinnedGeometry!
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 "OSGSkeleton.h" // Skeleton Class
66 #include "OSGSkinningAlgorithm.h" // SkinningAlgorithm Class
68 #include "OSGSkinnedGeometryBase.h"
69 #include "OSGSkinnedGeometry.h"
71 #include <boost/bind.hpp>
75 /***************************************************************************\
77 \***************************************************************************/
79 /*! \class OSG::SkinnedGeometry
83 /***************************************************************************\
84 * Field Documentation *
85 \***************************************************************************/
87 /*! \var Skeleton * SkinnedGeometryBase::_sfSkeleton
88 The Skeleton that deforms this geometry.
91 /*! \var Matrix SkinnedGeometryBase::_sfBindShapeMatrix
92 Matrix that is applied to the vertices of the mesh before deformation.
93 It transforms the vertices into bind space.
96 /*! \var Int16 SkinnedGeometryBase::_mfJointIds
97 List of jointIds that are used by this SkinnedGeometry.
100 /*! \var UInt16 SkinnedGeometryBase::_sfJointIndexProperty
101 Index of the property that stores the joint indices that influence
105 /*! \var UInt16 SkinnedGeometryBase::_sfJointWeightProperty
106 Index of the property that stores the joint weights that influence
110 /*! \var UInt32 SkinnedGeometryBase::_sfRenderMode
111 Mode used to render this skinned geometry, one of the RenderModeE
112 enums values. Effectively selects the SkinningAlgorithm to use.
115 /*! \var SkinningAlgorithm * SkinnedGeometryBase::_sfSkinningAlgorithm
120 /***************************************************************************\
121 * FieldType/FieldTrait Instantiation *
122 \***************************************************************************/
124 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
125 PointerType FieldTraits
<SkinnedGeometry
*, nsOSG
>::_type(
126 "SkinnedGeometryPtr",
128 SkinnedGeometry::getClassType(),
132 OSG_FIELDTRAITS_GETTYPE_NS(SkinnedGeometry
*, nsOSG
)
134 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
138 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
142 DataType
&FieldTraits
<SkinnedGeometry
*, nsOSG
+ 1 >::getType(void)
144 return FieldTraits
<SkinnedGeometry
*, nsOSG
>::getType();
148 OSG_SFIELDTYPE_INST(ParentPointerSField
,
153 OSG_FIELD_DLLEXPORT_DEF3(ParentPointerSField
,
159 OSG_MFIELDTYPE_INST(ParentPointerMField
,
164 OSG_FIELD_DLLEXPORT_DEF3(ParentPointerMField
,
170 /***************************************************************************\
171 * Field Description *
172 \***************************************************************************/
174 void SkinnedGeometryBase::classDescInserter(TypeObject
&oType
)
176 FieldDescriptionBase
*pDesc
= NULL
;
179 pDesc
= new SFUnrecSkeletonPtr::Description(
180 SFUnrecSkeletonPtr::getClassType(),
182 "The Skeleton that deforms this geometry.\n",
183 SkeletonFieldId
, SkeletonFieldMask
,
185 (Field::SFDefaultFlags
| Field::FStdAccess
),
186 static_cast<FieldEditMethodSig
>(&SkinnedGeometry::editHandleSkeleton
),
187 static_cast<FieldGetMethodSig
>(&SkinnedGeometry::getHandleSkeleton
));
189 oType
.addInitialDesc(pDesc
);
191 pDesc
= new SFMatrix::Description(
192 SFMatrix::getClassType(),
194 "Matrix that is applied to the vertices of the mesh before deformation.\n"
195 "It transforms the vertices into bind space.\n",
196 BindShapeMatrixFieldId
, BindShapeMatrixFieldMask
,
198 (Field::SFDefaultFlags
| Field::FStdAccess
),
199 static_cast<FieldEditMethodSig
>(&SkinnedGeometry::editHandleBindShapeMatrix
),
200 static_cast<FieldGetMethodSig
>(&SkinnedGeometry::getHandleBindShapeMatrix
));
202 oType
.addInitialDesc(pDesc
);
204 pDesc
= new MFInt16::Description(
205 MFInt16::getClassType(),
207 "List of jointIds that are used by this SkinnedGeometry.\n",
208 JointIdsFieldId
, JointIdsFieldMask
,
210 (Field::MFDefaultFlags
| Field::FStdAccess
),
211 static_cast<FieldEditMethodSig
>(&SkinnedGeometry::editHandleJointIds
),
212 static_cast<FieldGetMethodSig
>(&SkinnedGeometry::getHandleJointIds
));
214 oType
.addInitialDesc(pDesc
);
216 pDesc
= new SFUInt16::Description(
217 SFUInt16::getClassType(),
218 "jointIndexProperty",
219 "Index of the property that stores the joint indices that influence\n"
221 JointIndexPropertyFieldId
, JointIndexPropertyFieldMask
,
223 (Field::SFDefaultFlags
| Field::FStdAccess
),
224 static_cast<FieldEditMethodSig
>(&SkinnedGeometry::editHandleJointIndexProperty
),
225 static_cast<FieldGetMethodSig
>(&SkinnedGeometry::getHandleJointIndexProperty
));
227 oType
.addInitialDesc(pDesc
);
229 pDesc
= new SFUInt16::Description(
230 SFUInt16::getClassType(),
231 "jointWeightProperty",
232 "Index of the property that stores the joint weights that influence\n"
234 JointWeightPropertyFieldId
, JointWeightPropertyFieldMask
,
236 (Field::SFDefaultFlags
| Field::FStdAccess
),
237 static_cast<FieldEditMethodSig
>(&SkinnedGeometry::editHandleJointWeightProperty
),
238 static_cast<FieldGetMethodSig
>(&SkinnedGeometry::getHandleJointWeightProperty
));
240 oType
.addInitialDesc(pDesc
);
242 pDesc
= new SFUInt32::Description(
243 SFUInt32::getClassType(),
245 "Mode used to render this skinned geometry, one of the RenderModeE\n"
246 "enums values. Effectively selects the SkinningAlgorithm to use.\n",
247 RenderModeFieldId
, RenderModeFieldMask
,
249 (Field::SFDefaultFlags
| Field::FStdAccess
),
250 static_cast<FieldEditMethodSig
>(&SkinnedGeometry::editHandleRenderMode
),
251 static_cast<FieldGetMethodSig
>(&SkinnedGeometry::getHandleRenderMode
));
253 oType
.addInitialDesc(pDesc
);
255 pDesc
= new SFUnrecChildSkinningAlgorithmPtr::Description(
256 SFUnrecChildSkinningAlgorithmPtr::getClassType(),
259 SkinningAlgorithmFieldId
, SkinningAlgorithmFieldMask
,
261 (Field::SFDefaultFlags
| Field::FStdAccess
),
262 static_cast<FieldEditMethodSig
>(&SkinnedGeometry::editHandleSkinningAlgorithm
),
263 static_cast<FieldGetMethodSig
>(&SkinnedGeometry::getHandleSkinningAlgorithm
));
265 oType
.addInitialDesc(pDesc
);
269 SkinnedGeometryBase::TypeObject
SkinnedGeometryBase::_type(
270 SkinnedGeometryBase::getClassname(),
271 Inherited::getClassname(),
274 reinterpret_cast<PrototypeCreateF
>(&SkinnedGeometryBase::createEmptyLocal
),
275 reinterpret_cast<InitContainerF
>(&SkinnedGeometry::initMethod
),
276 reinterpret_cast<ExitContainerF
>(&SkinnedGeometry::exitMethod
),
277 reinterpret_cast<InitalInsertDescFunc
>(
278 reinterpret_cast<void *>(&SkinnedGeometry::classDescInserter
)),
281 "<?xml version=\"1.0\"?>\n"
284 " name=\"SkinnedGeometry\"\n"
285 " parent=\"Geometry\"\n"
286 " library=\"Dynamics\"\n"
287 " pointerfieldtypes=\"both\"\n"
288 " structure=\"concrete\"\n"
289 " systemcomponent=\"true\"\n"
290 " parentsystemcomponent=\"true\"\n"
291 " decoratable=\"false\"\n"
292 " childFields=\"none\"\n"
293 " parentFields=\"both\"\n"
297 " name=\"skeleton\"\n"
298 " type=\"Skeleton\"\n"
299 " category=\"pointer\"\n"
300 " cardinality=\"single\"\n"
301 " visibility=\"external\"\n"
302 " access=\"public\"\n"
304 " The Skeleton that deforms this geometry.\n"
308 " name=\"bindShapeMatrix\"\n"
310 " category=\"data\"\n"
311 " cardinality=\"single\"\n"
312 " visibility=\"external\"\n"
313 " access=\"public\"\n"
315 " Matrix that is applied to the vertices of the mesh before deformation.\n"
316 " It transforms the vertices into bind space.\n"
320 " name=\"jointIds\"\n"
322 " category=\"data\"\n"
323 " cardinality=\"multi\"\n"
324 " visibility=\"external\"\n"
325 " access=\"public\"\n"
327 " List of jointIds that are used by this SkinnedGeometry.\n"
331 " name=\"jointIndexProperty\"\n"
333 " category=\"data\"\n"
334 " cardinality=\"single\"\n"
335 " visibility=\"external\"\n"
336 " access=\"public\"\n"
337 " defaultValue=\"TypeTraits<UInt16>::getMax()\"\n"
339 " Index of the property that stores the joint indices that influence\n"
344 " name=\"jointWeightProperty\"\n"
346 " category=\"data\"\n"
347 " cardinality=\"single\"\n"
348 " visibility=\"external\"\n"
349 " access=\"public\"\n"
350 " defaultValue=\"TypeTraits<UInt16>::getMax()\"\n"
352 " Index of the property that stores the joint weights that influence\n"
357 " name=\"renderMode\"\n"
359 " category=\"data\"\n"
360 " cardinality=\"single\"\n"
361 " visibility=\"external\"\n"
362 " access=\"public\"\n"
363 " defaultValue=\"0\"\n"
365 " Mode used to render this skinned geometry, one of the RenderModeE\n"
366 " enums values. Effectively selects the SkinningAlgorithm to use.\n"
370 " name=\"skinningAlgorithm\"\n"
371 " type=\"SkinningAlgorithm\"\n"
372 " category=\"childpointer\"\n"
373 " linkParentField=\"Skin\"\n"
374 " cardinality=\"single\"\n"
375 " visibility=\"external\"\n"
376 " access=\"protected\"\n"
377 " defaultValue=\"NULL\"\n"
381 "</FieldContainer>\n",
385 /*------------------------------ get -----------------------------------*/
387 FieldContainerType
&SkinnedGeometryBase::getType(void)
392 const FieldContainerType
&SkinnedGeometryBase::getType(void) const
397 UInt32
SkinnedGeometryBase::getContainerSize(void) const
399 return sizeof(SkinnedGeometry
);
402 /*------------------------- decorator get ------------------------------*/
405 //! Get the SkinnedGeometry::_sfSkeleton field.
406 const SFUnrecSkeletonPtr
*SkinnedGeometryBase::getSFSkeleton(void) const
411 SFUnrecSkeletonPtr
*SkinnedGeometryBase::editSFSkeleton (void)
413 editSField(SkeletonFieldMask
);
418 //! Get the value of the SkinnedGeometry::_sfSkeleton field.
419 Skeleton
* SkinnedGeometryBase::getSkeleton(void) const
421 return _sfSkeleton
.getValue();
424 //! Set the value of the SkinnedGeometry::_sfSkeleton field.
425 void SkinnedGeometryBase::setSkeleton(Skeleton
* const value
)
427 editSField(SkeletonFieldMask
);
429 _sfSkeleton
.setValue(value
);
433 SFMatrix
*SkinnedGeometryBase::editSFBindShapeMatrix(void)
435 editSField(BindShapeMatrixFieldMask
);
437 return &_sfBindShapeMatrix
;
440 const SFMatrix
*SkinnedGeometryBase::getSFBindShapeMatrix(void) const
442 return &_sfBindShapeMatrix
;
446 MFInt16
*SkinnedGeometryBase::editMFJointIds(void)
448 editMField(JointIdsFieldMask
, _mfJointIds
);
453 const MFInt16
*SkinnedGeometryBase::getMFJointIds(void) const
459 SFUInt16
*SkinnedGeometryBase::editSFJointIndexProperty(void)
461 editSField(JointIndexPropertyFieldMask
);
463 return &_sfJointIndexProperty
;
466 const SFUInt16
*SkinnedGeometryBase::getSFJointIndexProperty(void) const
468 return &_sfJointIndexProperty
;
472 SFUInt16
*SkinnedGeometryBase::editSFJointWeightProperty(void)
474 editSField(JointWeightPropertyFieldMask
);
476 return &_sfJointWeightProperty
;
479 const SFUInt16
*SkinnedGeometryBase::getSFJointWeightProperty(void) const
481 return &_sfJointWeightProperty
;
485 SFUInt32
*SkinnedGeometryBase::editSFRenderMode(void)
487 editSField(RenderModeFieldMask
);
489 return &_sfRenderMode
;
492 const SFUInt32
*SkinnedGeometryBase::getSFRenderMode(void) const
494 return &_sfRenderMode
;
498 //! Get the SkinnedGeometry::_sfSkinningAlgorithm field.
499 const SFUnrecChildSkinningAlgorithmPtr
*SkinnedGeometryBase::getSFSkinningAlgorithm(void) const
501 return &_sfSkinningAlgorithm
;
504 SFUnrecChildSkinningAlgorithmPtr
*SkinnedGeometryBase::editSFSkinningAlgorithm(void)
506 editSField(SkinningAlgorithmFieldMask
);
508 return &_sfSkinningAlgorithm
;
511 //! Get the value of the SkinnedGeometry::_sfSkinningAlgorithm field.
512 SkinningAlgorithm
* SkinnedGeometryBase::getSkinningAlgorithm(void) const
514 return _sfSkinningAlgorithm
.getValue();
517 //! Set the value of the SkinnedGeometry::_sfSkinningAlgorithm field.
518 void SkinnedGeometryBase::setSkinningAlgorithm(SkinningAlgorithm
* const value
)
520 editSField(SkinningAlgorithmFieldMask
);
522 _sfSkinningAlgorithm
.setValue(value
);
530 /*------------------------------ access -----------------------------------*/
532 SizeT
SkinnedGeometryBase::getBinSize(ConstFieldMaskArg whichField
)
534 SizeT returnValue
= Inherited::getBinSize(whichField
);
536 if(FieldBits::NoField
!= (SkeletonFieldMask
& whichField
))
538 returnValue
+= _sfSkeleton
.getBinSize();
540 if(FieldBits::NoField
!= (BindShapeMatrixFieldMask
& whichField
))
542 returnValue
+= _sfBindShapeMatrix
.getBinSize();
544 if(FieldBits::NoField
!= (JointIdsFieldMask
& whichField
))
546 returnValue
+= _mfJointIds
.getBinSize();
548 if(FieldBits::NoField
!= (JointIndexPropertyFieldMask
& whichField
))
550 returnValue
+= _sfJointIndexProperty
.getBinSize();
552 if(FieldBits::NoField
!= (JointWeightPropertyFieldMask
& whichField
))
554 returnValue
+= _sfJointWeightProperty
.getBinSize();
556 if(FieldBits::NoField
!= (RenderModeFieldMask
& whichField
))
558 returnValue
+= _sfRenderMode
.getBinSize();
560 if(FieldBits::NoField
!= (SkinningAlgorithmFieldMask
& whichField
))
562 returnValue
+= _sfSkinningAlgorithm
.getBinSize();
568 void SkinnedGeometryBase::copyToBin(BinaryDataHandler
&pMem
,
569 ConstFieldMaskArg whichField
)
571 Inherited::copyToBin(pMem
, whichField
);
573 if(FieldBits::NoField
!= (SkeletonFieldMask
& whichField
))
575 _sfSkeleton
.copyToBin(pMem
);
577 if(FieldBits::NoField
!= (BindShapeMatrixFieldMask
& whichField
))
579 _sfBindShapeMatrix
.copyToBin(pMem
);
581 if(FieldBits::NoField
!= (JointIdsFieldMask
& whichField
))
583 _mfJointIds
.copyToBin(pMem
);
585 if(FieldBits::NoField
!= (JointIndexPropertyFieldMask
& whichField
))
587 _sfJointIndexProperty
.copyToBin(pMem
);
589 if(FieldBits::NoField
!= (JointWeightPropertyFieldMask
& whichField
))
591 _sfJointWeightProperty
.copyToBin(pMem
);
593 if(FieldBits::NoField
!= (RenderModeFieldMask
& whichField
))
595 _sfRenderMode
.copyToBin(pMem
);
597 if(FieldBits::NoField
!= (SkinningAlgorithmFieldMask
& whichField
))
599 _sfSkinningAlgorithm
.copyToBin(pMem
);
603 void SkinnedGeometryBase::copyFromBin(BinaryDataHandler
&pMem
,
604 ConstFieldMaskArg whichField
)
606 Inherited::copyFromBin(pMem
, whichField
);
608 if(FieldBits::NoField
!= (SkeletonFieldMask
& whichField
))
610 editSField(SkeletonFieldMask
);
611 _sfSkeleton
.copyFromBin(pMem
);
613 if(FieldBits::NoField
!= (BindShapeMatrixFieldMask
& whichField
))
615 editSField(BindShapeMatrixFieldMask
);
616 _sfBindShapeMatrix
.copyFromBin(pMem
);
618 if(FieldBits::NoField
!= (JointIdsFieldMask
& whichField
))
620 editMField(JointIdsFieldMask
, _mfJointIds
);
621 _mfJointIds
.copyFromBin(pMem
);
623 if(FieldBits::NoField
!= (JointIndexPropertyFieldMask
& whichField
))
625 editSField(JointIndexPropertyFieldMask
);
626 _sfJointIndexProperty
.copyFromBin(pMem
);
628 if(FieldBits::NoField
!= (JointWeightPropertyFieldMask
& whichField
))
630 editSField(JointWeightPropertyFieldMask
);
631 _sfJointWeightProperty
.copyFromBin(pMem
);
633 if(FieldBits::NoField
!= (RenderModeFieldMask
& whichField
))
635 editSField(RenderModeFieldMask
);
636 _sfRenderMode
.copyFromBin(pMem
);
638 if(FieldBits::NoField
!= (SkinningAlgorithmFieldMask
& whichField
))
640 editSField(SkinningAlgorithmFieldMask
);
641 _sfSkinningAlgorithm
.copyFromBin(pMem
);
645 //! create a new instance of the class
646 SkinnedGeometryTransitPtr
SkinnedGeometryBase::createLocal(BitVector bFlags
)
648 SkinnedGeometryTransitPtr fc
;
650 if(getClassType().getPrototype() != NULL
)
652 FieldContainerTransitPtr tmpPtr
=
653 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
655 fc
= dynamic_pointer_cast
<SkinnedGeometry
>(tmpPtr
);
661 //! create a new instance of the class, copy the container flags
662 SkinnedGeometryTransitPtr
SkinnedGeometryBase::createDependent(BitVector bFlags
)
664 SkinnedGeometryTransitPtr fc
;
666 if(getClassType().getPrototype() != NULL
)
668 FieldContainerTransitPtr tmpPtr
=
669 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
671 fc
= dynamic_pointer_cast
<SkinnedGeometry
>(tmpPtr
);
677 //! create a new instance of the class
678 SkinnedGeometryTransitPtr
SkinnedGeometryBase::create(void)
680 SkinnedGeometryTransitPtr fc
;
682 if(getClassType().getPrototype() != NULL
)
684 FieldContainerTransitPtr tmpPtr
=
685 getClassType().getPrototype()-> shallowCopy();
687 fc
= dynamic_pointer_cast
<SkinnedGeometry
>(tmpPtr
);
693 SkinnedGeometry
*SkinnedGeometryBase::createEmptyLocal(BitVector bFlags
)
695 SkinnedGeometry
*returnValue
;
697 newPtr
<SkinnedGeometry
>(returnValue
, bFlags
);
699 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
704 //! create an empty new instance of the class, do not copy the prototype
705 SkinnedGeometry
*SkinnedGeometryBase::createEmpty(void)
707 SkinnedGeometry
*returnValue
;
709 newPtr
<SkinnedGeometry
>(returnValue
, Thread::getCurrentLocalFlags());
711 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
712 ~Thread::getCurrentLocalFlags();
718 FieldContainerTransitPtr
SkinnedGeometryBase::shallowCopyLocal(
719 BitVector bFlags
) const
721 SkinnedGeometry
*tmpPtr
;
723 newPtr(tmpPtr
, dynamic_cast<const SkinnedGeometry
*>(this), bFlags
);
725 FieldContainerTransitPtr
returnValue(tmpPtr
);
727 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
732 FieldContainerTransitPtr
SkinnedGeometryBase::shallowCopyDependent(
733 BitVector bFlags
) const
735 SkinnedGeometry
*tmpPtr
;
737 newPtr(tmpPtr
, dynamic_cast<const SkinnedGeometry
*>(this), ~bFlags
);
739 FieldContainerTransitPtr
returnValue(tmpPtr
);
741 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
746 FieldContainerTransitPtr
SkinnedGeometryBase::shallowCopy(void) const
748 SkinnedGeometry
*tmpPtr
;
751 dynamic_cast<const SkinnedGeometry
*>(this),
752 Thread::getCurrentLocalFlags());
754 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
756 FieldContainerTransitPtr
returnValue(tmpPtr
);
764 /*------------------------- constructors ----------------------------------*/
766 SkinnedGeometryBase::SkinnedGeometryBase(void) :
769 _sfBindShapeMatrix (),
771 _sfJointIndexProperty (UInt16(TypeTraits
<UInt16
>::getMax())),
772 _sfJointWeightProperty (UInt16(TypeTraits
<UInt16
>::getMax())),
773 _sfRenderMode (UInt32(0)),
774 _sfSkinningAlgorithm (this,
775 SkinningAlgorithmFieldId
,
776 SkinningAlgorithm::SkinFieldId
)
780 SkinnedGeometryBase::SkinnedGeometryBase(const SkinnedGeometryBase
&source
) :
783 _sfBindShapeMatrix (source
._sfBindShapeMatrix
),
784 _mfJointIds (source
._mfJointIds
),
785 _sfJointIndexProperty (source
._sfJointIndexProperty
),
786 _sfJointWeightProperty (source
._sfJointWeightProperty
),
787 _sfRenderMode (source
._sfRenderMode
),
788 _sfSkinningAlgorithm (this,
789 SkinningAlgorithmFieldId
,
790 SkinningAlgorithm::SkinFieldId
)
795 /*-------------------------- destructors ----------------------------------*/
797 SkinnedGeometryBase::~SkinnedGeometryBase(void)
801 /*-------------------------------------------------------------------------*/
804 bool SkinnedGeometryBase::unlinkChild(
805 FieldContainer
* const pChild
,
806 UInt16
const childFieldId
)
808 if(childFieldId
== SkinningAlgorithmFieldId
)
810 SkinningAlgorithm
* pTypedChild
=
811 dynamic_cast<SkinningAlgorithm
*>(pChild
);
813 if(pTypedChild
!= NULL
)
815 if(_sfSkinningAlgorithm
.getValue() == pTypedChild
)
817 editSField(SkinningAlgorithmFieldMask
);
819 _sfSkinningAlgorithm
.setValue(NULL
);
824 SWARNING
<< "Parent ([" << this
825 << "] id [" << this->getId()
826 << "] type [" << this->getType().getCName()
827 << "] childFieldId [" << childFieldId
828 << "]) - Child ([" << pChild
829 << "] id [" << pChild
->getId()
830 << "] type [" << pChild
->getType().getCName()
831 << "]): link inconsistent!"
841 return Inherited::unlinkChild(pChild
, childFieldId
);
844 void SkinnedGeometryBase::onCreate(const SkinnedGeometry
*source
)
846 Inherited::onCreate(source
);
850 SkinnedGeometry
*pThis
= static_cast<SkinnedGeometry
*>(this);
852 pThis
->setSkeleton(source
->getSkeleton());
854 pThis
->setSkinningAlgorithm(source
->getSkinningAlgorithm());
858 GetFieldHandlePtr
SkinnedGeometryBase::getHandleSkeleton (void) const
860 SFUnrecSkeletonPtr::GetHandlePtr
returnValue(
861 new SFUnrecSkeletonPtr::GetHandle(
863 this->getType().getFieldDesc(SkeletonFieldId
),
864 const_cast<SkinnedGeometryBase
*>(this)));
869 EditFieldHandlePtr
SkinnedGeometryBase::editHandleSkeleton (void)
871 SFUnrecSkeletonPtr::EditHandlePtr
returnValue(
872 new SFUnrecSkeletonPtr::EditHandle(
874 this->getType().getFieldDesc(SkeletonFieldId
),
877 returnValue
->setSetMethod(
878 boost::bind(&SkinnedGeometry::setSkeleton
,
879 static_cast<SkinnedGeometry
*>(this), _1
));
881 editSField(SkeletonFieldMask
);
886 GetFieldHandlePtr
SkinnedGeometryBase::getHandleBindShapeMatrix (void) const
888 SFMatrix::GetHandlePtr
returnValue(
889 new SFMatrix::GetHandle(
891 this->getType().getFieldDesc(BindShapeMatrixFieldId
),
892 const_cast<SkinnedGeometryBase
*>(this)));
897 EditFieldHandlePtr
SkinnedGeometryBase::editHandleBindShapeMatrix(void)
899 SFMatrix::EditHandlePtr
returnValue(
900 new SFMatrix::EditHandle(
902 this->getType().getFieldDesc(BindShapeMatrixFieldId
),
906 editSField(BindShapeMatrixFieldMask
);
911 GetFieldHandlePtr
SkinnedGeometryBase::getHandleJointIds (void) const
913 MFInt16::GetHandlePtr
returnValue(
914 new MFInt16::GetHandle(
916 this->getType().getFieldDesc(JointIdsFieldId
),
917 const_cast<SkinnedGeometryBase
*>(this)));
922 EditFieldHandlePtr
SkinnedGeometryBase::editHandleJointIds (void)
924 MFInt16::EditHandlePtr
returnValue(
925 new MFInt16::EditHandle(
927 this->getType().getFieldDesc(JointIdsFieldId
),
931 editMField(JointIdsFieldMask
, _mfJointIds
);
936 GetFieldHandlePtr
SkinnedGeometryBase::getHandleJointIndexProperty (void) const
938 SFUInt16::GetHandlePtr
returnValue(
939 new SFUInt16::GetHandle(
940 &_sfJointIndexProperty
,
941 this->getType().getFieldDesc(JointIndexPropertyFieldId
),
942 const_cast<SkinnedGeometryBase
*>(this)));
947 EditFieldHandlePtr
SkinnedGeometryBase::editHandleJointIndexProperty(void)
949 SFUInt16::EditHandlePtr
returnValue(
950 new SFUInt16::EditHandle(
951 &_sfJointIndexProperty
,
952 this->getType().getFieldDesc(JointIndexPropertyFieldId
),
956 editSField(JointIndexPropertyFieldMask
);
961 GetFieldHandlePtr
SkinnedGeometryBase::getHandleJointWeightProperty (void) const
963 SFUInt16::GetHandlePtr
returnValue(
964 new SFUInt16::GetHandle(
965 &_sfJointWeightProperty
,
966 this->getType().getFieldDesc(JointWeightPropertyFieldId
),
967 const_cast<SkinnedGeometryBase
*>(this)));
972 EditFieldHandlePtr
SkinnedGeometryBase::editHandleJointWeightProperty(void)
974 SFUInt16::EditHandlePtr
returnValue(
975 new SFUInt16::EditHandle(
976 &_sfJointWeightProperty
,
977 this->getType().getFieldDesc(JointWeightPropertyFieldId
),
981 editSField(JointWeightPropertyFieldMask
);
986 GetFieldHandlePtr
SkinnedGeometryBase::getHandleRenderMode (void) const
988 SFUInt32::GetHandlePtr
returnValue(
989 new SFUInt32::GetHandle(
991 this->getType().getFieldDesc(RenderModeFieldId
),
992 const_cast<SkinnedGeometryBase
*>(this)));
997 EditFieldHandlePtr
SkinnedGeometryBase::editHandleRenderMode (void)
999 SFUInt32::EditHandlePtr
returnValue(
1000 new SFUInt32::EditHandle(
1002 this->getType().getFieldDesc(RenderModeFieldId
),
1006 editSField(RenderModeFieldMask
);
1011 GetFieldHandlePtr
SkinnedGeometryBase::getHandleSkinningAlgorithm (void) const
1013 SFUnrecChildSkinningAlgorithmPtr::GetHandlePtr
returnValue(
1014 new SFUnrecChildSkinningAlgorithmPtr::GetHandle(
1015 &_sfSkinningAlgorithm
,
1016 this->getType().getFieldDesc(SkinningAlgorithmFieldId
),
1017 const_cast<SkinnedGeometryBase
*>(this)));
1022 EditFieldHandlePtr
SkinnedGeometryBase::editHandleSkinningAlgorithm(void)
1024 SFUnrecChildSkinningAlgorithmPtr::EditHandlePtr
returnValue(
1025 new SFUnrecChildSkinningAlgorithmPtr::EditHandle(
1026 &_sfSkinningAlgorithm
,
1027 this->getType().getFieldDesc(SkinningAlgorithmFieldId
),
1030 returnValue
->setSetMethod(
1031 boost::bind(&SkinnedGeometry::setSkinningAlgorithm
,
1032 static_cast<SkinnedGeometry
*>(this), _1
));
1034 editSField(SkinningAlgorithmFieldMask
);
1040 #ifdef OSG_MT_CPTR_ASPECT
1041 void SkinnedGeometryBase::execSyncV( FieldContainer
&oFrom
,
1042 ConstFieldMaskArg whichField
,
1043 AspectOffsetStore
&oOffsets
,
1044 ConstFieldMaskArg syncMode
,
1045 const UInt32 uiSyncInfo
)
1047 SkinnedGeometry
*pThis
= static_cast<SkinnedGeometry
*>(this);
1049 pThis
->execSync(static_cast<SkinnedGeometry
*>(&oFrom
),
1058 #ifdef OSG_MT_CPTR_ASPECT
1059 FieldContainer
*SkinnedGeometryBase::createAspectCopy(
1060 const FieldContainer
*pRefAspect
) const
1062 SkinnedGeometry
*returnValue
;
1064 newAspectCopy(returnValue
,
1065 dynamic_cast<const SkinnedGeometry
*>(pRefAspect
),
1066 dynamic_cast<const SkinnedGeometry
*>(this));
1072 void SkinnedGeometryBase::resolveLinks(void)
1074 Inherited::resolveLinks();
1076 static_cast<SkinnedGeometry
*>(this)->setSkeleton(NULL
);
1078 static_cast<SkinnedGeometry
*>(this)->setSkinningAlgorithm(NULL
);
1080 #ifdef OSG_MT_CPTR_ASPECT
1081 AspectOffsetStore oOffsets
;
1083 _pAspectStore
->fillOffsetArray(oOffsets
, this);
1086 #ifdef OSG_MT_CPTR_ASPECT
1087 _mfJointIds
.terminateShare(Thread::getCurrentAspect(),