1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
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 #ifndef _OSGCPUSKINNINGALGORITHM_H_
40 #define _OSGCPUSKINNINGALGORITHM_H_
45 #include "OSGCPUSkinningAlgorithmBase.h"
46 #include "OSGTypedGeoVectorProperty.h"
50 class CPUSkinningDataAttachment
;
51 class IntersectAction
;
53 /*! \brief CPUSkinningAlgorithm class. See \ref
54 PageDynamicsCPUSkinningAlgorithm for a description.
57 class OSG_DYNAMICS_DLLMAPPING CPUSkinningAlgorithm
:
58 public CPUSkinningAlgorithmBase
62 /*========================== PUBLIC =================================*/
66 typedef CPUSkinningAlgorithmBase Inherited
;
67 typedef CPUSkinningAlgorithm Self
;
69 typedef SkinnedGeometry::RenderModeE RenderModeE
;
71 /*---------------------------------------------------------------------*/
75 virtual void adjustVolume (Volume
&volume
);
77 virtual Action::ResultE
renderEnter (Action
*action
);
78 virtual Action::ResultE
renderLeave (Action
*action
);
80 virtual Action::ResultE
intersectEnter(Action
*action
);
83 /*---------------------------------------------------------------------*/
87 virtual RenderModeE
getRenderMode(void) const;
90 /*---------------------------------------------------------------------*/
94 virtual void changed(ConstFieldMaskArg whichField
,
99 /*---------------------------------------------------------------------*/
103 virtual void dump( UInt32 uiIndent
= 0,
104 const BitVector bvFlags
= 0) const;
107 /*========================= PROTECTED ===============================*/
111 // Variables should all be in CPUSkinningAlgorithmBase.
113 /*---------------------------------------------------------------------*/
114 /*! \name Constructors */
117 CPUSkinningAlgorithm(void);
118 CPUSkinningAlgorithm(const CPUSkinningAlgorithm
&source
);
121 /*---------------------------------------------------------------------*/
122 /*! \name Destructors */
125 virtual ~CPUSkinningAlgorithm(void);
128 /*---------------------------------------------------------------------*/
132 static void initMethod(InitPhase ePhase
);
135 /*---------------------------------------------------------------------*/
136 /*! \name Transform */
139 void transformGeometry(SkinnedGeometry
*skinGeo
,
141 CPUSkinningDataAttachment
*data
);
142 void transformObjectSpaceProperty (const MFMatrix
*jointMat
,
143 const GeoVec4fProperty
*jointIdx
,
144 const GeoVec4fProperty
*jointWeight
,
145 const GeoIntegralProperty
*origIdx
,
146 const GeoVectorProperty
*origProp
,
147 GeoVectorProperty
*prop
);
148 void transformTangentSpaceProperty(const MFMatrix
*jointMat
,
149 const GeoVec4fProperty
*jointIdx
,
150 const GeoVec4fProperty
*jointWeight
,
151 const GeoIntegralProperty
*origIdx
,
152 const GeoVectorProperty
*origProp
,
153 GeoVectorProperty
*prop
);
155 void renderGeometry(RenderAction
*ract
,
156 SkinnedGeometry
*skinGeo
,
157 CPUSkinningDataAttachment
*data
);
158 void drawPrimitives(SkinnedGeometry
*skinGeo
,
159 CPUSkinningDataAttachment
*data
,
162 void intersectGeometry(IntersectAction
*iact
,
163 SkinnedGeometry
*skinGeo
,
164 CPUSkinningDataAttachment
*data
);
167 /*---------------------------------------------------------------------*/
168 /*! \name Skeleton Change */
171 void skeletonChanged(FieldContainer
*fc
, ConstFieldMaskArg whichField
);
174 /*---------------------------------------------------------------------*/
178 virtual void resolveLinks(void);
181 /*========================== PRIVATE ================================*/
185 friend class FieldContainer
;
186 friend class CPUSkinningAlgorithmBase
;
188 // prohibit default functions (move to 'public' if you need one)
189 void operator =(const CPUSkinningAlgorithm
&source
);
192 typedef CPUSkinningAlgorithm
*CPUSkinningAlgorithmP
;
196 #include "OSGCPUSkinningAlgorithmBase.inl"
197 #include "OSGCPUSkinningAlgorithm.inl"
199 #endif /* _OSGCPUSKINNINGALGORITHM_H_ */