Ich hab mir mal die Zeit genommen das komplette O3D Datei Format aufzuschreiben.
Vielleicht kann der eine oder andere was damit anfangen.
PHP Code:
O3D FILE FORMAT
1 byte - Name Length
4 bytes - Name
4 bytes - Version
if Version < 20
Error - Return FAIL
4 bytes - ID
12 bytes - D3DVECTOR3 Force1
12 bytes - D3DVECTOR3 Force2
if Version >21
12 bytes - D3DVECTOR3 Force3
12 bytes - D3DVECTOR3 Force4
4 bytes - FLOAT ScrlU
4 bytes - FLOAT ScrlV
16 bytes - NULL, skip that ones
12 bytes - D3DVECTOR3 BoundingBox Minimum
12 bytes - D3DVECTOR3 BoundingBox Minimum
4 bytes - FLOAT PerSlerp
4 bytes - Frame Count
4 bytes - Event Count
if Event Count > 0
start loop1 - Repeat x times, where x is equal to Event Count
12 bytes - D3DVECTOR3 Event
end loop1
4 bytes - Temp
if Temp != 0 - Now the Geometry Part
12 bytes - D3DVECTOR3 BoundingBox Minimum
12 bytes - D3DVECTOR3 BoundingBox Minimum
4 bytes - INT used as BOOLEAN Opacity
4 bytes - INT used as BOOLEAN Bump
4 bytes - INT used as BOOLEAN Rigid Body
28 bytes - NULL, skip that ones
4 bytes - Number of Vertices
4 bytes - Number of Vertex Buffers
4 bytes - Number of Faces
4 bytes - Number of Index Buffers
start loop2 - Repeat x times, where x is the Number of Vertices
12 bytes - D3DVECTOR3 Vertex List
end loop2
if MeshType == 1 -- if the Object is skinned
start loop3 - Repeat x times, where x is the Number of Vertex Buffers
//44 bytes - SKINVERTEX it is built as this:
12 Bytes - D3DVECTOR3 3D Position of Vertex
4 Bytes - FLOAT Vertex Weight 1
4 Bytes - FLOAT Vertex Weight 2
4 Bytes - DWORD Material ID
12 Bytes - D3DVECTOR3 Surface Normal for the Vertex
4 Bytes - FLOAT Texture Coordinate u
4 Bytes - FLOAT Texture Coordinate v
end loop3
else-- if the Object is not skinned
start loop4 - Repeat x times, where x is the Number of Vertex Buffers
//32 bytes - NORMALVERTEX it is built as this:
12 Bytes - D3DVECTOR3 3D Position of Vertex
12 Bytes - D3DVECTOR3 Surface Normal for the Vertex
4 Bytes - FLOAT Texture Coordinate u
4 Bytes - FLOAT Texture Coordinate v
end loop4
start loop5 - Repeat x times, where x is the Number of Index Buffers
2 bytes - WORD
end loop 5
start loop5 - Repeat x times, where x is the Number of Vertex Buffers
2 bytes - WORD
end loop 5
4 bytes - Temp
if Temp != 0 -- Physique
start loop6 - Repeat x times, where x is the Number of Vertices
4 bytes - Physique Vertex
end loop6
4 bytes - IsMaterial
if IsMaterial != 0 -- IsMaterial = True
4 bytes - MaxMaterial
start loop7 - Repeat x times, where x is the Number of Materials
//68 bytes - D3D9MATERIAL it is built like this:
16 bytes - D3DCOLORVALUE Diffuse Color with r(ed), g(reen), b(blue), a(lpha)
16 bytes - D3DCOLORVALUE Ambient Color with r(ed), g(reen), b(blue), a(lpha)
16 bytes - D3DCOLORVALUE Specular Color with r(ed), g(reen), b(blue), a(lpha)
16 bytes - D3DCOLORVALUE Emissive Color with r(ed), g(reen), b(blue), a(lpha)
4 bytes - FLOAT Power of the Color
4 bytes - Bitmap Filename Length
4 bytes - Bitmap Filename
end loop7
4 bytes - Vertex Buffer Material Block
if Vertex Buffer Material Block > 31
ERROR - Return FAIL
if Vertex Buffer Material Block > 0
start loop8 - Repeat x times, where x is the Number of Material Blocks
//136 bytes - MATERiAL_BLOCK it is built like this:
4 bytes - Start Vertex
4 bytes - Primitive Count
4 bytes - Texture ID
4 bytes - DWORD Effect
4 bytes - Amount
4 bytes - Number of Bones
28*4 bytes - INT ARRAY Bone
end loop8
4 bytes - INT used as BOOLEAN LOD
4 bytes - Bone Count
if Bone Count > 0
start loop9 - Repeat x times, where x is equal to Bone Count
64 bytes - D3DXMATRIX LocalTM (16 float values in a 4x4 Matrix)
end loop9
start loop10 - Repeat x times, where x is equal to Bone Count
64 bytes - D3DXMATRIX InversedTM (16 float values in a 4x4 Matrix)
end loop10
4 bytes - INT used as BOOLEAN SendVS
4 bytes - PoolSize
start loop11 - Repeat x times, where x is the amount of LoDPresent
4 bytes - Object Count
start loop12 - Repeat x times, where x is equal to Object Count
4 bytes - Mesh Type
4 bytes - Number of Bones
if Number of Bones > 0
start loop13 - Repeat x times, where x is equal to Number of Bones
4x28 Bytes - INT ARRAY Bone
end loop13
4 bytes - Object ID
4 bytes - Parent Index
if Parent Index != -1
4 Bytes - Parent Type
64 bytes - D3DXMATRIX LocalTM (16 float values in a 4x4 Matrix)
end loop12
end loop11
12 bytes - D3DVECTOR3 BoundingBox Minimum
12 bytes - D3DVECTOR3 BoundingBox Minimum
4 bytes - INT used as BOOLEAN Opacity
4 bytes - INT used as BOOLEAN Bump
4 bytes - INT used as BOOLEAN Rigid Body
28 bytes - NULL, skip that ones
4 bytes - Number of Vertices
4 bytes - Number of Vertex Buffers
4 bytes - Number of Faces
4 bytes - Number of Index Buffers
start loop14 - Repeat x times, where x is the Number of Vertices
12 bytes - D3DVECTOR3 Vertex List
end loop14
if MeshType == 1 -- if the Object is skinned
start loop15 - Repeat x times, where x is the Number of Vertex Buffers
//44 bytes - SKINVERTEX it is built as this:
12 Bytes - D3DVECTOR3 3D Position of Vertex
4 Bytes - FLOAT Vertex Weight 1
4 Bytes - FLOAT Vertex Weight 2
4 Bytes - DWORD Material ID
12 Bytes - D3DVECTOR3 Surface Normal for the Vertex
4 Bytes - FLOAT Texture Coordinate u
4 Bytes - FLOAT Texture Coordinate v
end loop15
else-- if the Object is not skinned
start loop16 - Repeat x times, where x is the Number of Vertex Buffers
//32 bytes - NORMALVERTEX it is built as this:
12 Bytes - D3DVECTOR3 3D Position of Vertex
12 Bytes - D3DVECTOR3 Surface Normal for the Vertex
4 Bytes - FLOAT Texture Coordinate u
4 Bytes - FLOAT Texture Coordinate v
end loop16
start loop17 - Repeat x times, where x is the Number of Index Buffers
2 bytes - WORD
end loop17
start loop18 - Repeat x times, where x is the Number of Vertex Buffers
2 bytes - WORD
end loop18
4 bytes - Temp
if Temp != 0 -- Physique
start loop19 - Repeat x times, where x is the Number of Vertices
4 bytes - Physique Vertex
end loop19
4 bytes - IsMaterial
if IsMaterial != 0 -- IsMaterial = True
4 bytes - MaxMaterial
start loop20 - Repeat x times, where x is the Number of Materials
//68 bytes - D3D9MATERIAL it is built like this:
16 bytes - D3DCOLORVALUE Diffuse Color with r(ed), g(reen), b(blue), a(lpha)
16 bytes - D3DCOLORVALUE Ambient Color with r(ed), g(reen), b(blue), a(lpha)
16 bytes - D3DCOLORVALUE Specular Color with r(ed), g(reen), b(blue), a(lpha)
16 bytes - D3DCOLORVALUE Emissive Color with r(ed), g(reen), b(blue), a(lpha)
4 bytes - FLOAT Power of the Color
4 bytes - Bitmap Filename Length
4 bytes - Bitmap Filename
end loop20
4 bytes - Vertex Buffer Material Block
if Vertex Buffer Material Block > 31
ERROR - Return FAIL
if Vertex Buffer Material Block > 0
start loop8 - Repeat x times, where x is the Number of Material Blocks
//136 bytes - MATERiAL_BLOCK it is built like this:
4 bytes - Start Vertex
4 bytes - Primitive Count
4 bytes - Texture ID
4 bytes - DWORD Effect
4 bytes - Amount
4 bytes - Number of Bones
28*4 bytes - INT ARRAY Bone
end loop8
if Version > 20
4 bytes - Attribute
if Attribute == Frame Count
start loop21 - Repeat x times, while x is equal to Frame Count
//12 bytes - MOTION_ATTR it is build like this:
4 bytes - DWORD Attribue
4 bytes - Sound ID
4 bytes - FLOAT Frame
end loop21
Greetz