pub struct ModelImporter3D;Expand description
Stateless 3D model importer supporting Wavefront .obj and glTF 2.0 .gltf JSON assets.
Implementations§
Source§impl ModelImporter3D
Native Wavefront .obj, Khronos glTF 2.0 .gltf/.glb, and baked binary model importers for ModelImporter3D.
impl ModelImporter3D
Native Wavefront .obj, Khronos glTF 2.0 .gltf/.glb, and baked binary model importers for ModelImporter3D.
Sourcepub fn import(
format: ModelFormat,
source: &str,
fallback_material: PbrMaterial,
) -> Result<ImportedModel3D, String>
pub fn import( format: ModelFormat, source: &str, fallback_material: PbrMaterial, ) -> Result<ImportedModel3D, String>
Imports a 3D model from text source in the specified ModelFormat and generates LOD chains.
§Arguments
ModelFormat- Interchange format (ObjorGltfJson).&str- Raw.objor.gltftext content.PbrMaterial- Fallback PBR material when source omits material definitions.
§Returns
Result<ImportedModel3D, String>- Imported model bundle or parse error diagnostic.
Sourcepub fn import_bytes(
format: ModelFormat,
bytes: &[u8],
fallback_material: PbrMaterial,
) -> Result<ImportedModel3D, String>
pub fn import_bytes( format: ModelFormat, bytes: &[u8], fallback_material: PbrMaterial, ) -> Result<ImportedModel3D, String>
Imports a 3D model from raw binary or UTF-8 bytes in Obj, GltfJson, or GlbBinary format.
§Arguments
ModelFormat- Source interchange format.&[u8]- Raw file bytes.PbrMaterial- Fallback PBR material when source omits material definitions.
§Returns
Result<ImportedModel3D, String>- Imported model bundle or parse error.
Sourcepub fn parse_mtl(
mtl_source: &str,
fallback: PbrMaterial,
) -> HashMap<String, PbrMaterial>
pub fn parse_mtl( mtl_source: &str, fallback: PbrMaterial, ) -> HashMap<String, PbrMaterial>
Sourcepub fn parse_obj_with_mtl(
source: &str,
mtl_source: Option<&str>,
material: PbrMaterial,
) -> Result<ImportedModel3D, String>
pub fn parse_obj_with_mtl( source: &str, mtl_source: Option<&str>, material: PbrMaterial, ) -> Result<ImportedModel3D, String>
Parses a Wavefront .obj mesh (o, g, v, vt, vn, f, mtllib, usemtl) with optional .mtl library, negative index support, vertex deduplication, and Lengyel tangents.
§Arguments
&str- Raw.objASCII text.Option<&str>- Optional companion.mtlASCII text.PbrMaterial- Fallback PBR material.
§Returns
Result<ImportedModel3D, String>- Parsed model or error string.
Sourcepub fn parse_obj(
source: &str,
material: PbrMaterial,
) -> Result<ImportedModel3D, String>
pub fn parse_obj( source: &str, material: PbrMaterial, ) -> Result<ImportedModel3D, String>
Sourcepub fn parse_gltf_json(
source: &str,
fallback_material: PbrMaterial,
) -> Result<ImportedModel3D, String>
pub fn parse_gltf_json( source: &str, fallback_material: PbrMaterial, ) -> Result<ImportedModel3D, String>
Parses a Khronos glTF 2.0 JSON asset (full buffers/bufferViews/accessors/Principled BSDF plus legacy inline geometry fallback).
§Arguments
&str- Raw.gltfJSON string.PbrMaterial- Fallback PBR material when JSON omitsmaterials.
§Returns
Result<ImportedModel3D, String>- Parsed model bundle or validation error.
Trait Implementations§
Source§impl Clone for ModelImporter3D
impl Clone for ModelImporter3D
impl Copy for ModelImporter3D
Source§impl Debug for ModelImporter3D
impl Debug for ModelImporter3D
Auto Trait Implementations§
impl Forget for ModelImporter3D
impl Freeze for ModelImporter3D
impl Move for ModelImporter3D
impl RefUnwindSafe for ModelImporter3D
impl Send for ModelImporter3D
impl Sync for ModelImporter3D
impl Unpin for ModelImporter3D
impl UnsafeUnpin for ModelImporter3D
impl UnwindSafe for ModelImporter3D
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more