Skip to main content

Module gltf

Module gltf 

Source
Expand description

glTF export support for RigidModel 3D models.

This module provides functionality to convert Total War’s proprietary RigidModel format (.rigid_model_v2) to the standard glTF 2.0 format. glTF is widely supported by 3D modeling software like Blender, Maya, and 3ds Max.

§Features

  • Mesh Export: Vertex positions, normals, and texture coordinates
  • Material Support: Basic material properties and texture references
  • LOD Levels: Each LOD (Level of Detail) is exported as a separate scene
  • Embedded Data: Binary data is base64-encoded inline (no external files)

§Limitations

  • Animations are not exported (RigidModel doesn’t contain animation data)
  • Some advanced material properties may not translate directly to glTF
  • Skeleton/rigging data export is limited

§Usage Example

use rpfm_extensions::gltf::gltf_from_rigid;

// Convert RigidModel to glTF
let gltf = gltf_from_rigid(&rigid_model, &mut dependencies)?;

// Write to file
let file = File::create("output.gltf")?;
gltf.to_writer(file)?;

§Output Format

The exported glTF uses the JSON format (.gltf) with embedded binary data rather than the binary format (.glb). This makes the files larger but easier to inspect and debug.

§Dependencies Integration

The export process can optionally use the Dependencies cache to resolve texture references and include texture data in the export.

Re-exports§

pub use gltf::json;

Structs§

Document
glTF JSON wrapper.
Gltf
glTF JSON wrapper plus binary payload.

Functions§

gltf_from_rigid
Converts a RigidModel to glTF format.
rigid_from_gltf
NOT YET IMPLEMENTED.
save_gltf_to_disk