ugm

Crates.iougm
lib.rsugm
version0.0.1
created_at2025-03-27 12:14:30.095035+00
updated_at2025-03-27 12:14:30.095035+00
descriptionUniversal game model is a minimal crate designed as a high performance model format.
homepagehttps://github.com/TemporalInteractive/ugm
repositoryhttps://github.com/TemporalInteractive/ugm
max_upload_size
id1607873
size5,923,193
Jason de Wolff (JasondeWolff)

documentation

README

🌐 Universal Game Model

ugm crate

Universal game model is a minimal crate designed as a high performance model format. Loading times can be very slow when repeatedly parsing a glTF model into a custom engine representation over and over each time a game is loaded up. Ugm solves this by allowing you to convert a glTF model into a ugm model once at bake time, after which it can be loaded directly as is with a 10x performance improvement!

Features

  • glTF parsing
  • Bc texture compression
  • Normal & tangent generation
  • Vertex packing
  • Mipmap generation
  • Astc texture compression

Usage

Serialization and deserialization are handled by speedy. For more info please look at their docs.

use ugm::{parser::ParseOptions, texture::TextureCompression, Model};

// Get the bytes of your model, more commonly you'd read it from a file
let gltf_model_bytes: &[u8; 0] = include_bytes!("ToyCar.glb");

// Parse a glTF model into a ugm model, this is relatively slow and shouldn't happen each time the application is launched
let ugm_model: Model = Model::parse_glb(
    gltf_model_bytes,
    ParseOptions {
        // Optional texture compression, this will increase parse duration
        texture_compression: Some(TextureCompression::Bc),
    },
)
.expect("Failed to parse glTF model.");

// Serialize ugm model into bytes
let ugm_model_bytes: Vec<u8> = ugm_model.write_to_vec().unwrap();

// Here you'd want to write out the serialized ugm model, which can then be loaded the next times the application is launched...

// Deserialize bytes into a ugm model
let ugm_model = Model::read_from_buffer(&ugm_model_bytes).unwrap();
Commit count: 27

cargo fmt