00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __NESKIN_H
00028 #define __NESKIN_H
00029
00030
00037 #include "base.h"
00038 #include "submesh.h"
00039 #include "nemath.h"
00040
00041
00042 namespace NeoEngine
00043 {
00044
00045
00046
00047 class Skeleton;
00048
00049
00054 class NEOENGINE_API BoneInfluence
00055 {
00056 public:
00057
00059 int m_iBoneID;
00060
00062 float m_fWeight;
00063
00065 Vector3d m_kOffset;
00066 };
00067
00068
00073 class NEOENGINE_API SkinVertex
00074 {
00075 public:
00076
00078 int m_iNumInfluences;
00079
00081 BoneInfluence *m_pkInfluences;
00082
00085 SkinVertex() : m_iNumInfluences(0), m_pkInfluences(0) {}
00086
00089 ~SkinVertex();
00090 };
00091
00092
00097 class NEOENGINE_API Skin : public RefCounter
00098 {
00099 public:
00100
00102 int m_iNumVertices;
00103
00105 SkinVertex *m_pkSkinVertices;
00106
00108 VertexBufferPtr m_pkVertices;
00109
00110
00113 Skin( int iNumVertices = 0, SkinVertex *pkSkinVertices = 0, VertexBufferPtr pkVertices = 0 ) : m_iNumVertices( iNumVertices ), m_pkSkinVertices( pkSkinVertices ), m_pkVertices( pkVertices ) {}
00114
00118 virtual ~Skin();
00119 };
00120
00121
00122
00123 SmartPointer( Skin );
00124
00125
00130 class NEOENGINE_API SkeletalSubMesh : public SubMesh
00131 {
00132 protected:
00133
00137 virtual void UpdateData() { WeightVertices(); }
00138
00139
00140 public:
00141
00143 Skeleton *m_pkSkeleton;
00144
00146 SkinPtr m_pkSkin;
00147
00148
00151 SkeletalSubMesh();
00152
00156 SkeletalSubMesh( const SkeletalSubMesh &rkSubMesh );
00157
00160 virtual ~SkeletalSubMesh();
00161
00165 inline virtual VertexBufferPtr &GetVertexBuffer() { if( m_bNeedUpdate ) { WeightVertices(); m_bNeedUpdate = false; } return m_pkVertices; }
00166
00170 void WeightVertices();
00171
00176 virtual void Update( float fDeltaTime ) { m_bNeedUpdate = true; }
00177
00181 virtual SubMesh *Duplicate() const;
00182
00186 virtual unsigned int GetType() const { return SKELETALSUBMESH; }
00187 };
00188
00189
00190 };
00191
00192
00193 #endif