io7m | single-page | multi-page | SMF Format Specification 0.16.0-SNAPSHOT
4.1. Overview
Previous
4. SMF/T - Text Encoding
Up
4.3. Sections
Next

# 4.2. Section - smf

- 4.2.1. Definition
- 4.2.2. Subcommands
- 4.2.3. Subcommand - attribute
- 4.2.4. Subcommand - coordinates
- 4.2.5. Subcommand - endianness
- 4.2.6. Subcommand - schema
- 4.2.7. Subcommand - triangles
- 4.2.8. Subcommand - vertices

## 4.2.1. Definition

1
The smf section specifies the major and minor version of the specification to which the rest of the file is expected to conform. The first argument specifies the major version, and the second argument specifies the minor version. Implementations MUST immediately reject files that are of unsupported major versions, and MUST halt processing of the rest of the file if the version numbers cannot be parsed.
2
The command takes the following arguments:

### 4.2.1.3. smf Arguments

1. The non-negative SMF major version
2. The non-negative SMF minor version

### 4.2.1.4. smf

    smf =
      "smf" , integer-unsigned , integer-unsigned ;

5
The contents of an smf section are a series of subcommands with at most one subcommand appearing on each line within the section. A subcommand consists of the subcommand's name and a series of zero or more arguments. Implementations MUST ignore subcommands that have unrecognized names, but SHOULD log warning messages to indicate that unrecognized subcommands have been specified.

## 4.2.2. Subcommands

1
This version of the specification defines the following smf subcommands:

### 4.2.2.2. Subcommands

- attribute
- coordinates
- endianness
- schema
- triangles
- vertices

## 4.2.3. Subcommand - attribute

1
The attribute subcommand specifies an attribute that will appear in the model.

### 4.2.3.2. attribute

    attribute_name_raw =
      ? [a-z_.0-9]{1,64} ? ;

    attribute_name_quoted =
      """ , attribute_name_raw , """ ;

    attribute_name =
      attribute_name_raw | attribute_name_quoted ;

    attribute_type =
      "integer-signed" | "integer-unsigned" | "float" ;

    smf_attribute =
      "attribute" , attribute_name , attribute_type , integer-unsigned , integer-unsigned ;

3
The subcommand takes the following arguments:

### 4.2.3.4. attributes Arguments

1. The name of the attribute
2. The type of the components in the attribute
3. The non-negative number of components in the attribute
4. The non-negative size in bits of an individual component

5
The subcommand is allowed to appear any number of times, but all specified attribute names must be unique.

## 4.2.4. Subcommand - coordinates

1
The coordinates subcommand specifies the coordinate space of the mesh data that will appear in the model.

### 4.2.4.2. coordinates

    axis =
      "+x" | "-x" | "+y" | "-y" | "+z" | "-z" ;

    winding_order =
      "clockwise" | "counter-clockwise" ;

    smf_coordinates =
      "coordinates" , <axis> , <axis> , <axis> , <winding_order> ;

3
The subcommand takes the following arguments:

### 4.2.4.4. coordinates Arguments

1. The axis for the right direction
2. The axis for the up direction
3. The axis for the forward direction
4. The triangle winding order

5
If the subcommand does not appear in the section, implementations MUST behave as if the following subcommand had been specified:

### 4.2.4.6. coordinates Default

    coordinates +x +y -z counter-clockwise

## 4.2.5. Subcommand - endianness

1
The endianness subcommand specifies the byte order of data that will appear in the file. Because byte ordering is irrelevant in an SMF/T file, the effect of evaluating this subcommand is to set the byte order in the parsed SMF model to the specified value. This will affect subsequent serializations of the model to formats with which byte ordering is relevant (such as SMF/B) .

### 4.2.5.2. endianness

    byte_order =
      "big" | "little" ;

    smf_attribute =
      "endianness" , byte_order ;

3
The subcommand takes the following arguments:

### 4.2.5.4. attributes Arguments

1. The name of the byte order

5
The subcommand is allowed to appear at most once. If the command does not appear, implementations MUST behave as if big-endian byte ordering was specified.

## 4.2.6. Subcommand - schema

1
The schema command specifies the schema identifier for the file.

### 4.2.6.2. schema

    smf_schema =
      "schema" , schema_name , integer-unsigned , integer-unsigned ;

3
The command takes the following arguments:

### 4.2.6.4. schema Arguments

1. The schema ID string
2. The non-negative schema major version
3. The non-negative schema minor version

## 4.2.7. Subcommand - triangles

1
The triangles subcommand specifies the number of triangles that will appear in the model, and the size of the vertex indices in bits.

### 4.2.7.2. triangles

    smf_triangles =
      "triangles" , integer-unsigned , integer-unsigned ;

3
The subcommand takes the following arguments:

### 4.2.7.4. triangles Arguments

1. The non-negative triangle count
2. The non-negative size in bits of a triangle vertex index

5
If the subcommand does not appear in the section, implementations MUST behave as if the following subcommand had been specified:

### 4.2.7.6. vertices Default

    trianges 0 32

7
Parsers MUST raise an appropriate error if a non-zero triangle count is specified but no triangles are actually provided in any following section.

## 4.2.8. Subcommand - vertices

1
The vertices subcommand specifies the number of vertices that will appear in the model for each attribute.

### 4.2.8.2. vertices

    smf_vertices =
      "vertices" , integer-unsigned ;

3
The subcommand takes the following arguments:

### 4.2.8.4. vertices Arguments

1. The non-negative number of vertices that will appear in the file

5
If the subcommand does not appear in the section, implementations MUST behave as if the following subcommand had been specified:

### 4.2.8.6. vertices Default

    vertices 0

7
Parsers MUST raise an appropriate error if a non-zero vertex count is specified but no vertices are actually provided in any following section.
4.1. Overview
Previous
4. SMF/T - Text Encoding
Up
4.3. Sections
Next
io7m | single-page | multi-page | SMF Format Specification 0.16.0-SNAPSHOT