Module ssbh_data::mesh_data

source ·
Expand description

Types for working with Mesh data in .numshb files.

Each MeshData describes the objects for a model. Objects are uniquely identified by a name and subindex value. This allows for assigning data from other files like .numatb.

The .numshb files interleave different attributes for each vertex in up to 4 vertex buffers. This is sometimes referred to as “array of structs” layout since the data for each vertex is contiguous. A shared buffer can be desirable for rendering but is harder for applications to work with. ssbh_data instead uses a “struct of arrays” layout where each attribute’s data is a VectorData. This can make it easier and more efficient to perform operations on a single attribute like normals. The conversion to the conventional buffer layout for the specified version is handled automatically when saving or converting to Mesh.

§File Differences

Unmodified files are not guaranteed to be binary identical after saving. VectorData uses f32, which has enough precision to encode all known data types used for Mesh buffers. When converting to Mesh, the buffers are rebuilt using data types selected to balance precision and space based on the attribute’s usage. The resulting buffer is often identical in practice, but this depends on the original file’s data types.

Bounding information is recalculated on export and is unlikely to match the original file due to algorithmic differences and floating point errors. The current algorithm is efficient but often overestimates the required bounding sphere size.

Modules§

Structs§

  • Data corresponding to a named vertex attribute such as "Position0" or "colorSet1".
  • A collection of vertex weights for all the vertices influenced by a bone.
  • The data associated with a Mesh file. Supported versions are 1.8, 1.9, and 1.10.
  • The data associated with a MeshObject.
  • Assigns a weight to a particular vertex.

Enums§

Functions§