Skip to main content

Crate oxideav_mesh3d

Crate oxideav_mesh3d 

Source
Expand description

Pure-Rust 3D scene + mesh typed model.

This crate is the foundation for the OxideAV 3D format ecosystem (oxideav-stl, oxideav-obj, oxideav-gltf, future oxideav-fbx / oxideav-usd). It defines a single PBR-aligned data model that every format crate can decode into and encode from, and it exposes Mesh3DDecoder / Mesh3DEncoder traits plus a Mesh3DRegistry that mirrors the codec-registry pattern from oxideav-core.

The model is aligned with glTF 2.0 as the spec-stable common denominator (Khronos KHR-public spec, royalty-free). This means:

  • Right-handed coordinates, Y-up, -Z forward as the canonical default. Files coming from Z-up formats (STL/OBJ Wavefront) set Scene3D::up_axis to Axis::PosZ without any geometry re-orientation; downstream renderers honour the metadata.
  • Quaternions are stored xyzw to match glTF.
  • Tangents carry handedness in w (±1.0).
  • Materials are metallic-roughness PBR with base_color, metallic, roughness, normal, occlusion, and emissive slots (see Material), refined by a typed MaterialExt surface for the KHR material extensions (emissive strength, IOR, dispersion, specular, unlit, clearcoat, sheen, transmission, diffuse transmission, volume, iridescence, anisotropy).

Round 1 ships the type model + the trait surface only. No format support — that lands in dedicated sibling crates.

Round 2 adds:

  • AssetSource trait — lazy reference to a binary asset (Texture or AudioSource) so massive scenes (USDZ archives in the hundreds of MB) don’t have to be materialised in RAM. Supports optional raw_storage() pass-through so a USDZ → USDZ converter can copy deflated payloads verbatim instead of inflate + re-deflate.
  • Audio* types — AudioSource, AudioEmitter, SpatialAudio, AuralMode, DistanceModel. Aligned with USD UsdMediaSpatialAudio + glTF KHR_audio_emitter.
  • ImageData::Source replaces the round-1 ImageData::Encoded { mime, bytes } variant. Migration: wrap bytes in InMemoryAsset, Arc::new() it, pass into ImageData::Source(...) (or keep using the Texture::from_encoded convenience constructor — the signature is unchanged).

§Standalone build

oxideav-core is gated behind the default-on registry cargo feature. Drop the framework dependency entirely with:

oxideav-mesh3d = { version = "0.0", default-features = false }

The typed model and trait definitions remain available — only the Mesh3DRegistry glue is feature-gated, and the Error alias resolves to a crate-local enum instead of oxideav_core::Error.

Re-exports§

