gameplay-bundle.txt 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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 FontFormat
  86. {
  87. BITMAP = 0,
  88. DISTANCE_FIELD = 1
  89. }
  90. enum PrimitiveType
  91. {
  92. TRIANGLES = GL_TRIANGLES (4),
  93. TRIANGLE_STRIP = GL_TRIANGLE_STRIP (5),
  94. LINES = GL_LINES (1),
  95. LINE_STRIP = GL_LINE_STRIP (3),
  96. POINTS = GL_POINTS (0)
  97. }
  98. enum IndexFormat
  99. {
  100. INDEX8 = GL_UNSIGNED_BYTE (0x1401),
  101. INDEX16 = GL_UNSIGNED_SHORT (0x1403),
  102. INDEX32 = GL_UNSIGNED_INT (0x1405)
  103. }
  104. enum NodeType
  105. {
  106. NODE = 1,
  107. JOINT = 2
  108. }
  109. Object Definitions
  110. ==================
  111. TypeID->Name Member Type
  112. ------------------------------------------------------------------------------------------------------
  113. Reference
  114. id string
  115. type uint
  116. offset uint
  117. ------------------------------------------------------------------------------------------------------
  118. 1->Scene
  119. nodes Node[]
  120. activeCameraNode xref:Node
  121. ambientColor float[3]
  122. ------------------------------------------------------------------------------------------------------
  123. 2->Node
  124. type enum NodeType
  125. transform float[16]
  126. parent_id string
  127. children Node[]
  128. camera Camera
  129. light Light
  130. model Model
  131. ------------------------------------------------------------------------------------------------------
  132. 3->Animations
  133. animations Animation[]
  134. ------------------------------------------------------------------------------------------------------
  135. 4->Animation
  136. id string
  137. channels AnimationChannel[]
  138. -----------------------------------------------------------------------------------------------------
  139. 5->AnimationChannel
  140. targetId string
  141. targetAttribute uint
  142. keyTimes uint[] (milliseconds)
  143. values float[]
  144. tangents_in float[]
  145. tangents_out float[]
  146. interpolation uint[]
  147. ------------------------------------------------------------------------------------------------------
  148. 11->Model
  149. mesh xref:Mesh
  150. meshSkin MeshSkin
  151. materials Material[]
  152. ------------------------------------------------------------------------------------------------------
  153. 16->Material
  154. parameters MaterialParameter[] { string name, float[] value, uint type }
  155. effect xref:Effect
  156. ------------------------------------------------------------------------------------------------------
  157. 17->Effect
  158. vertexShader string
  159. fragmentShader string
  160. ------------------------------------------------------------------------------------------------------
  161. 32->Camera
  162. cameraType byte {perspective|orthographic}
  163. aspectRatio float
  164. nearPlane float
  165. farPlane float
  166. [ cameraType : perspective
  167. fieldOfView float
  168. ]
  169. [ cameraType : orthographic
  170. magnification float[2]
  171. ]
  172. ------------------------------------------------------------------------------------------------------
  173. 33->Light
  174. lightType byte {directional|point|spot}
  175. color float[3]
  176. [ lightType : point
  177. range float
  178. ]
  179. [ lightType : spot
  180. range float
  181. innerAngle float (in radians)
  182. outerAngle float (in radians)
  183. ]
  184. ------------------------------------------------------------------------------------------------------
  185. 34->Mesh
  186. vertexFormat VertexElement[] { enum VertexUsage usage, unint size }
  187. vertices byte[]
  188. boundingBox BoundingBox { float[3] min, float[3] max }
  189. boundingSphere BoundingSphere { float[3] center, float radius }
  190. parts MeshPart[]
  191. ------------------------------------------------------------------------------------------------------
  192. 35->MeshPart
  193. primitiveType enum PrimitiveType
  194. indexFormat enum IndexFormat
  195. indices byte[]
  196. ------------------------------------------------------------------------------------------------------
  197. 36->MeshSkin
  198. bindShape float[16]
  199. joints xref:Node[]
  200. jointsBindPoses float[] // 16 * joints.length
  201. boundingBox BoundingBox { float[3] min, float[3] max }
  202. boundingSphere BoundingSphere { float[3] center, float radius }
  203. ------------------------------------------------------------------------------------------------------
  204. 128->Font
  205. family string
  206. style enum FontStyle
  207. size uint
  208. charset string
  209. glyphs Glyph[] { uint index, uint width, float[4] uvCoords }
  210. texMapWidth uint
  211. texMapHeight uint
  212. texMap byte[]
  213. format enum FontFormat @since version [1,3]