| Crates.io | asset-importer-rs-gltf |
| lib.rs | asset-importer-rs-gltf |
| version | 0.3.0 |
| created_at | 2025-05-27 23:42:59.3974+00 |
| updated_at | 2025-07-28 23:54:39.30261+00 |
| description | GLTF module for asset-importer-rs |
| homepage | |
| repository | https://github.com/crazyjackel/asset-importer-rs |
| max_upload_size | |
| id | 1692104 |
| size | 282,199 |

asset-importer-rs-gltf provides comprehensive glTF 2.0 import and export functionality for the asset-importer-rs project. This implementation supports the full glTF 2.0 specification including all major extensions, making it a complete solution for working with glTF assets in Rust applications.
This crate provides the essential functionality for:


The following glTF extensions are fully supported:


Add the following to your Cargo.toml:
[dependencies]
asset-importer-rs-gltf = "0.3.0"
# Or for development from source:
asset-importer-rs-gltf = { path = "../path/to/asset-importer-rs-gltf" }
# Enable specific extensions as needed
[features]
default = [
"guess_mime_type",
"extensions",
"KHR_texture_transform",
"KHR_materials_unlit",
"KHR_materials_transmission",
"KHR_materials_ior",
"KHR_materials_volume",
"KHR_materials_specular",
"KHR_materials_pbrSpecularGlossiness",
"KHR_materials_emissive_strength",
"KHR_lights_punctual",
]

Basic glTF import example:
use asset_importer_rs_gltf::{
Gltf2Importer,
Gltf2ImportError,
};
use std::path::Path;
// Create an importer
let importer = Gltf2Importer::new();
// Import a glTF file
let scene = importer.import_file(Path::new("model.gltf"))?;
// Access scene data
println!("Scene has {} meshes", scene.meshes.len());
println!("Scene has {} materials", scene.materials.len());
Basic glTF export example:
use asset_importer_rs_gltf::{
Gltf2Exporter,
Gltf2ExportError,
};
use asset_importer_rs_scene::AiScene;
// Create an exporter
let exporter = Gltf2Exporter::new();
// Export scene to glTF
let scene = AiScene::default(); // Your scene data
exporter.export_file(&scene, Path::new("output.gltf"))?;
Working with extensions:
use asset_importer_rs_gltf::Gltf2Importer;
// Create importer with specific extension support
let mut importer = Gltf2Importer::new();
importer.enable_extension("KHR_materials_unlit")?;
importer.enable_extension("KHR_lights_punctual")?;
// Import with extension support
let scene = importer.import_file("model_with_extensions.gltf")?;

The glTF crate provides a complete implementation of the glTF 2.0 specification with a modular architecture that separates import and export concerns. The importer handles scene graph construction, material processing, and mesh optimization, while the exporter manages serialization, texture handling, and extension support.
The crate integrates seamlessly with the asset-importer-rs ecosystem, providing glTF-specific implementations of the core import/export traits while maintaining compatibility with the broader 3D asset pipeline.


This project is part of the asset-importer-rs workspace and follows its licensing terms. See the main project LICENSE file for details.
Copyright (c) 2024 Jackson Levitt