xakzi

Untitled

Sep 16th, 2024
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.43 KB | None | 0 0
  1. O3D FILE FORMAT
  2.  
  3. 1 byte - Name Length
  4. 4 bytes - Name
  5. 4 bytes - Version
  6. if Version < 20
  7. Error - Return FAIL
  8.  
  9. 4 bytes - ID
  10. 12 bytes - D3DVECTOR3 Force1
  11. 12 bytes - D3DVECTOR3 Force2
  12. if Version >21
  13. 12 bytes - D3DVECTOR3 Force3
  14. 12 bytes - D3DVECTOR3 Force4
  15.  
  16. 4 bytes - FLOAT ScrlU
  17. 4 bytes - FLOAT ScrlV
  18. 16 bytes - NULL, skip that ones
  19. 12 bytes - D3DVECTOR3 BoundingBox Minimum
  20. 12 bytes - D3DVECTOR3 BoundingBox Minimum
  21.  
  22. 4 bytes - FLOAT PerSlerp
  23. 4 bytes - Frame Count
  24.  
  25. 4 bytes - Event Count
  26. if Event Count > 0
  27. start loop1 - Repeat x times, where x is equal to Event Count
  28. 12 bytes - D3DVECTOR3 Event
  29. end loop1
  30.  
  31. 4 bytes - Temp
  32. if Temp != 0 - Now the Geometry Part
  33. 12 bytes - D3DVECTOR3 BoundingBox Minimum
  34. 12 bytes - D3DVECTOR3 BoundingBox Minimum
  35. 4 bytes - INT used as BOOLEAN Opacity
  36. 4 bytes - INT used as BOOLEAN Bump
  37. 4 bytes - INT used as BOOLEAN Rigid Body
  38. 28 bytes - NULL, skip that ones
  39.  
  40. 4 bytes - Number of Vertices
  41. 4 bytes - Number of Vertex Buffers
  42. 4 bytes - Number of Faces
  43. 4 bytes - Number of Index Buffers
  44.  
  45. start loop2 - Repeat x times, where x is the Number of Vertices
  46. 12 bytes - D3DVECTOR3 Vertex List
  47. end loop2
  48.  
  49. if MeshType == 1 -- if the Object is skinned
  50. start loop3 - Repeat x times, where x is the Number of Vertex Buffers
  51. //44 bytes - SKINVERTEX it is built as this:
  52. 12 Bytes - D3DVECTOR3 3D Position of Vertex
  53. 4 Bytes - FLOAT Vertex Weight 1
  54. 4 Bytes - FLOAT Vertex Weight 2
  55. 4 Bytes - DWORD Material ID
  56. 12 Bytes - D3DVECTOR3 Surface Normal for the Vertex
  57. 4 Bytes - FLOAT Texture Coordinate u
  58. 4 Bytes - FLOAT Texture Coordinate v
  59. end loop3
  60. else-- if the Object is not skinned
  61. start loop4 - Repeat x times, where x is the Number of Vertex Buffers
  62. //32 bytes - NORMALVERTEX it is built as this:
  63. 12 Bytes - D3DVECTOR3 3D Position of Vertex
  64. 12 Bytes - D3DVECTOR3 Surface Normal for the Vertex
  65. 4 Bytes - FLOAT Texture Coordinate u
  66. 4 Bytes - FLOAT Texture Coordinate v
  67. end loop4
  68.  
  69. start loop5 - Repeat x times, where x is the Number of Index Buffers
  70. 2 bytes - WORD
  71. end loop 5
  72.  
  73. start loop5 - Repeat x times, where x is the Number of Vertex Buffers
  74. 2 bytes - WORD
  75. end loop 5
  76.  
  77.  
  78. 4 bytes - Temp
  79. if Temp != 0 -- Physique
  80. start loop6 - Repeat x times, where x is the Number of Vertices
  81. 4 bytes - Physique Vertex
  82. end loop6
  83.  
  84. 4 bytes - IsMaterial
  85. if IsMaterial != 0 -- IsMaterial = True
  86. 4 bytes - MaxMaterial
  87.  
  88. start loop7 - Repeat x times, where x is the Number of Materials
  89. //68 bytes - D3D9MATERIAL it is built like this:
  90. 16 bytes - D3DCOLORVALUE Diffuse Color with r(ed), g(reen), b(blue), a(lpha)
  91. 16 bytes - D3DCOLORVALUE Ambient Color with r(ed), g(reen), b(blue), a(lpha)
  92. 16 bytes - D3DCOLORVALUE Specular Color with r(ed), g(reen), b(blue), a(lpha)
  93. 16 bytes - D3DCOLORVALUE Emissive Color with r(ed), g(reen), b(blue), a(lpha)
  94. 4 bytes - FLOAT Power of the Color
  95.  
  96. 4 bytes - Bitmap Filename Length
  97. 4 bytes - Bitmap Filename
  98. end loop7
  99.  
  100. 4 bytes - Vertex Buffer Material Block
  101. if Vertex Buffer Material Block > 31
  102. ERROR - Return FAIL
  103. if Vertex Buffer Material Block > 0
  104. start loop8 - Repeat x times, where x is the Number of Material Blocks
  105. //136 bytes - MATERiAL_BLOCK it is built like this:
  106. 4 bytes - Start Vertex
  107. 4 bytes - Primitive Count
  108. 4 bytes - Texture ID
  109. 4 bytes - DWORD Effect
  110. 4 bytes - Amount
  111. 4 bytes - Number of Bones
  112. 28*4 bytes - INT ARRAY Bone
  113. end loop8
  114.  
  115. 4 bytes - INT used as BOOLEAN LOD
  116. 4 bytes - Bone Count
  117. if Bone Count > 0
  118. start loop9 - Repeat x times, where x is equal to Bone Count
  119. 64 bytes - D3DXMATRIX LocalTM (16 float values in a 4x4 Matrix)
  120. end loop9
  121.  
  122. start loop10 - Repeat x times, where x is equal to Bone Count
  123. 64 bytes - D3DXMATRIX InversedTM (16 float values in a 4x4 Matrix)
  124. end loop10
  125. 4 bytes - INT used as BOOLEAN SendVS
  126.  
  127. 4 bytes - PoolSize
  128. start loop11 - Repeat x times, where x is the amount of LoDPresent
  129. 4 bytes - Object Count
  130. start loop12 - Repeat x times, where x is equal to Object Count
  131. 4 bytes - Mesh Type
  132. 4 bytes - Number of Bones
  133. if Number of Bones > 0
  134. start loop13 - Repeat x times, where x is equal to Number of Bones
  135. 4x28 Bytes - INT ARRAY Bone
  136. end loop13
  137. 4 bytes - Object ID
  138. 4 bytes - Parent Index
  139. if Parent Index != -1
  140. 4 Bytes - Parent Type
  141. 64 bytes - D3DXMATRIX LocalTM (16 float values in a 4x4 Matrix)
  142. end loop12
  143. end loop11
  144.  
  145. 12 bytes - D3DVECTOR3 BoundingBox Minimum
  146. 12 bytes - D3DVECTOR3 BoundingBox Minimum
  147. 4 bytes - INT used as BOOLEAN Opacity
  148. 4 bytes - INT used as BOOLEAN Bump
  149. 4 bytes - INT used as BOOLEAN Rigid Body
  150. 28 bytes - NULL, skip that ones
  151.  
  152. 4 bytes - Number of Vertices
  153. 4 bytes - Number of Vertex Buffers
  154. 4 bytes - Number of Faces
  155. 4 bytes - Number of Index Buffers
  156.  
  157. start loop14 - Repeat x times, where x is the Number of Vertices
  158. 12 bytes - D3DVECTOR3 Vertex List
  159. end loop14
  160.  
  161. if MeshType == 1 -- if the Object is skinned
  162. start loop15 - Repeat x times, where x is the Number of Vertex Buffers
  163. //44 bytes - SKINVERTEX it is built as this:
  164. 12 Bytes - D3DVECTOR3 3D Position of Vertex
  165. 4 Bytes - FLOAT Vertex Weight 1
  166. 4 Bytes - FLOAT Vertex Weight 2
  167. 4 Bytes - DWORD Material ID
  168. 12 Bytes - D3DVECTOR3 Surface Normal for the Vertex
  169. 4 Bytes - FLOAT Texture Coordinate u
  170. 4 Bytes - FLOAT Texture Coordinate v
  171. end loop15
  172. else-- if the Object is not skinned
  173. start loop16 - Repeat x times, where x is the Number of Vertex Buffers
  174. //32 bytes - NORMALVERTEX it is built as this:
  175. 12 Bytes - D3DVECTOR3 3D Position of Vertex
  176. 12 Bytes - D3DVECTOR3 Surface Normal for the Vertex
  177. 4 Bytes - FLOAT Texture Coordinate u
  178. 4 Bytes - FLOAT Texture Coordinate v
  179. end loop16
  180.  
  181. start loop17 - Repeat x times, where x is the Number of Index Buffers
  182. 2 bytes - WORD
  183. end loop17
  184.  
  185. start loop18 - Repeat x times, where x is the Number of Vertex Buffers
  186. 2 bytes - WORD
  187. end loop18
  188.  
  189.  
  190. 4 bytes - Temp
  191. if Temp != 0 -- Physique
  192. start loop19 - Repeat x times, where x is the Number of Vertices
  193. 4 bytes - Physique Vertex
  194. end loop19
  195.  
  196. 4 bytes - IsMaterial
  197. if IsMaterial != 0 -- IsMaterial = True
  198. 4 bytes - MaxMaterial
  199.  
  200. start loop20 - Repeat x times, where x is the Number of Materials
  201. //68 bytes - D3D9MATERIAL it is built like this:
  202. 16 bytes - D3DCOLORVALUE Diffuse Color with r(ed), g(reen), b(blue), a(lpha)
  203. 16 bytes - D3DCOLORVALUE Ambient Color with r(ed), g(reen), b(blue), a(lpha)
  204. 16 bytes - D3DCOLORVALUE Specular Color with r(ed), g(reen), b(blue), a(lpha)
  205. 16 bytes - D3DCOLORVALUE Emissive Color with r(ed), g(reen), b(blue), a(lpha)
  206. 4 bytes - FLOAT Power of the Color
  207.  
  208. 4 bytes - Bitmap Filename Length
  209. 4 bytes - Bitmap Filename
  210. end loop20
  211.  
  212. 4 bytes - Vertex Buffer Material Block
  213.  
  214. if Vertex Buffer Material Block > 31
  215. ERROR - Return FAIL
  216. if Vertex Buffer Material Block > 0
  217. start loop8 - Repeat x times, where x is the Number of Material Blocks
  218. //136 bytes - MATERiAL_BLOCK it is built like this:
  219. 4 bytes - Start Vertex
  220. 4 bytes - Primitive Count
  221. 4 bytes - Texture ID
  222. 4 bytes - DWORD Effect
  223. 4 bytes - Amount
  224. 4 bytes - Number of Bones
  225. 28*4 bytes - INT ARRAY Bone
  226. end loop8
  227.  
  228. if Version > 20
  229. 4 bytes - Attribute
  230. if Attribute == Frame Count
  231. start loop21 - Repeat x times, while x is equal to Frame Count
  232. //12 bytes - MOTION_ATTR it is build like this:
  233. 4 bytes - DWORD Attribue
  234. 4 bytes - Sound ID
  235. 4 bytes - FLOAT Frame
  236. end loop21
Advertisement
Add Comment
Please, Sign In to add comment