| Crates.io | russimp-ng |
| lib.rs | russimp-ng |
| version | 3.2.7 |
| created_at | 2025-08-04 11:02:42.083034+00 |
| updated_at | 2025-08-26 18:58:14.579664+00 |
| description | Assimp bindings for rust |
| homepage | https://github.com/Kek5chen/russimp-ng |
| repository | https://github.com/Kek5chen/russimp-ng |
| max_upload_size | |
| id | 1780595 |
| size | 188,246 |
Maintained Rust bindings for the Open Asset Import Library (Assimp).
russimp-ng provides idiomatic and safe Rust bindings for the popular Assimp library, enabling you to load dozens of 3D model formats into a common, usable data structure.
This crate is a maintained fork of the original russimp library, aiming to provide ongoing updates, bug fixes, and community support.
russimp-ng links to the underlying C/C++ Assimp library (system dynamic library, prebuilt static library, or build-from-source static library).First, add russimp-ng to your Cargo.toml:
[dependencies]
russimp-ng = "3.2.1"
Next, you need to decide how to link the Assimp C++ library. russimp-ng uses the russimp-sys-ng crate to manage this.
Option 1: Dynamic Linking (Default)
This is the default behavior. russimp-ng will look for a shared Assimp library installed on your system at runtime.
brew update && brew install assimpsudo apt-get update && sudo apt-get install libassimp-devsudo dnf install assimp-develassimp.dll (or similar) is accessible in your system's PATH. Using the prebuilt feature (Option 2) is often simpler on Windows.Option 2: Prebuilt Static Binaries (Recommended for Simplicity/Windows)
Use the prebuilt feature to download and statically link a precompiled version of Assimp during the build. This avoids needing Assimp installed system-wide and simplifies cross-platform builds.
[dependencies]
russimp-ng = { version = "3.2.1", features = ["prebuilt"] }
Note: Prebuilt binaries are provided via the underlying russimp-sys-ng crate's releases.
Option 3: Build Assimp Statically from Source
Use the static-link feature to download the Assimp source code, compile it, and link it statically into your binary.
[dependencies]
russimp-ng = { version = "3.2.1", features = ["static-link"] }
Build Requirements for static-link:
cmakeNinja (recommended for Linux/macOS) or Visual Studio 2019+ (Windows)Additional Feature Flags:
nozlib: (Used with static-link or prebuilt) By default, Assimp bundles its own zlib. Enable this feature if you need to use a different zlib source/version already present in your project to avoid conflicts.Load a scene from a file and apply some post-processing steps:
use russimp_ng::scene::{Scene, PostProcess};
use russimp_ng::error::RussimpError;
use std::path::Path;
fn load_model_info(file_path: &str) -> Result<(), RussimpError> {
// Define the post-processing steps you want
let post_process_flags = vec![
PostProcess::CalculateTangentSpace,
PostProcess::Triangulate,
PostProcess::JoinIdenticalVertices,
PostProcess::SortByPrimitiveType,
PostProcess::GenerateNormals, // Example: Generate normals if missing
PostProcess::GenerateUVCoords, // Example: Generate UVs if missing
PostProcess::OptimizeMeshes, // Example: Optimize mesh data
];
// Load the scene from file
let scene: Scene = Scene::from_file(file_path, post_process_flags)?;
println!("Scene loaded successfully from: {}", file_path);
println!(" Meshes: {}", scene.meshes.len());
println!(" Materials: {}", scene.materials.len());
println!(" Textures: {}", scene.textures.len());
println!(" Animations: {}", scene.animations.len());
println!(" Lights: {}", scene.lights.len());
println!(" Cameras: {}", scene.cameras.len());
// You can now access the scene data, e.g.:
if let Some(first_mesh) = scene.meshes.first() {
println!(" First mesh has {} vertices.", first_mesh.vertices.len());
}
// Scene can also be loaded from a byte buffer:
// let buffer: &[u8] = ...;
// let scene_from_buffer = Scene::from_buffer(buffer, post_process_flags, "fbx")?; // Provide format hint
Ok(())
}
fn main() {
let model_path = "assets/model.fbx";
match load_model_info(model_path) {
Ok(_) => println!("Finished processing model."),
Err(e) => eprintln!("Error loading model: {}", e),
}
}
Check the examples/ directory in this repository for more usage examples.
Detailed API documentation can be found on docs.rs.
Contributions are highly welcome! Whether it's reporting bugs, suggesting features, improving documentation, or submitting pull requests, your help is appreciated.
cargo fmt.This project is licensed the terms mentioned in LICENSE. It builds upon the original russimp project and the Assimp library.
See CHANGELOG.md for a history of notable changes.
russimp.