Skip to content

format file syntax v1.0.0

Paweł Waligóra edited this page Sep 17, 2024 · 10 revisions

Format file syntax

You are reading old version of format file syntax for most recent version refer to: format file syntax.

File structure

Format file consists of preamble and buffers.
1st line always describes the preamble rest describe buffers 1 line - 1 buffer.

Each buffer has it's own preamble and field definitions.

File structure is as follows:

preamble
buffer_preamble field field field
buffer_preamble field field
buffer_preamble field field field field

Preambles

Preambles can be constructed form a set of key-words and constants.
Each key-word determines one (or more) value that will be written to the output file in a binary form.
Functionality of key-words depends on weather they describe buffer_preamble or main preamble.
Available key-words:

Values will be written to the output file in the same order as their corresponding key-words are written in .format file.

For information on what values exactly each of the key-words will write to the output file visit dedicated pages.

Size and counting base

Additionally key-words might have attached size and counting base specification: eg. buffc2 or buffs4_4.
size determines on how many bytes should the value be written. counting base allows to reduce the value - value will be divided by counting base. counting base is only applicable to size values ( the ones ending with s eg. buffs )

Available sizes and counting bases are: 1, 2, 4 and 8.

By default (if not explicitly specified) size and counting base are set to 4.
You cannot specify counting base without specifying size. For example buffs_4 will return unknown statement error.

Fields

Field definition consists of a type indicator and value or suffix.
Available types:

  • variable types:
    • i - indice
    • v - vertex
    • n - normal
    • t - tangent
    • b - bitangent
    • c - texture coordinate / uv set 0
    • 0 - uv set 0
    • 1 - uv set 1
    • 2 - uv set 2
    • 3 - uv set 3
    • 4 - uv set 3
    • 5 - uv set 5
    • 6 - uv set 6
    • 7 - uv set 7
  • constant value types:
    • f - 4 byte floating point value
    • u - 4 byte unsigned integer value

Available suffixes:

  • x - 1st component
  • y - 2nd component
  • z - 3rd component
  • 0 - 1st component
  • 1 - 2nd component
  • 2 - 3rd component
  • 3 - 4th component
  • r - 1st component
  • g - 2nd component
  • b - 3rd component
  • a - 4th component
  • u - 1st component
  • v - 2nd component
  • w - 3rd component

variable type field must be paired with a suffix (eg. vx - x component of a vertex position). Suffixes don't have types you can pair any suffix with any variable type (ny, ng, n1 are equivalent - each defines 2nd or y component of normal vector).

constant value type field must be followed by a value (eg. u213 - constant value of 213, or f0.125 - constant value of 0.125).

Field declaration will write many values to output file. How many depends on the mesh that is being processed as well as on declared variable types. Read field counting rules for more info.

Examples

#1


fielde i0 i1 i2
fielde vx vy vz f1.0
fielde nx ny nz f0.0
fielde 0x 0y
fielde tx bx nx ty by ny tz bz nz

File above will produce:

  • index list
  • list of vertices in homogeneous coordinates
  • list of normals in homogeneous coordinates
  • list of texture coordinates form texture set 0
  • list of inverted TBN matrices in column major storage format

Before each list the amount of values to read will be appended

Clone this wiki locally