BTG file format: Difference between revisions

Jump to navigation Jump to search
Added description of vertex and normal list
(Initial version)
(Added description of vertex and normal list)
Line 146: Line 146:
| Index Types
| Index Types
|}
|}
Similarily, each element starts with a single unsigned integer, giving the number of bytes the element's data occupies.


=== Bounding Sphere Object ===
=== Bounding Sphere Object ===


The Bounding Sphere object gives the bounding sphere of the tile, defined by a center and a radius.
The Bounding Sphere object gives the bounding sphere of the tile, defined by a center and a radius.
The properties of a Bounding Sphere are ignored.


The elements of the Bounding Sphere object are bounding spheres.
The elements of the Bounding Sphere object are bounding spheres.
Line 161: Line 165:
|-
|-
| align="right"| 0
| align="right"| 0
| unsigned int
| number of bytes in this element
|-
| align="right"| 4
| double
| double
| X-part of the center
| x-part of the center
|-
|-
| align="right"| 8
| align="right"| 12
| double
| double
| y-part of the center
| y-part of the center
|-
|-
| align="right"| 16
| align="right"| 20
| double
| double
| z-part of the center
| z-part of the center
|-
|-
| align="right"| 24
| align="right"| 28
| float
| float
| radius of the bounding sphere
| radius of the bounding sphere
|}
|}
Note that the element may be longer than 32 bytes, but only the first 32 bytes are actually used.


=== Vertex List ===
=== Vertex List ===


TODO
The Vertex List object contains a list of vertices to be referenced by other geometry primitives.
 
The properties of a Vertex List object are ignored.
 
Each element of a Vertex List object is a list of vertices.
Each of the vertices gets a unique index, starting with 0 for the first vertex found in the file and incrementing by 1 for each further vertex.
 
{| border="1"
|-
! Byte offset
! Type
! Description
|-
| align="right"| 0
| unsigned int
| number of bytes in this element
|-
| align="right"| 4
| vertices
| vertex list
|}
 
Each vertex is a triple of single precision floating point values:
 
{| border="1"
|-
! Byte offset
! Type
! Description
|-
| align="right"| 0
| float
| x-part of the vertex coordinates
|-
| align="right"| 4
| float
| y-part of the vertex coordinates
|-
| align="right"| 8
| float
| z-part of the vertex coordinates
|}
 
The number of vertices in an element is therefore the number of bytes in the element divided by 12.


=== Normal List ===
=== Normal List ===


TODO
The Normal List contains a list of normals to be referenced by other geometry primitives.
 
The properties of a Normal List object are ignored.
 
Each element of a Normal List object is a list of normals.
Each of the normals gets a unique index, starting with 0 for the first normal found in the file and incrementing by 1 for each further normal.
 
{| border="1"
|-
! Byte offset
! Type
! Description
|-
| align="right"| 0
| unsigned int
| number of bytes in this element
|-
| align="right"| 4
| normals
| normal list
|}
 
Each normal is a triple of signed bytes, interpreted as fixed point values:
 
{| border="1"
|-
! Byte offset
! Type
! Description
|-
| align="right"| 0
| byte
| x-part of the normal coordinates
|-
| align="right"| 1
| byte
| y-part of the normal coordinates
|-
| align="right"| 2
| byte
| z-part of the normal coordinates
|}
 
The individual parts are interpreted by dividing each of the parts by 127.5 and subtracting 1.0, leading to a linear mapping from the range of 0...255 to the range of -1.0...1.0.


=== Texture Coordinates List ===
=== Texture Coordinates List ===
26

edits

Navigation menu