| Crates.io | asset-importer-sys |
| lib.rs | asset-importer-sys |
| version | 0.3.0 |
| created_at | 2025-09-17 15:09:13.30099+00 |
| updated_at | 2025-09-19 06:18:45.942345+00 |
| description | Low-level FFI bindings for the Assimp 3D asset import library |
| homepage | https://github.com/Latias94/asset-importer |
| repository | https://github.com/Latias94/asset-importer |
| max_upload_size | |
| id | 1843459 |
| size | 17,851,040 |
Low-level FFI bindings for the Assimp 3D asset import library.
This crate provides unsafe Rust FFI bindings for Assimp v6.0.2, implementing the vast majority of the C API functions, types, and constants.
⚠️ Early Development: These bindings are functional but need more testing across different platforms and use cases.
This crate provides unsafe Rust bindings to the Assimp v6.0.2 C API, implementing the vast majority of functions, types, and constants. For a safe, high-level API, use the asset-importer crate instead.
The bindings include:
Default: Uses prebuilt binaries for fastest builds.
[dependencies]
asset-importer-sys = "0.3"
# or explicitly:
asset-importer-sys = { features = ["prebuilt"] }
asset-importer-sys = { version = "0.3", features = ["build-assimp"] }
asset-importer-sys = { version = "0.3", features = ["system"] }
Uses system-installed assimp. Install via package manager:
brew install assimpsudo apt install libassimp-devOn Windows with vcpkg, pick a triplet that matches your desired CRT:
x64-windows → dynamic CRT (/MD)x64-windows-static → static CRT (/MT)If you use the static triplet, also enable Rust crt-static so all crates agree:
# .cargo/config.toml
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
asset-importer-sys = { version = "0.3", features = ["static-link", "build-assimp"] }
asset-importer-sys = {
version = "0.3",
features = [
"build-assimp",
"export", # Enable export functionality
"nozlib", # Don't link zlib
"mint", # Math library interop
"type-extensions" # Convenience methods
]
}
ASSIMP_DIR: Path to an Assimp source tree to use when the assimp submodule is not present (builds from this directory).ASSET_IMPORTER_PACKAGE_DIR: Use local prebuilt packages
-md and -mt suffixed archives; the build script selects the right one automatically and falls back to the old name if not found.CMAKE_GENERATOR: Override CMake generator (e.g., "Ninja")| Feature | Requirements |
|---|---|
prebuilt |
None |
system |
System assimp installation |
build-assimp |
CMake (≥3.10), C++ compiler, Git |
Essential Tools:
Platform Setup:
Windows:
# Install Visual Studio Build Tools or Visual Studio Community
# Or use chocolatey:
choco install cmake visualstudio2022buildtools
macOS:
# Install Xcode Command Line Tools
xcode-select --install
# Install CMake via Homebrew (recommended)
brew install cmake
Linux (Ubuntu/Debian):
sudo apt update
sudo apt install build-essential cmake git
Linux (CentOS/RHEL):
sudo yum groupinstall "Development Tools"
sudo yum install cmake3 git
use asset_importer_sys as sys;
use std::ffi::CString;
use std::ptr;
unsafe {
let importer = sys::aiCreateImporter();
let filename = CString::new("model.obj").unwrap();
let scene = sys::aiImportFile(
filename.as_ptr(),
sys::aiProcess_Triangulate | sys::aiProcess_FlipUVs
);
if !scene.is_null() {
let scene_ref = &*scene;
println!("Loaded {} meshes", scene_ref.mNumMeshes);
sys::aiReleaseImporter(importer);
}
}
Provides comprehensive FFI bindings for the latest Assimp with flexible build options and optional convenience features.
Bindings are generated using bindgen from the Assimp headers. The generated bindings include:
ai* functionsai* types and constantsThis crate provides unsafe bindings. Memory management, null pointer checks, and proper API usage are the caller's responsibility. Consider using the safe asset-importer wrapper instead.
Help needed with:
Licensed under either of:
at your option.