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 SkeletonJoint!
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 "OSGSkeletonJointBase.h"
67 #include "OSGSkeletonJoint.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::SkeletonJoint
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Matrix SkeletonJointBase::_sfInvBindMatrix
86 Inverse of the bind matrix for this joint.
89 /*! \var Matrix SkeletonJointBase::_sfMatrix
90 Transformation matrix of this joint.
93 /*! \var Matrix SkeletonJointBase::_sfOffsetMatrix
94 Transformation matrix of this joint.
98 /***************************************************************************\
99 * FieldType/FieldTrait Instantiation *
100 \***************************************************************************/
102 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
103 PointerType FieldTraits
<SkeletonJoint
*, nsOSG
>::_type(
105 "BaseSkeletonJointPtr",
106 SkeletonJoint::getClassType(),
110 OSG_FIELDTRAITS_GETTYPE_NS(SkeletonJoint
*, nsOSG
)
112 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
116 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
120 DataType
&FieldTraits
< SkeletonJoint
*, nsOSG
+ 1 >::getType(void)
122 return FieldTraits
<SkeletonJoint
*, nsOSG
>::getType();
126 OSG_EXPORT_PTR_SFIELD(ChildPointerSField
,
128 UnrecordedRefCountPolicy
,
132 OSG_EXPORT_PTR_MFIELD(ChildPointerMField
,
134 UnrecordedRefCountPolicy
,
138 DataType
&FieldTraits
<SkeletonJoint
*, nsOSG
+ 2 >::getType(void)
140 return FieldTraits
<SkeletonJoint
*, nsOSG
>::getType();
144 OSG_SFIELDTYPE_INST(ParentPointerSField
,
149 OSG_FIELD_DLLEXPORT_DEF3(ParentPointerSField
,
155 OSG_MFIELDTYPE_INST(ParentPointerMField
,
160 OSG_FIELD_DLLEXPORT_DEF3(ParentPointerMField
,
166 /***************************************************************************\
167 * Field Description *
168 \***************************************************************************/
170 void SkeletonJointBase::classDescInserter(TypeObject
&oType
)
172 FieldDescriptionBase
*pDesc
= NULL
;
175 pDesc
= new SFMatrix::Description(
176 SFMatrix::getClassType(),
178 "Inverse of the bind matrix for this joint.\n",
179 InvBindMatrixFieldId
, InvBindMatrixFieldMask
,
181 (Field::SFDefaultFlags
| Field::FStdAccess
),
182 static_cast<FieldEditMethodSig
>(&SkeletonJoint::editHandleInvBindMatrix
),
183 static_cast<FieldGetMethodSig
>(&SkeletonJoint::getHandleInvBindMatrix
));
185 oType
.addInitialDesc(pDesc
);
187 pDesc
= new SFMatrix::Description(
188 SFMatrix::getClassType(),
190 "Transformation matrix of this joint.\n",
191 MatrixFieldId
, MatrixFieldMask
,
193 (Field::SFDefaultFlags
| Field::FStdAccess
),
194 static_cast<FieldEditMethodSig
>(&SkeletonJoint::editHandleMatrix
),
195 static_cast<FieldGetMethodSig
>(&SkeletonJoint::getHandleMatrix
));
197 oType
.addInitialDesc(pDesc
);
199 pDesc
= new SFMatrix::Description(
200 SFMatrix::getClassType(),
202 "Transformation matrix of this joint.\n",
203 OffsetMatrixFieldId
, OffsetMatrixFieldMask
,
205 (Field::SFDefaultFlags
| Field::FStdAccess
),
206 static_cast<FieldEditMethodSig
>(&SkeletonJoint::editHandleOffsetMatrix
),
207 static_cast<FieldGetMethodSig
>(&SkeletonJoint::getHandleOffsetMatrix
));
209 oType
.addInitialDesc(pDesc
);
213 SkeletonJointBase::TypeObject
SkeletonJointBase::_type(
214 SkeletonJointBase::getClassname(),
215 Inherited::getClassname(),
218 reinterpret_cast<PrototypeCreateF
>(&SkeletonJointBase::createEmptyLocal
),
219 reinterpret_cast<InitContainerF
>(&SkeletonJoint::initMethod
),
220 reinterpret_cast<ExitContainerF
>(&SkeletonJoint::exitMethod
),
221 reinterpret_cast<InitalInsertDescFunc
>(
222 reinterpret_cast<void *>(&SkeletonJoint::classDescInserter
)),
225 "<?xml version=\"1.0\"?>\n"
228 " name=\"SkeletonJoint\"\n"
229 " parent=\"BaseSkeletonJoint\"\n"
230 " library=\"Dynamics\"\n"
231 " pointerfieldtypes=\"both\"\n"
232 " structure=\"concrete\"\n"
233 " systemcomponent=\"true\"\n"
234 " parentsystemcomponent=\"true\"\n"
235 " decoratable=\"false\"\n"
236 " isNodeCore=\"false\"\n"
237 " childFields=\"both\"\n"
238 " parentFields=\"both\"\n"
241 " name=\"invBindMatrix\"\n"
243 " category=\"data\"\n"
244 " cardinality=\"single\"\n"
245 " visibility=\"external\"\n"
246 " access=\"public\"\n"
248 " Inverse of the bind matrix for this joint.\n"
254 " category=\"data\"\n"
255 " cardinality=\"single\"\n"
256 " visibility=\"external\"\n"
257 " access=\"public\"\n"
259 " Transformation matrix of this joint.\n"
263 " name=\"offsetMatrix\"\n"
265 " category=\"data\"\n"
266 " cardinality=\"single\"\n"
267 " visibility=\"external\"\n"
268 " access=\"public\"\n"
270 " Transformation matrix of this joint.\n"
273 "</FieldContainer>\n",
277 /*------------------------------ get -----------------------------------*/
279 FieldContainerType
&SkeletonJointBase::getType(void)
284 const FieldContainerType
&SkeletonJointBase::getType(void) const
289 UInt32
SkeletonJointBase::getContainerSize(void) const
291 return sizeof(SkeletonJoint
);
294 /*------------------------- decorator get ------------------------------*/
297 SFMatrix
*SkeletonJointBase::editSFInvBindMatrix(void)
299 editSField(InvBindMatrixFieldMask
);
301 return &_sfInvBindMatrix
;
304 const SFMatrix
*SkeletonJointBase::getSFInvBindMatrix(void) const
306 return &_sfInvBindMatrix
;
310 SFMatrix
*SkeletonJointBase::editSFMatrix(void)
312 editSField(MatrixFieldMask
);
317 const SFMatrix
*SkeletonJointBase::getSFMatrix(void) const
323 SFMatrix
*SkeletonJointBase::editSFOffsetMatrix(void)
325 editSField(OffsetMatrixFieldMask
);
327 return &_sfOffsetMatrix
;
330 const SFMatrix
*SkeletonJointBase::getSFOffsetMatrix(void) const
332 return &_sfOffsetMatrix
;
340 /*------------------------------ access -----------------------------------*/
342 SizeT
SkeletonJointBase::getBinSize(ConstFieldMaskArg whichField
)
344 SizeT returnValue
= Inherited::getBinSize(whichField
);
346 if(FieldBits::NoField
!= (InvBindMatrixFieldMask
& whichField
))
348 returnValue
+= _sfInvBindMatrix
.getBinSize();
350 if(FieldBits::NoField
!= (MatrixFieldMask
& whichField
))
352 returnValue
+= _sfMatrix
.getBinSize();
354 if(FieldBits::NoField
!= (OffsetMatrixFieldMask
& whichField
))
356 returnValue
+= _sfOffsetMatrix
.getBinSize();
362 void SkeletonJointBase::copyToBin(BinaryDataHandler
&pMem
,
363 ConstFieldMaskArg whichField
)
365 Inherited::copyToBin(pMem
, whichField
);
367 if(FieldBits::NoField
!= (InvBindMatrixFieldMask
& whichField
))
369 _sfInvBindMatrix
.copyToBin(pMem
);
371 if(FieldBits::NoField
!= (MatrixFieldMask
& whichField
))
373 _sfMatrix
.copyToBin(pMem
);
375 if(FieldBits::NoField
!= (OffsetMatrixFieldMask
& whichField
))
377 _sfOffsetMatrix
.copyToBin(pMem
);
381 void SkeletonJointBase::copyFromBin(BinaryDataHandler
&pMem
,
382 ConstFieldMaskArg whichField
)
384 Inherited::copyFromBin(pMem
, whichField
);
386 if(FieldBits::NoField
!= (InvBindMatrixFieldMask
& whichField
))
388 editSField(InvBindMatrixFieldMask
);
389 _sfInvBindMatrix
.copyFromBin(pMem
);
391 if(FieldBits::NoField
!= (MatrixFieldMask
& whichField
))
393 editSField(MatrixFieldMask
);
394 _sfMatrix
.copyFromBin(pMem
);
396 if(FieldBits::NoField
!= (OffsetMatrixFieldMask
& whichField
))
398 editSField(OffsetMatrixFieldMask
);
399 _sfOffsetMatrix
.copyFromBin(pMem
);
403 //! create a new instance of the class
404 SkeletonJointTransitPtr
SkeletonJointBase::createLocal(BitVector bFlags
)
406 SkeletonJointTransitPtr fc
;
408 if(getClassType().getPrototype() != NULL
)
410 FieldContainerTransitPtr tmpPtr
=
411 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
413 fc
= dynamic_pointer_cast
<SkeletonJoint
>(tmpPtr
);
419 //! create a new instance of the class, copy the container flags
420 SkeletonJointTransitPtr
SkeletonJointBase::createDependent(BitVector bFlags
)
422 SkeletonJointTransitPtr fc
;
424 if(getClassType().getPrototype() != NULL
)
426 FieldContainerTransitPtr tmpPtr
=
427 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
429 fc
= dynamic_pointer_cast
<SkeletonJoint
>(tmpPtr
);
435 //! create a new instance of the class
436 SkeletonJointTransitPtr
SkeletonJointBase::create(void)
438 SkeletonJointTransitPtr fc
;
440 if(getClassType().getPrototype() != NULL
)
442 FieldContainerTransitPtr tmpPtr
=
443 getClassType().getPrototype()-> shallowCopy();
445 fc
= dynamic_pointer_cast
<SkeletonJoint
>(tmpPtr
);
451 SkeletonJoint
*SkeletonJointBase::createEmptyLocal(BitVector bFlags
)
453 SkeletonJoint
*returnValue
;
455 newPtr
<SkeletonJoint
>(returnValue
, bFlags
);
457 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
462 //! create an empty new instance of the class, do not copy the prototype
463 SkeletonJoint
*SkeletonJointBase::createEmpty(void)
465 SkeletonJoint
*returnValue
;
467 newPtr
<SkeletonJoint
>(returnValue
, Thread::getCurrentLocalFlags());
469 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
470 ~Thread::getCurrentLocalFlags();
476 FieldContainerTransitPtr
SkeletonJointBase::shallowCopyLocal(
477 BitVector bFlags
) const
479 SkeletonJoint
*tmpPtr
;
481 newPtr(tmpPtr
, dynamic_cast<const SkeletonJoint
*>(this), bFlags
);
483 FieldContainerTransitPtr
returnValue(tmpPtr
);
485 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
490 FieldContainerTransitPtr
SkeletonJointBase::shallowCopyDependent(
491 BitVector bFlags
) const
493 SkeletonJoint
*tmpPtr
;
495 newPtr(tmpPtr
, dynamic_cast<const SkeletonJoint
*>(this), ~bFlags
);
497 FieldContainerTransitPtr
returnValue(tmpPtr
);
499 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
504 FieldContainerTransitPtr
SkeletonJointBase::shallowCopy(void) const
506 SkeletonJoint
*tmpPtr
;
509 dynamic_cast<const SkeletonJoint
*>(this),
510 Thread::getCurrentLocalFlags());
512 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
514 FieldContainerTransitPtr
returnValue(tmpPtr
);
522 /*------------------------- constructors ----------------------------------*/
524 SkeletonJointBase::SkeletonJointBase(void) :
532 SkeletonJointBase::SkeletonJointBase(const SkeletonJointBase
&source
) :
534 _sfInvBindMatrix (source
._sfInvBindMatrix
),
535 _sfMatrix (source
._sfMatrix
),
536 _sfOffsetMatrix (source
._sfOffsetMatrix
)
541 /*-------------------------- destructors ----------------------------------*/
543 SkeletonJointBase::~SkeletonJointBase(void)
548 GetFieldHandlePtr
SkeletonJointBase::getHandleInvBindMatrix (void) const
550 SFMatrix::GetHandlePtr
returnValue(
551 new SFMatrix::GetHandle(
553 this->getType().getFieldDesc(InvBindMatrixFieldId
),
554 const_cast<SkeletonJointBase
*>(this)));
559 EditFieldHandlePtr
SkeletonJointBase::editHandleInvBindMatrix (void)
561 SFMatrix::EditHandlePtr
returnValue(
562 new SFMatrix::EditHandle(
564 this->getType().getFieldDesc(InvBindMatrixFieldId
),
568 editSField(InvBindMatrixFieldMask
);
573 GetFieldHandlePtr
SkeletonJointBase::getHandleMatrix (void) const
575 SFMatrix::GetHandlePtr
returnValue(
576 new SFMatrix::GetHandle(
578 this->getType().getFieldDesc(MatrixFieldId
),
579 const_cast<SkeletonJointBase
*>(this)));
584 EditFieldHandlePtr
SkeletonJointBase::editHandleMatrix (void)
586 SFMatrix::EditHandlePtr
returnValue(
587 new SFMatrix::EditHandle(
589 this->getType().getFieldDesc(MatrixFieldId
),
593 editSField(MatrixFieldMask
);
598 GetFieldHandlePtr
SkeletonJointBase::getHandleOffsetMatrix (void) const
600 SFMatrix::GetHandlePtr
returnValue(
601 new SFMatrix::GetHandle(
603 this->getType().getFieldDesc(OffsetMatrixFieldId
),
604 const_cast<SkeletonJointBase
*>(this)));
609 EditFieldHandlePtr
SkeletonJointBase::editHandleOffsetMatrix (void)
611 SFMatrix::EditHandlePtr
returnValue(
612 new SFMatrix::EditHandle(
614 this->getType().getFieldDesc(OffsetMatrixFieldId
),
618 editSField(OffsetMatrixFieldMask
);
624 #ifdef OSG_MT_CPTR_ASPECT
625 void SkeletonJointBase::execSyncV( FieldContainer
&oFrom
,
626 ConstFieldMaskArg whichField
,
627 AspectOffsetStore
&oOffsets
,
628 ConstFieldMaskArg syncMode
,
629 const UInt32 uiSyncInfo
)
631 SkeletonJoint
*pThis
= static_cast<SkeletonJoint
*>(this);
633 pThis
->execSync(static_cast<SkeletonJoint
*>(&oFrom
),
642 #ifdef OSG_MT_CPTR_ASPECT
643 FieldContainer
*SkeletonJointBase::createAspectCopy(
644 const FieldContainer
*pRefAspect
) const
646 SkeletonJoint
*returnValue
;
648 newAspectCopy(returnValue
,
649 dynamic_cast<const SkeletonJoint
*>(pRefAspect
),
650 dynamic_cast<const SkeletonJoint
*>(this));
656 void SkeletonJointBase::resolveLinks(void)
658 Inherited::resolveLinks();