asset-importer-rs-core

Crates.ioasset-importer-rs-core
lib.rsasset-importer-rs-core
version0.3.0
created_at2025-05-27 23:42:11.044569+00
updated_at2025-07-28 23:52:33.959268+00
descriptionCore module for asset-importer-rs
homepage
repositoryhttps://github.com/crazyjackel/asset-importer-rs
max_upload_size
id1692103
size25,452
Jackson Levitt (crazyjackel)

documentation

https://docs.rs/asset-importer-rs-core

README

Rust

asset-importer-rs-core

Core functionality for 3D asset import/export

The foundation of the asset-importer-rs ecosystem

Version License Rust Version

:book: Table of Contents

Table of Contents
  1. ➤ About The Crate
  2. ➤ Features
  3. ➤ Main Components
  4. ➤ Getting Started
  5. ➤ Usage Examples
  6. ➤ Architecture
  7. ➤ Dependencies
  8. ➤ License

-----------------------------------------------------

:pencil: About The Crate

asset-importer-rs-core is the foundational crate of the asset-importer-rs project, providing the core functionality for importing and exporting 3D assets. Inspired by the Assimp library, this crate establishes the fundamental building blocks that all format-specific importers and exporters rely upon.

This crate provides the essential infrastructure for:

  • Import Pipeline - Defines the AiImporter trait and related interfaces for loading 3D assets
  • Export Pipeline - Defines the AiExport trait and related interfaces for writing 3D assets
  • Post-Processing - Defines post-processing steps and operations for asset transformations
  • Configuration - Provides configuration constants for import/export behavior

-----------------------------------------------------

:cloud: Features

  • Flexible Asset System - Configurable import/export pipelines for various 3D formats
  • Post-Processing Capabilities - Built-in support for asset transformations and optimizations
  • Error Handling - Comprehensive error handling and reporting system
  • Format Support - Extensible architecture supporting multiple file formats
  • Configuration Management - Fine-grained control over import/export operations
  • Extensible Architecture - Easy to extend with new format support

-----------------------------------------------------

:floppy_disk: Main Components

Core Modules

  • Import System - Defines the AiImporter trait for format-specific importers
  • Export System - Defines the AiExport trait for format-specific exporters
  • Post-Processing - Defines AiPostProcessSteps enum for asset transformations
  • Configuration - Provides configuration constants for import/export settings
  • Importer Metadata - AiImporterDesc for format-specific importer descriptions

-----------------------------------------------------

:book: Getting Started

Add the following to your Cargo.toml:

[dependencies]
asset-importer-rs-core = "0.2.0"

# Or for development from source:
asset-importer-rs-core = { path = "../path/to/asset-importer-rs-core" }

-----------------------------------------------------

:small_orange_diamond: Usage Examples

Basic usage example:

use asset_importer_rs_core::{
    AiImporter,
    AiImporterInfo
};
use std::path::Path;

// Define a custom importer
struct MyImporter;

impl AiImporterInfo for MyImporter {
    fn info(&self) -> asset_importer_rs_core::AiImporterDesc {
        // Implementation details...
        unimplemented!()
    }
}

impl AiImporter for MyImporter {
    type Error = AiReadError;
    
    fn can_read_dyn(&self, path: &Path, loader: &dyn Fn(&Path) -> std::io::Result>) -> bool {
        // Check if this importer can handle the file
        unimplemented!()
    }
    
    fn read_file_dyn(&self, path: &Path, loader: &dyn Fn(&Path) -> std::io::Result>) -> Result {
        // Import the file
        unimplemented!()
    }
}

Using post-processing steps:

use asset_importer_rs_core::AiPostProcessSteps;
use enumflags2::BitFlags;

// Define post-processing operations
let post_process_steps = BitFlags::from(
    AiPostProcessSteps::Triangulate | 
    AiPostProcessSteps::GenNormals |
    AiPostProcessSteps::CalcTangentSpaces
);

-----------------------------------------------------

:small_orange_diamond: Architecture

The core crate provides the fundamental building blocks for asset import/export operations. It establishes the interfaces and abstractions that all format-specific implementations must follow, ensuring consistency and interoperability across the entire asset-importer-rs ecosystem.

-----------------------------------------------------

:small_orange_diamond: Dependencies

Core Dependencies

  • enumflags2 - For flag-based enums and bit manipulation in post-processing
  • asset-importer-rs-scene - For scene data structures and types

Standard Library Dependencies

  • std::io - For I/O operations and error handling
  • std::path - For path handling

-----------------------------------------------------

:scroll: License

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

GitHub Crates.io Docs.rs

Commit count: 88

cargo fmt