MSH structure:
- Header
- BoneData
- MeshData
- OtherData
Header
Code:
struct Header{
char name[256]; //Eternity Engine Mesh File 0.1
int version; //file version
int meshCount;
int unknown1; //0x1
int unknown2; //0x0
Vec3F bbMax;
Vec3F bbMin;
int boneCount; //overall bone count
int unknown2; //0x1 or 0x0
int otherCount; //other elements
};
BoneData
offset 0x400
Code:
struct BoneData{
char boneName[256];
Vec4F transformMatrix[4]; //Bone transformation matrix
};
MeshData
Code:
struct MeshInfo{
char sceneName[256];
char meshName[256];
int vertexCount;
int indexCount;
int unknown;
int renderMode;
char empty[512 - 16];
};
struct MeshDataPointer{//pointer
char* pFaceIndex; //0x2(unsigned short) * indexCount
char* pVertexData; //0x4(float) * 3 * vertexCount
char* pNormalData; //0x4(float) * 3 * vertexCount
char* pUVData; //0x4(float) * 2 * vertexCount
char* pBoneIndex; //0x2(unsigned short) * 4 vertexCount
char* pBoneWeight; //0x4(float) * 4 * vertexCount
int* pBoneCount;
char* pBoneName; //0x100(char [256]) * boneCount
};
VertexData elements - the vertex in 3d space xyz coordinate, Vec3F structure data.
Chinese description
- VertexIndex元素 - 即顶点索引,是程序画面的顺序数据,索引的是顶点数据.每个元素使用unsign short类型保存数据.
- NormalData元素 - 即法线数据,是每个顶点的法向数据,以三维空间坐标x,y,z表示.每个元素使用Vec3F结构保存数据.
- UVData元素 - 即UV贴图数据,是每个顶点在二维贴图空间映射的u,v坐标.每个元素使用Vec2F结构保存数据.
- WeightIndex元素 - 即权重索引,是每个顶点的权重索引,每个顶点最多可以索引4个骨骼.每个元素使用4个unsign short类型保存数据.
- WeightData - 即权重数据,是每个顶点的权重数据,每个顶点最多可以拥有4个骨骼权重.每个元素使用Vec4F结构保存数据.
- BoneIndex - 即骨骼索引,用以给骨骼编序,只保存骨骼名称.每个元素使用char [256]字符型数组保存数据.
OtherData
Code:
class Vec2F{
public:
float x;
float y;
Vec2F(){x = 0; y = 0;}
Vec2F(KFbxVector2 &vector){
x = vector.GetAt(0);
y = vector.GetAt(1);}
Vec2F(KFbxVector4 &vector){
x = vector.GetAt(0);
y = vector.GetAt(1);}
};
class Vec3F : public Vec2F{
public:
float z;
Vec3F() : Vec2F(){z = 0;}
Vec3F(KFbxVector4 &vector) : Vec2F(vector){
z = vector.GetAt(2);}
};
class Vec4F : public Vec3F{
public:
float w;
Vec4F() : Vec3F(){w = 0;}
Vec4F(KFbxVector4 &vector) : Vec3F(vector){
w = vector.GetAt(3);}
};
P.S. If some one can translate this into En, please add your comment