asset-importer-rs-scene

Crates.ioasset-importer-rs-scene
lib.rsasset-importer-rs-scene
version0.3.0
created_at2025-05-27 23:41:35.414757+00
updated_at2025-07-28 23:52:17.521836+00
descriptionScene module for asset-importer-rs
homepage
repositoryhttps://github.com/crazyjackel/asset-importer-rs
max_upload_size
id1692102
size91,045
Jackson Levitt (crazyjackel)

documentation

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

README

Rust

asset-importer-rs-scene

3D scene data structures and types

Complete scene graph representation for 3D assets

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-scene provides comprehensive data structures and types for working with 3D scene data, inspired by the Assimp library. This crate is a core component of the asset-importer-rs project, offering a complete representation of 3D scenes including geometry, materials, animations, and more.

This crate provides the essential data structures for:

  • Scene Graph - Complete node hierarchy and scene organization
  • Geometry Data - Mesh structures with vertices, faces, and bone weights
  • Material System - Material properties and texture mappings
  • Animation Support - Keyframe animations and morph targets
  • Camera & Lighting - Camera definitions and various light source types
  • Mathematics - Vector, matrix, and quaternion utilities

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

:cloud: Features

  • Complete Scene Representation - Full 3D scene graph with node hierarchy
  • Rich Geometry Support - Comprehensive mesh data including vertices, faces, and bone weights
  • Material System - Flexible material properties and texture handling
  • Animation Framework - Support for keyframe animations and morph targets
  • Camera & Lighting - Various camera types and light source definitions
  • Mathematics Utilities - Vector, matrix, and quaternion operations
  • Color & Texture Support - Color utilities and texture data handling

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

:floppy_disk: Main Components

Core Data Structures

  • AiScene - Core scene graph structure with node hierarchy
  • AiNode - Scene graph node with transformation and children
  • AiMesh - Geometry data including vertices, faces, and bone weights
  • AiMaterial - Material properties and texture mappings
  • AiAnimation - Keyframe animations and morph targets
  • AiCamera - Camera definitions and parameters
  • AiLight - Various light source types and properties
  • AiTexture - Texture data and format handling
  • AiMetadata - Custom metadata storage for scene objects

Animation & Keyframes

  • AiNodeAnim - Node animation with position, rotation, and scale keys
  • AiMeshMorphAnim - Morph target animations
  • AiQuatKey/AiVectorKey - Keyframe data for quaternions and vectors
  • AiAnimInterpolation - Interpolation modes for animations

Mathematics & Utilities

  • AiVector2D/AiVector3D - 2D and 3D vector operations
  • AiMatrix4x4 - 4x4 matrix transformations
  • AiQuaternion - Quaternion rotations
  • AiColor3D/AiColor4D - Color representation

Mesh & Geometry

  • AiBone - Bone data for skeletal animations
  • AiFace - Face/primitive data
  • AiVertexWeight - Vertex weight data for bones
  • AiAnimMesh - Animated mesh data
  • AiPrimitiveType - Primitive type definitions

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

:book: Getting Started

Add the following to your Cargo.toml:

[dependencies]
asset-importer-rs-scene = "0.3.0"

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

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

:small_orange_diamond: Usage Examples

Basic scene creation example:

use asset_importer_rs_scene::{
    AiScene,
    AiMesh,
    AiMaterial,
    AiVector3D,
    AiMatrix4x4,
    AiNode,
};

// Create a new scene
let mut scene = AiScene::default();

// Add a mesh to the scene
let mesh = AiMesh::default();
scene.meshes.push(mesh);

// Create a material
let material = AiMaterial::default();
scene.materials.push(material);

// Create a node hierarchy
let root_node = AiNode::default();
scene.root_node = Some(Box::new(root_node));

Working with vectors and matrices:

use asset_importer_rs_scene::{
    AiVector3D,
    AiMatrix4x4,
    AiQuaternion,
};

// Create vectors
let position = AiVector3D::new(1.0, 2.0, 3.0);
let normal = AiVector3D::new(0.0, 1.0, 0.0);

// Create transformation matrix
let transform = AiMatrix4x4::identity();

// Create quaternion rotation (w, x, y, z order)
let rotation = AiQuaternion::new(1.0, 0.0, 0.0, 0.0);

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

:small_orange_diamond: Architecture

The scene crate provides a comprehensive data model for representing 3D scenes, materials, and animations. It serves as the foundation for all asset import/export operations, ensuring that 3D data can be consistently represented and manipulated across different file formats and applications.

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

:small_orange_diamond: Dependencies

Core Dependencies

  • bytemuck - For safe type casting and memory operations
  • enumflags2 - For flag-based enums and bit manipulation
  • num_enum - For numeric enums and conversions
  • image - For image processing and texture handling

Standard Library Dependencies

  • std::collections - For data structures and collections
  • std::ops - For mathematical operations

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

: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