Skip to main content

Crate asset_importer

Crate asset_importer 

Source
Expand description

§Asset Importer

Comprehensive Rust bindings for the Assimp 3D asset import library.

This crate provides safe, idiomatic Rust bindings for Assimp, offering more complete functionality than existing alternatives like russimp.

§Features

  • Complete API coverage: Import, export, and post-processing
  • Memory safety: Safe Rust abstractions over raw C API
  • Zero-cost abstractions: Minimal overhead over direct C API usage
  • Custom I/O: Support for custom file systems and progress callbacks
  • Modern Rust: Uses latest Rust features and idioms

§Quick Start

use asset_importer::{Importer, postprocess::PostProcessSteps};

let scene = Importer::new().import_file_with("model.fbx", |b| {
    b.with_post_process(PostProcessSteps::TRIANGULATE | PostProcessSteps::FLIP_UVS)
})?;

println!("Loaded {} meshes", scene.meshes().count());

§Architecture

This crate is built on top of asset-importer-sys, which provides the raw FFI bindings. The high-level API is designed to be:

  • Safe: All unsafe operations are encapsulated
  • Ergonomic: Builder patterns and method chaining
  • Efficient: Zero-copy where possible
  • Extensible: Support for custom I/O and callbacks

§Build features

This crate supports three mutually exclusive build modes:

  • prebuilt (default): download/use prebuilt Assimp binaries via asset-importer-sys
  • build-assimp: build Assimp from source via CMake
  • system: link against a system-installed Assimp (requires libclang/bindgen)

For system, use --no-default-features --features system.

Re-exports§

pub use crate::error::Error;
pub use crate::error::Result;
pub use crate::importer::ImportBuilder;
pub use crate::importer::Importer;
pub use crate::importer::PropertyStore;
pub use crate::importer::PropertyValue;
pub use crate::importer::import_properties;
pub use crate::scene::MemoryInfo;
pub use crate::scene::Scene;
pub use crate::logging::LogLevel;
pub use crate::logging::LogStream;Deprecated
pub use crate::logging::Logger;
pub use crate::metadata::Metadata;
pub use crate::metadata::MetadataEntry;
pub use crate::metadata::MetadataType;
pub use crate::material::Material;
pub use crate::material::MaterialPropertyInfo;
pub use crate::material::MaterialPropertyIterator;
pub use crate::material::MaterialPropertyRef;
pub use crate::material::MaterialStringRef;
pub use crate::material::PropertyTypeInfo;
pub use crate::material::TextureInfo;
pub use crate::material::TextureInfoRef;
pub use crate::material::TextureType;
pub use crate::material::material_keys;
pub use crate::texture::Texel;
pub use crate::texture::Texture;
pub use crate::texture::TextureData;
pub use crate::texture::TextureIterator;
pub use crate::aabb::AABB;
pub use crate::bone::Bone;
pub use crate::bone::BoneIterator;
pub use crate::bone::VertexWeight;
pub use crate::animation::Animation;
pub use crate::importer_desc::ImporterDesc;
pub use crate::importer_desc::ImporterDescIterator;
pub use crate::importer_desc::ImporterFlags;
pub use crate::importer_desc::get_all_importer_descs;
pub use crate::importer_desc::get_all_importer_descs_iter;
pub use crate::importer_desc::get_importer_desc;
pub use crate::importer_desc::get_importer_desc_cstr;
pub use crate::types::*;

Modules§

aabb
Axis-Aligned Bounding Box (AABB) support
animation
Animation data structures and utilities
bone
Bone and skeletal animation support
camera
Camera representation and utilities
error
Error handling for asset importer operations
importer
Scene importer functionality
importer_desc
Importer description functionality
io
Custom I/O system support
light
Light representation and utilities
logging
Logging system integration with Assimp
material
Material representation and properties
math
Thin wrappers over Assimp C math helpers (optional). These functions use the C API for operations on matrices, quaternions, and vectors, returning glam types for ergonomics. Prefer glam for general math; use these to match Assimp’s exact semantics.
mesh
Mesh representation and utilities
metadata
Metadata support for scenes and nodes
node
Scene node representation and hierarchy
postprocess
Post-processing steps for imported scenes
progress
Progress reporting for import/export operations
raw
Zero-copy raw view types for Assimp-owned data. Raw, zero-copy view types for Assimp-owned scene memory.
scene
Scene representation and management
texture
Texture and embedded texture support
types
Common math types and conversion helpers.
utils
Utility functions and helpers for working with 3D assets
version
Version information

Structs§

ImportExtensions
An allocation-minimized import extension list.
ImportExtensionsIter
Iterator over supported import extensions.

Functions§

enable_verbose_logging
Enable verbose logging for debugging
get_import_extensions
Get a list of all supported import file extensions (allocates).
get_import_extensions_list
Get all supported import file extensions (allocation-minimized).
is_extension_supported
Check if a file extension is supported for import.