Crate tmf

Source
Expand description

TMF: 3D model format, compressing meshes by up to 89%!

§What is the goal of tmf

TMF is a lossy file format focused on:

  1. High compression without sacrificing model looks
  2. Very high decode speeds
  3. Simplicity, both of the API, and underlying compression methods.
  4. Being explicit: no change to a model may occur without it being explicitly allowed by the user. This does increase complexity of the API slightly, but also makes changes in models more clear.

§Feature flags

  • triangulation — Experimental triangulation in .obj loader. Supports only convex polygons ATM, and has bugs, triangulating your mesh in 3D modelling software before importing highly advised. Please note that if you see any triangles missing this is likely the result of the triangulation algorithm not working properly.
  • fast_trig — Changes the sin and cos function used in reading the tmf files for a potentially faster, but less accurate functions.
  • double_precision — Changes the precision of read data from single to double point precision.
  • long_indices — Changes the index format to long(u64) in order to support reading models with over 2^32 - 1 points, at cost of increased memory footprint.
  • short_indices — Changes the index format to short(u16), decreasng memory footprint, but limiting max model vertex count to 2^16 - 1(65535).
  • byte_rw — Changes the internal setting of the unaligned reader to use different data size. Can be beneficial for small models on some systems.
  • obj_import (enabled by default) — Adds the ability to import/export .obj files.
  • tokio_runtime — Use the tokio runtime, significantly increasing performance of synchronous loads, at the cost of minor compile time increase.

Structs§

NormalPrecisionMode
Setting dictating how much can any normal in a model deviate, expressed as an angle.
TMFMesh
Representation of a TMF mesh. Can be loaded from disk, imported from diffrent format, saved to disk, and exported to a diffrent format, or created using special functions. Any mesh created at run time should but does not have to be checked before saving with Self::verify call. If the mesh is known to be OK before saving this step can be skipped(even tough it is still advised).
TMFPrecisionInfo
Settings for saving of a TMF mesh.
TangentPrecisionMode
A value specifying how precise saved (x,y,z) values must be.
UvPrecisionMode
Setting dictating how precisely the UV coordinates should be saved.
VertexPrecisionMode
Setting dictating how much the length of any edge can change because of vertex precision loss during saving. This is expressed as a fraction of the length of the shortest edge.

Enums§

CustomData
Custom mesh data.
DataSegmentError
An enum representing error, which occurred while adding a segment counting custom mesh data.
TMFExportError
An error which occured when a TMFMesh is exported.
TMFImportError
An enum describing an error that occurred during loading a TMF mesh.
TMFIntegrityStatus
Enum representing the result of integrity check.

Type Aliases§

FloatType
Type used for representing floating-point numbers.
HandednessType
A value describing handedness of tangent.
IndexType
Index type used for representing triangle indices.
Tangent
A representation of a Tangent.
Vector2
Type used for representing 2d floating-point vectors
Vector3
Type used for representing 3d floating-point vectors
Vector4
Type used for representing 4d floating-point vectors