26
edits
RalfGerlich (talk | contribs) |
RalfGerlich (talk | contribs) |
||
Line 221: | Line 221: | ||
| align="right"| 0 | | align="right"| 0 | ||
| float | | float | ||
| x-part of the vertex | | x-part of the vertex coordinate | ||
|- | |- | ||
| align="right"| 4 | | align="right"| 4 | ||
| float | | float | ||
| y-part of the vertex | | y-part of the vertex coordinate | ||
|- | |- | ||
| align="right"| 8 | | align="right"| 8 | ||
| float | | float | ||
| z-part of the vertex | | z-part of the vertex coordinate | ||
|} | |} | ||
Line 375: | Line 375: | ||
The number of coordinates in an element is therefore the number of bytes in the element divided by 16. | The number of coordinates in an element is therefore the number of bytes in the element divided by 16. | ||
=== | === Geometry Objects === | ||
All geometry objects are structured the same way, with each element consisting of a list of index-tuples referencing vertex, normal, color and texture coordinate lists. | |||
Each geometry object may have a '''Material''' and an '''Index Types''' property. | |||
The material is a string (not null-terminated) indicating the name of the material. | |||
There are some special types of materials reserved to indicate that the geometry represents lights instead of solid structure. | |||
The '''Index Types''' property is a single byte containing bit field indicating the lists referenced by each entry in the tuple-list. | |||
The meaning of the bits is given in the following table: | |||
{| border="1" | |||
|- | |||
! Bit Number | |||
! Description | |||
|- | |||
| align="right"| (least significant) 0 | |||
| Each entry has a vertex index | |||
|- | |||
| align="right"| 1 | |||
| Each entry has a normal index | |||
|- | |||
| align="right"| 2 | |||
| Each entry has a color index | |||
|- | |||
| align="right"| 3 | |||
| Each entry has a texture coordinate index | |||
|} | |||
If no '''Index Types''' property is given, the tuples contain a vertex and a texture coordinate index. | |||
The only exception is the Point object type, which only has vertex indices by default. | |||
Each element of the object is a list of tuples, containing one or more unsigned integers in the following order: | |||
# Vertex Index, | |||
# Normal Index, | |||
# Color Index, and | |||
# Texture Coordinate Index. | |||
Only those fields indicated by the '''Index Types''' property are included in the file. | |||
For example, if the '''Index Types''' property indicates that each entry has only a vertex index and a normal index, each entry consists of 8 byte, the first 4 bytes containing the vertex index and the second 4 bytes containing the normal index. | |||
The indices reference the respective lists, i.e. the vertex index references the vertex list. | |||
==== Points ==== | |||
In case of the Points object type, each of the elements represents a single point, e.g. a point lightsource. | |||
==== Individual Triangles ==== | |||
In case of the Triangle object type, three succeeding elements are combined to form the vertices of a single triangle. | |||
To represent <code>n</code> triangles the list must therefore contain <code>3*n</code> elements. | |||
==== Triangle Strips ==== | |||
The Triangle Strips object type also represents triangles, but in a more compact form. Any three succeeding elements in the list represent a triangle. | |||
In order to represent <code>n</code> triangles the list must therefore contain <code>n+2</code> elements. | |||
=== Triangle Fans === | ==== Triangle Fans ==== | ||
Triangle Fans are similar to Triangle Strips. | |||
However, in case of triangle fans, all triangles share the first element and the other two triangle vertices are provided in pairs of elements, representing a fan of triangles around a single vertex. | |||
To represent <code>n</code> triangles the list must therefore contain <code>2*n+1</code> elements. |
edits