[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Meshes often require specification of a large amount of data for e.g. mesh positions, texture coordinates or triangle indices. Crystal Space has a general format for storing such bulk data, giving a unified syntax for different types of mesh objects allowing storing both in an XML-based format or a compact binary format.
The top element has no fixed name; rather, it differs from mesh object to mesh object. However, all top buffer elements have a common set of attributes.
file
Specifies a file name for an external file with the buffer data in a binary representation (see below). If set, all other attributes are ignored.
type
Required: attribute identifying the type of the contained data in memory. Possible values: ‘int’ (or short ‘i’) - signed 32 bit integer, ‘uint’ (‘ui’) - unsigned 32 bit integer, ‘byte’ (‘b’) - signed 8 bit integer, ‘ubyte’ (‘ub’) - unsigned 8 bit integer, ‘short’ (‘s’) - signed 16 bit integer, ‘ushort’ (‘us’) - unsigned 16 bit integer, ‘float’ (‘f’) - 32 bit IEEE 754 floating point value, ‘double’ (‘d’) - 64 bit IEEE 754 floating point value.
components
Required: number of components per element in the buffer.
normalized
Optional: specifies whether the buffer contains normalized data in case of (unsigned) integer data. Normalized means the values are normnalized to floats in the range of [0;1] (unsigned values) resp. [-1;1] (signed values) when used. Unnormalized data is not changed.
indices
Optional: specifies whether the buffer is an index buffer. Index buffers are handled differently internally and thus must be designated as such. They have the restriction that they can have at most one component, can not contain float data and can not be normalized.
Note that some meshes may specify additional attributes in buffer elements.
Each element in the buffer is specified as an XML element under the top element, with the individual components being specified in element attributes.
The XML elements have the name ‘element’ or short ‘e’.
The attribute names for the individual components are ‘c0’ for the first component, ‘c1’ for the second component and so on.
Overall, a binary buffer file contains a header with information about the structure of the file (essentially what you would specify in the top element attributes in the XML format) followed by the raw buffer data. Index and general buffers have a similar but slightly different format. All values are stored in little endian byte order.
uint16 magic
Magic word identifying a file as a general buffer file. Must be 0x6272
.
uint8 componentType
The type of components stored in the buffer. The values are the same as in the
csRenderBufferComponentType
enum.
uint8 componentCount
Number of components in per element in the buffer.
uint32 elementCount
Number of elements in the buffer.
uint16 magic
Magic word identifying a file as a general buffer file. Must be 0x6269
.
uint8 componentType
The type of components stored in the buffer. The values are the same as in the
csRenderBufferComponentType
enum. Can not be a floating point or
normalized type.
uint8 componentCount
Number of components in per element in the buffer. Must be 1.
uint32 elementCount
Number of elements in the buffer.
uint32 rangeStart
Value of the smallest element in the buffer.
uint32 rangeEnd
Value of the largest element in the buffer.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated using texi2html 1.76.