he3d_core/lib.rs
1#![cfg_attr(not(feature = "std"), no_std)]
2
3//! HE3D core.
4//! HE3D 核心。
5//!
6//! Owns the scene graph, resources (meshes, textures, materials), and stable generational IDs.
7//! 拥有场景图、资源(网格、纹理、材质)以及稳定的代际 ID。
8//! A [`Scene`] owns its resources directly through [`Arena`]s; IDs are cheap handles that never dangle.
9//! 一个 [`Scene`] 直接通过 [`Arena`] 拥有其资源;ID 是永不悬垂的廉价句柄。
10//!
11//! Everything here is `no_std + alloc`. The optional `std` feature only adds convenience impls (e.g. `std::error::Error`); it never enables `std` for any dependency by default.
12//! 此处所有内容都是 `no_std + alloc`。可选的 `std` 特性仅添加便捷实现(例如 `std::error::Error`);它永远不会默认启用任何依赖的 `std`。
13
14extern crate alloc;
15
16mod arena;
17mod camera;
18mod color;
19mod error;
20mod light;
21mod material;
22mod mesh;
23mod scene;
24mod texture;
25mod transform;
26
27pub use arena::{Arena, Id};
28pub use camera::Camera;
29pub use color::{ColorRgba8, Rgb};
30pub use error::Error;
31pub use light::DirectionalLight;
32pub use material::Material;
33pub use mesh::{MAX_VERTEX_COUNT, Mesh};
34pub use scene::{RenderObject, Scene};
35pub use texture::Texture;
36pub use transform::Transform;
37
38/// Stable handle to a [`Mesh`].
39/// 指向 [`Mesh`] 的稳定句柄。
40pub type MeshId = Id<Mesh>;
41/// Stable handle to a [`Texture`].
42/// 指向 [`Texture`] 的稳定句柄。
43pub type TextureId = Id<Texture>;
44/// Stable handle to a [`RenderObject`].
45/// 指向 [`RenderObject`] 的稳定句柄。
46pub type ObjectId = Id<RenderObject>;
47
48#[cfg(test)]
49mod tests {
50 use alloc::vec;
51 use alloc::vec::Vec;
52
53 #[test]
54 fn alloc_is_available() {
55 let mut v: Vec<u32> = vec![0, 1, 2];
56 v.push(3);
57 assert_eq!(v, [0, 1, 2, 3]);
58 }
59}