pub use animation::Animation;
pub use animation::AnimationChannel;
pub use animation::AnimationProperty;
pub use animation::AnimationSampler;
pub use animation::AnimationTarget;
pub use animation::AnimationValues;
pub use animation::Interpolation;
pub use animation::SampledValue;
pub use asset::AssetSource;
pub use asset::InMemoryAsset;
pub use asset::RawStorage;
pub use audio::AudioData;
pub use audio::AudioEmitter;
pub use audio::AudioEmitterId;
pub use audio::AudioSource;
pub use audio::AudioSourceId;
pub use audio::AuralMode;
pub use audio::DistanceModel;
pub use audio::SpatialAudio;
pub use bvh::Bvh;
pub use bvh::BvhNode;
pub use camera::Camera;
pub use compose::AppendOffsets;
pub use curvature::CurvatureReport;
pub use decoder::Mesh3DDecoder;
pub use encoder::Mesh3DEncoder;
pub use extrude::Profile2D;
pub use instance_bvh::Instance;
pub use instance_bvh::InstanceBvh;
pub use instance_bvh::InstanceBvhNode;
pub use light::Light;
pub use material::AlphaMode;
pub use material::Anisotropy;
pub use material::Clearcoat;
pub use material::DiffuseTransmission;
pub use material::Iridescence;
pub use material::Material;
pub use material::MaterialExt;
pub use material::Sheen;
pub use material::Specular;
pub use material::TextureRef;
pub use material::TextureTransform;
pub use material::Transmission;
pub use material::Volume;
pub use mesh::EdgeManifoldReport;
pub use mesh::Inbetween;
pub use mesh::Indices;
pub use mesh::Mesh;
pub use mesh::MorphTarget;
pub use mesh::MorphedAttributes;
pub use mesh::OrientationReport;
pub use mesh::Primitive;
pub use mesh::Topology;
pub use mesh::TopologySummary;
pub use mesh::VariantMapping;
pub use optimize::simulate_cache;
pub use optimize::CacheStats;
pub use optimize::DEFAULT_CACHE_SIZE;
pub use pose::Pose;
pub use ray::Ray;
pub use ray::RayHit;
pub use registry::Mesh3DRegistry;
pub use scene::Axis;
pub use scene::BoundingBox;
pub use scene::CameraId;
pub use scene::LightId;
pub use scene::MaterialId;
pub use scene::MaterialVariantId;
pub use scene::MeshId;
pub use scene::Node;
pub use scene::NodeId;
pub use scene::Scene3D;
pub use scene::SceneRayHit;
pub use scene::SkeletonId;
pub use scene::SkinId;
pub use scene::TextureId;
pub use scene::Transform;
pub use scene::Unit;
pub use scene::ValidationError;
pub use skin::Skeleton;
pub use skin::Skin;
pub use smooth::SmoothOptions;
pub use texture::ImageData;
pub use texture::MagFilter;
pub use texture::MinFilter;
pub use texture::MipmapMode;
pub use texture::Sampler;
pub use texture::Texture;
pub use texture::WrapMode;

Modules§

animation
Keyframed property animation.
asset
Lazy-access asset trait for textures, audio, and any other large blob a 3D scene can carry.
audio
Audio assets, emitters, and spatial-audio metadata.
bvh
Bounding-volume hierarchy over a crate::Primitive’s triangle tessellation — accelerates many-ray workloads from O(triangle_count) per ray to roughly O(log triangle_count) once the tree is built.
camera
Camera projection definitions.
combine
Primitive concatenation and material-grouped mesh consolidation.
compose
Scene composition: appending one Scene3D into another with full cross-arena id remapping.
curvature
Discrete per-vertex surface curvature: Gaussian (angle defect) and mean (cotangent-Laplacian) estimates.
decoder
Mesh3DDecoder trait — bytes-in, Scene3D-out.
encoder
Mesh3DEncoder trait — Scene3D-in, bytes-out.
error
Error type for oxideav-mesh3d.
extrude
Parametric extruded-solid construction — a planar profile (outer boundary + optional hole boundaries) swept along a straight direction into a closed, watertight triangle Primitive.
graph
Scene-graph navigation and transform baking.
instance_bvh
Scene-level bounding-volume hierarchy over the per-instance world-AABB snapshot — accelerates many-ray scene-graph queries from O(reachable_instance_count) per ray to roughly O(log reachable_instance_count) once the tree is built.
light
Punctual light sources (KHR_lights_punctual analogue).
material
PBR material definition (glTF 2.0 metallic-roughness model).
mesh
Mesh, primitive, topology, and index buffer types.
optimize
GPU vertex-buffer optimisation: triangle and vertex reordering for locality of reference.
pose
Sampling an Animation into a scene pose.
ray
Ray + ray-triangle / ray-AABB intersection primitives.
registry
Mesh3DRegistry — runtime lookup table from format-id / file-extension to decoder/encoder factory.
scene
Scene-graph root, nodes, transforms, ID newtypes, and coordinate metadata.
simplify
Quadric-error-metric (QEM) edge-collapse mesh simplification.
skin
Skeleton + Skin — rigging primitives for skeletal animation.
skinning
Linear-blend skinning — joint matrices + vertex deformation.
smooth
Laplacian and Taubin mesh fairing (position smoothing).
texture
Texture, image data, and sampler state.
transform
Baking an affine transform into a primitive’s geometry, plus orientation flips.

Enums§

Error
The error type shared by every oxideav crate. See the module docs for which variant to pick.

Type Aliases§

Result
Convenience alias: std::result::Result pinned to Error.