gameplay-bundle.txt 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. gameplay Bundle File Format (.gpb)
  2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3. File Description
  4. ================
  5. A simple binary bundle file format supporting definition of primitive and built-in objects.
  6. File Extension and Mime Type
  7. ============================
  8. File extension is '.gpb' and the mime type is 'application/gpb'
  9. File Structure
  10. ==============
  11. Section Name Type
  12. ------------------------------------------------------------------------------------------------------
  13. Header
  14. Identifier byte[9] = { '\xAB', 'G', 'P', 'B', '\xBB', '\r', '\n', '\x1A', '\n' }
  15. Version byte[2] = { 1, 1 }
  16. References Reference[]
  17. Data
  18. Objects Object[]
  19. Objects
  20. =======
  21. Supported object types are defined in the table below. Object with unique ids are included
  22. in the Reference table (see below).
  23. References
  24. ==========
  25. A Reference is an Object that has a unique id. The Reference contains the unique id of the
  26. object, a uint for the TypeID a uint for the offset into the package for the object definition.
  27. ID's
  28. ====
  29. Object ID's are represented as a string which is guaranteed to be unique per file.
  30. Any object which host an object id should be added to the header Reference table so that it can
  31. be consumed by reference internally and externally.
  32. Xrefs
  33. =====
  34. Xrefs are string with a specific format used for referencing objects internal and external to
  35. a package. An xref with the format "#id" references an object within the current package with
  36. the given ID. Xrefs can also have the format "file#id", where "file" is the name of package file
  37. (relative to the location of the current package) and "id" is the unique identifier of an object
  38. in that bundle.
  39. Primitives
  40. ==========
  41. Name Description
  42. ------------------------------------------------------------------------------------------------------
  43. string 8-bit char array prefixed by unint for length encoding.
  44. bool 8-bit unsigned char false=0, true=1.
  45. byte 8-bit unsigned char
  46. uint 32-bit unsigned int, stored as four bytes, lowest byte first.
  47. int 32-bit signed int, stored as four bytes, lowest byte first.
  48. float 32-bit float, stored as four bytes, with the least significant
  49. byte of the mantissa first, and the exponent byte last.
  50. enum X A uint which is restricted to values from the given enum name "X".
  51. Arrays
  52. ======
  53. Arrays of constant length are simply the array of data for the expected type.
  54. Arrays of dynamic size length(uint) encoded followed by expected type of data.
  55. Notation: byte[3] - constant length notation = byte[3]
  56. int[] - dynamic length notation = length+int[count]
  57. Mesh[] - dynamic length notation = length+Mesh[count]
  58. Enums
  59. =====
  60. enum VertexUsage
  61. {
  62. POSITION = 1,
  63. NORMAL = 2,
  64. COLOR = 3,
  65. TANGENT = 4,
  66. BINORMAL = 5,
  67. BLENDWEIGHTS = 6,
  68. BLENDINDICES = 7,
  69. TEXCOORD0 = 8,
  70. TEXCOORD1 = 9,
  71. TEXCOORD2 = 10,
  72. TEXCOORD3 = 11,
  73. TEXCOORD4 = 12,
  74. TEXCOORD5 = 13,
  75. TEXCOORD6 = 14,
  76. TEXCOORD7 = 15
  77. }
  78. enum FontStyle
  79. {
  80. PLAIN = 0,
  81. BOLD = 1,
  82. ITALIC = 2,
  83. BOLD_ITALIC = 4
  84. }
  85. enum PrimitiveType
  86. {
  87. TRIANGLES = GL_TRIANGLES (4),
  88. TRIANGLE_STRIP = GL_TRIANGLE_STRIP (5),
  89. LINES = GL_LINES (1),
  90. LINE_STRIP = GL_LINE_STRIP (3),
  91. POINTS = GL_POINTS (0)
  92. }
  93. enum IndexFormat
  94. {
  95. INDEX8 = GL_UNSIGNED_BYTE (0x1401),
  96. INDEX16 = GL_UNSIGNED_SHORT (0x1403),
  97. INDEX32 = GL_UNSIGNED_INT (0x1405)
  98. }
  99. enum NodeType
  100. {
  101. NODE = 1,
  102. JOINT = 2
  103. }
  104. Object Definitions
  105. ==================
  106. TypeID->Name Member Type
  107. ------------------------------------------------------------------------------------------------------
  108. Reference
  109. id string
  110. type uint
  111. offset uint
  112. ------------------------------------------------------------------------------------------------------
  113. 1->Scene
  114. nodes Node[]
  115. activeCameraNode xref:Node
  116. ambientColor float[3]
  117. ------------------------------------------------------------------------------------------------------
  118. 2->Node
  119. type enum NodeType
  120. transform float[16]
  121. parent_id string
  122. children Node[]
  123. camera Camera
  124. light Light
  125. model Model
  126. ------------------------------------------------------------------------------------------------------
  127. 3->Animations
  128. animations Animation[]
  129. ------------------------------------------------------------------------------------------------------
  130. 4->Animation
  131. id string
  132. channels AnimationChannel[]
  133. -----------------------------------------------------------------------------------------------------
  134. 5->AnimationChannel
  135. targetId string
  136. targetAttribute uint
  137. keyTimes uint[] (milliseconds)
  138. values float[]
  139. tangents_in float[]
  140. tangents_out float[]
  141. interpolation uint[]
  142. ------------------------------------------------------------------------------------------------------
  143. 11->Model
  144. mesh xref:Mesh
  145. meshSkin MeshSkin
  146. materials Material[]
  147. ------------------------------------------------------------------------------------------------------
  148. 16->Material
  149. parameters MaterialParameter[] { string name, float[] value, uint type }
  150. effect xref:Effect
  151. ------------------------------------------------------------------------------------------------------
  152. 17->Effect
  153. vertexShader string
  154. fragmentShader string
  155. ------------------------------------------------------------------------------------------------------
  156. 32->Camera
  157. cameraType byte {perspective|orthographic}
  158. aspectRatio float
  159. nearPlane float
  160. farPlane float
  161. [ cameraType : perspective
  162. fieldOfView float
  163. ]
  164. [ cameraType : orthographic
  165. magnification float[2]
  166. ]
  167. ------------------------------------------------------------------------------------------------------
  168. 33->Light
  169. lightType byte {directional|point|spot}
  170. color float[3]
  171. [ lightType : point
  172. range float
  173. ]
  174. [ lightType : spot
  175. range float
  176. innerAngle float (in radians)
  177. outerAngle float (in radians)
  178. ]
  179. ------------------------------------------------------------------------------------------------------
  180. 34->Mesh
  181. vertexFormat VertexElement[] { enum VertexUsage usage, unint size }
  182. vertices byte[]
  183. boundingBox BoundingBox { float[3] min, float[3] max }
  184. boundingSphere BoundingSphere { float[3] center, float radius }
  185. parts MeshPart[]
  186. ------------------------------------------------------------------------------------------------------
  187. 35->MeshPart
  188. primitiveType enum PrimitiveType
  189. indexFormat enum IndexFormat
  190. indices byte[]
  191. ------------------------------------------------------------------------------------------------------
  192. 36->MeshSkin
  193. bindShape float[16]
  194. joints xref:Node[]
  195. jointsBindPoses float[] // 16 * joints.length
  196. boundingBox BoundingBox { float[3] min, float[3] max }
  197. boundingSphere BoundingSphere { float[3] center, float radius }
  198. ------------------------------------------------------------------------------------------------------
  199. 128->Font
  200. family string
  201. style enum FontStyle
  202. size uint
  203. charset string
  204. glyphs Glyph[] { uint index, uint width, float[4] uvCoords }
  205. texMapWidth uint
  206. texMapHeight uint
  207. texMap byte[]