thanks MrAdults , maybe this can save you some time checking , what I have done till now is this :
from the model : 00s.gmi
- Bone struct is correct
- MeshInfo has only a small difference from the specified from fatduck, new field bones_used from the log fatduck attached :
Code: Select all
struct MeshInfo {
word MeshType?
dword numVerts
dword numFaceControl?
word padding
dword ofsVertCoord
dword ofsNormal
dword ?? //must be offset of something
dword ofsUV
dword ofsBoneIndices
dword ofsWeight
byte [12] bones_used ; // <-- qslash , array with bone used by the mesh
}
- Vertcoord struct is correct , the FaceControl field is equal to 1 , Im assuming is the end of a tri face , if there are 2 consecutives I take the 2 previous vertex before the first FaceControl = 1.
- Struct BoneIndices is correct , for every vertex the Index1 field is the index position in MeshInfo.bones_used , eg MeshInfo.bone_used[BoneIndices[VertexPosition].index1] is the bone used.
So far :
Number of Bones : 46 // Bone[46]
Number of Meshes : 5 // MeshInfo[5]
Taking as example the Mesh[0] , that I think is the body of the model , we have :
Code: Select all
[[MeshInfo [0] ]]
Number of Vertices : 261
Offset Vertices : 5424
Offset Bone Indices : 25104
No weigths ..
Bones_used [0..11] : 1,3,2,4,7,5,6,8,16,9,18,10
Taking only the Bone 3 , that has values , and parentid 1 (Bone 1) , we have
Code: Select all
[Bone 0 Matrix] Name : h_ske_root
1.000000 , 0.000000, 0.000000, 0.000000
0.000000 , 1.000000, 0.000000, 0.000000
0.000000 , 0.000000, 1.000000, 0.000000
0.000000 , 0.000000, 0.000000, 1.000000
[Bone 1 Matrix] Name : h_jnt_waist , parent_id = 0
-0.000000 , -1.000000, -0.000000, 0.000000
0.000000 , -0.000000, 1.000000, 0.000000
-1.000000 , 0.000000, 0.000000, 0.000000
-0.000000 , 0.000000, 0.000000, 1.000000
[Bone 3 Matrix] Name : h_jnt_luleg, parent_id = 1 (Local Space Matrix)
0.998632 , -0.052288, -0.000000, 0.000000
0.052288 , 0.998632, 0.000000, 0.000000
-0.000000 , -0.000000, 1.000000, 0.000000
-0.915000 , -0.047500, 0.665000, 1.000000
A vertex that uses that bone, Vertex V[10],
with BoneIndices[10].bindex1 = 1 , MeshInfo.bones_used[bindex] = 3:
The World Space (accumulated) matrix for Bone 3 I have is this :
Code: Select all
0.000000 -0.998632 -0.052288 -0.052288
0.000000 -0.052288 0.998632 0.998632
-1.000000 0.000000 0.000000 0.000000
-0.665000 0.915000 -0.047500 -0.047500
*Note , Im re-loop-checking again and again if my logic for operations with matrix is correct .. till now I think is ok .. if not I will shoot myself
..
If a multiply the vector with the inverse of the World Space matrix (accumulated), I got the same vector :
* Edit : I think that is multiplying with a Identity matrix .. mm but thats only if cant be inversed ..weird .. checking code again ..
* Edit2 : corrected , fabs(float) .. but the same the model now looks like a babylon 5 spaceship ..
if a multiply with the World Space (accumulated) , I got :
But the model with faces , looks wrong :
So .now Im bleeding from the eyes
I dont know what Im doing wrong ... I just want to get to the same thing that fatduck did , so any help will be appreciated ...