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 \*****************************************************************************/
54 #ifndef _OSGSKELETONBASE_H_
55 #define _OSGSKELETONBASE_H_
61 #include "OSGConfig.h"
62 #include "OSGDynamicsDef.h"
64 //#include "OSGBaseTypes.h"
66 #include "OSGAttachmentContainer.h" // Parent
68 #include "OSGNodeFields.h" // Roots type
69 #include "OSGBaseSkeletonJointFields.h" // Joints type
70 #include "OSGMathFields.h" // JointMatrices type
71 #include "OSGSysFields.h" // UseInvBindMatrix type
72 #include "OSGOSGAnyFields.h" // JointsChanged type
74 #include "OSGSkeletonFields.h"
76 #include "OSGSkeletonParent.h"
83 //! \brief Skeleton Base Class.
85 class OSG_DYNAMICS_DLLMAPPING SkeletonBase
: public SkeletonParent
89 typedef SkeletonParent Inherited
;
90 typedef AttachmentContainer ParentContainer
;
92 typedef Inherited::TypeObject TypeObject
;
93 typedef TypeObject::InitPhase InitPhase
;
95 OSG_GEN_INTERNALPTR(Skeleton
);
97 /*========================== PUBLIC =================================*/
103 RootsFieldId
= Inherited::NextFieldId
,
104 JointsFieldId
= RootsFieldId
+ 1,
105 ParentJointsFieldId
= JointsFieldId
+ 1,
106 JointMatricesFieldId
= ParentJointsFieldId
+ 1,
107 JointNormalMatricesFieldId
= JointMatricesFieldId
+ 1,
108 UseInvBindMatrixFieldId
= JointNormalMatricesFieldId
+ 1,
109 CalcNormalMatricesFieldId
= UseInvBindMatrixFieldId
+ 1,
110 JointsChangedFieldId
= CalcNormalMatricesFieldId
+ 1,
111 NextFieldId
= JointsChangedFieldId
+ 1
114 static const OSG::BitVector RootsFieldMask
=
115 (TypeTraits
<BitVector
>::One
<< RootsFieldId
);
116 static const OSG::BitVector JointsFieldMask
=
117 (TypeTraits
<BitVector
>::One
<< JointsFieldId
);
118 static const OSG::BitVector ParentJointsFieldMask
=
119 (TypeTraits
<BitVector
>::One
<< ParentJointsFieldId
);
120 static const OSG::BitVector JointMatricesFieldMask
=
121 (TypeTraits
<BitVector
>::One
<< JointMatricesFieldId
);
122 static const OSG::BitVector JointNormalMatricesFieldMask
=
123 (TypeTraits
<BitVector
>::One
<< JointNormalMatricesFieldId
);
124 static const OSG::BitVector UseInvBindMatrixFieldMask
=
125 (TypeTraits
<BitVector
>::One
<< UseInvBindMatrixFieldId
);
126 static const OSG::BitVector CalcNormalMatricesFieldMask
=
127 (TypeTraits
<BitVector
>::One
<< CalcNormalMatricesFieldId
);
128 static const OSG::BitVector JointsChangedFieldMask
=
129 (TypeTraits
<BitVector
>::One
<< JointsChangedFieldId
);
130 static const OSG::BitVector NextFieldMask
=
131 (TypeTraits
<BitVector
>::One
<< NextFieldId
);
133 typedef MFUnrecNodePtr MFRootsType
;
134 typedef MFUnrecChildBaseSkeletonJointPtr MFJointsType
;
135 typedef MFUnrecBaseSkeletonJointPtr MFParentJointsType
;
136 typedef MFMatrix MFJointMatricesType
;
137 typedef MFMatrix MFJointNormalMatricesType
;
138 typedef SFBool SFUseInvBindMatrixType
;
139 typedef SFBool SFCalcNormalMatricesType
;
140 typedef SFOSGAny SFJointsChangedType
;
142 /*---------------------------------------------------------------------*/
143 /*! \name Class Get */
146 static FieldContainerType
&getClassType (void);
147 static UInt32
getClassTypeId (void);
148 static UInt16
getClassGroupId(void);
151 /*---------------------------------------------------------------------*/
152 /*! \name FieldContainer Get */
155 virtual FieldContainerType
&getType (void);
156 virtual const FieldContainerType
&getType (void) const;
158 virtual UInt32
getContainerSize(void) const;
161 /*---------------------------------------------------------------------*/
162 /*! \name Field Get */
165 const MFUnrecNodePtr
*getMFRoots (void) const;
166 MFUnrecNodePtr
*editMFRoots (void);
167 const MFUnrecChildBaseSkeletonJointPtr
*getMFJoints (void) const;
168 MFUnrecChildBaseSkeletonJointPtr
*editMFJoints (void);
169 const MFUnrecBaseSkeletonJointPtr
*getMFParentJoints (void) const;
170 MFUnrecBaseSkeletonJointPtr
*editMFParentJoints (void);
172 MFMatrix
*editMFJointMatrices (void);
173 const MFMatrix
*getMFJointMatrices (void) const;
175 MFMatrix
*editMFJointNormalMatrices(void);
176 const MFMatrix
*getMFJointNormalMatrices (void) const;
178 SFBool
*editSFUseInvBindMatrix(void);
179 const SFBool
*getSFUseInvBindMatrix (void) const;
181 SFBool
*editSFCalcNormalMatrices(void);
182 const SFBool
*getSFCalcNormalMatrices (void) const;
184 SFOSGAny
*editSFJointsChanged (void);
185 const SFOSGAny
*getSFJointsChanged (void) const;
188 Node
* getRoots (const UInt32 index
) const;
190 BaseSkeletonJoint
* getJoints (const UInt32 index
) const;
192 BaseSkeletonJoint
* getParentJoints (const UInt32 index
) const;
194 MFMatrix ::reference
editJointMatrices (const UInt32 index
);
195 const Matrix
&getJointMatrices (const UInt32 index
) const;
197 MFMatrix ::reference
editJointNormalMatrices(const UInt32 index
);
198 const Matrix
&getJointNormalMatrices (const UInt32 index
) const;
200 bool &editUseInvBindMatrix(void);
201 bool getUseInvBindMatrix (void) const;
203 bool &editCalcNormalMatrices(void);
204 bool getCalcNormalMatrices (void) const;
206 OSGAny
&editJointsChanged (void);
207 const OSGAny
&getJointsChanged (void) const;
210 /*---------------------------------------------------------------------*/
211 /*! \name Field Set */
214 void setUseInvBindMatrix(const bool value
);
215 void setCalcNormalMatrices(const bool value
);
216 void setJointsChanged (const OSGAny
&value
);
219 /*---------------------------------------------------------------------*/
220 /*! \name Ptr Field Set */
224 /*---------------------------------------------------------------------*/
225 /*! \name Ptr MField Set */
228 void pushToRoots (Node
* const value
);
229 void assignRoots (const MFUnrecNodePtr
&value
);
230 void removeFromRoots (UInt32 uiIndex
);
231 void removeObjFromRoots(Node
* const value
);
232 void clearRoots (void );
234 void pushToJoints (BaseSkeletonJoint
* const value
);
235 void assignJoints (const MFUnrecChildBaseSkeletonJointPtr
&value
);
236 void removeFromJoints (UInt32 uiIndex
);
237 void removeObjFromJoints(BaseSkeletonJoint
* const value
);
238 void clearJoints (void );
240 void pushToParentJoints (BaseSkeletonJoint
* const value
);
241 void assignParentJoints (const MFUnrecBaseSkeletonJointPtr
&value
);
242 void removeFromParentJoints (UInt32 uiIndex
);
243 void removeObjFromParentJoints(BaseSkeletonJoint
* const value
);
244 void clearParentJoints (void );
247 /*---------------------------------------------------------------------*/
248 /*! \name Binary Access */
251 virtual SizeT
getBinSize (ConstFieldMaskArg whichField
);
252 virtual void copyToBin (BinaryDataHandler
&pMem
,
253 ConstFieldMaskArg whichField
);
254 virtual void copyFromBin(BinaryDataHandler
&pMem
,
255 ConstFieldMaskArg whichField
);
259 /*---------------------------------------------------------------------*/
260 /*! \name Construction */
263 static SkeletonTransitPtr
create (void);
264 static Skeleton
*createEmpty (void);
266 static SkeletonTransitPtr
createLocal (
267 BitVector bFlags
= FCLocal::All
);
269 static Skeleton
*createEmptyLocal(
270 BitVector bFlags
= FCLocal::All
);
272 static SkeletonTransitPtr
createDependent (BitVector bFlags
);
275 /*---------------------------------------------------------------------*/
279 virtual FieldContainerTransitPtr
shallowCopy (void) const;
280 virtual FieldContainerTransitPtr
shallowCopyLocal(
281 BitVector bFlags
= FCLocal::All
) const;
282 virtual FieldContainerTransitPtr
shallowCopyDependent(
283 BitVector bFlags
) const;
286 /*========================= PROTECTED ===============================*/
290 static TypeObject _type
;
292 static void classDescInserter(TypeObject
&oType
);
293 static const Char8
*getClassname (void );
295 /*---------------------------------------------------------------------*/
299 MFUnrecNodePtr _mfRoots
;
300 MFUnrecChildBaseSkeletonJointPtr _mfJoints
;
301 MFUnrecBaseSkeletonJointPtr _mfParentJoints
;
302 MFMatrix _mfJointMatrices
;
303 MFMatrix _mfJointNormalMatrices
;
304 SFBool _sfUseInvBindMatrix
;
305 SFBool _sfCalcNormalMatrices
;
306 SFOSGAny _sfJointsChanged
;
309 /*---------------------------------------------------------------------*/
310 /*! \name Constructors */
314 SkeletonBase(const SkeletonBase
&source
);
317 /*---------------------------------------------------------------------*/
318 /*! \name Destructors */
321 virtual ~SkeletonBase(void);
324 /*---------------------------------------------------------------------*/
325 /*! \name onCreate */
328 void onCreate(const Skeleton
*source
= NULL
);
331 /*---------------------------------------------------------------------*/
332 /*! \name Child linking */
335 virtual bool unlinkChild(FieldContainer
* const pChild
,
336 UInt16
const childFieldId
);
339 /*---------------------------------------------------------------------*/
340 /*! \name Generic Field Access */
343 GetFieldHandlePtr
getHandleRoots (void) const;
344 EditFieldHandlePtr
editHandleRoots (void);
345 GetFieldHandlePtr
getHandleJoints (void) const;
346 EditFieldHandlePtr
editHandleJoints (void);
347 GetFieldHandlePtr
getHandleParentJoints (void) const;
348 EditFieldHandlePtr
editHandleParentJoints (void);
349 GetFieldHandlePtr
getHandleJointMatrices (void) const;
350 EditFieldHandlePtr
editHandleJointMatrices (void);
351 GetFieldHandlePtr
getHandleJointNormalMatrices (void) const;
352 EditFieldHandlePtr
editHandleJointNormalMatrices(void);
353 GetFieldHandlePtr
getHandleUseInvBindMatrix (void) const;
354 EditFieldHandlePtr
editHandleUseInvBindMatrix(void);
355 GetFieldHandlePtr
getHandleCalcNormalMatrices (void) const;
356 EditFieldHandlePtr
editHandleCalcNormalMatrices(void);
357 GetFieldHandlePtr
getHandleJointsChanged (void) const;
358 EditFieldHandlePtr
editHandleJointsChanged (void);
361 /*---------------------------------------------------------------------*/
365 #ifdef OSG_MT_CPTR_ASPECT
366 virtual void execSyncV( FieldContainer
&oFrom
,
367 ConstFieldMaskArg whichField
,
368 AspectOffsetStore
&oOffsets
,
369 ConstFieldMaskArg syncMode
,
370 const UInt32 uiSyncInfo
);
372 void execSync ( SkeletonBase
*pFrom
,
373 ConstFieldMaskArg whichField
,
374 AspectOffsetStore
&oOffsets
,
375 ConstFieldMaskArg syncMode
,
376 const UInt32 uiSyncInfo
);
380 /*---------------------------------------------------------------------*/
385 /*---------------------------------------------------------------------*/
386 /*! \name Aspect Create */
389 #ifdef OSG_MT_CPTR_ASPECT
390 virtual FieldContainer
*createAspectCopy(
391 const FieldContainer
*pRefAspect
) const;
395 /*---------------------------------------------------------------------*/
399 /*---------------------------------------------------------------------*/
403 virtual void resolveLinks(void);
406 /*========================== PRIVATE ================================*/
409 /*---------------------------------------------------------------------*/
411 // prohibit default functions (move to 'public' if you need one)
412 void operator =(const SkeletonBase
&source
);
415 typedef SkeletonBase
*SkeletonBaseP
;
419 #endif /* _OSGSKELETONBASE_H_ */