Skip to main content

ObjReader

Trait ObjReader 

Source
pub trait ObjReader<F: ObjFloat = f64> {
Show 13 methods // Required methods fn read_comment(&mut self, comment: &str); fn read_object_name(&mut self, name: &str); fn read_vertex(&mut self, x: F, y: F, z: F, w: Option<F>); fn read_texture_coordinate(&mut self, u: F, v: Option<F>, w: Option<F>); fn read_normal(&mut self, nx: F, ny: F, nz: F); fn read_face( &mut self, vertex_indices: &[(usize, Option<usize>, Option<usize>)], ); // Provided methods fn read_material_lib(&mut self, _names: &[&str]) { ... } fn read_use_material(&mut self, _name: &str) { ... } fn read_group(&mut self, _names: &[&str]) { ... } fn read_smoothing_group(&mut self, _group: SmoothingGroup) { ... } fn read_line_element(&mut self, _indices: &[(usize, Option<usize>)]) { ... } fn read_point_element(&mut self, _indices: &[usize]) { ... } fn read_unknown( &mut self, prefix: &str, _rest: &str, line: usize, ) -> Result<(), ObjError> { ... }
}
Expand description

Trait for reading OBJ file data with configurable float precision.

The generic parameter F defaults to f64 for backward compatibility, but can be set to f32 for applications that work with single-precision data.

Required Methods§

Source

fn read_comment(&mut self, comment: &str)

Source

fn read_object_name(&mut self, name: &str)

Source

fn read_vertex(&mut self, x: F, y: F, z: F, w: Option<F>)

Source

fn read_texture_coordinate(&mut self, u: F, v: Option<F>, w: Option<F>)

Source

fn read_normal(&mut self, nx: F, ny: F, nz: F)

Source

fn read_face( &mut self, vertex_indices: &[(usize, Option<usize>, Option<usize>)], )

Provided Methods§

Source

fn read_material_lib(&mut self, _names: &[&str])

mtllib lib1.mtl lib2.mtl ... - default no-op.

Source

fn read_use_material(&mut self, _name: &str)

usemtl name - default no-op.

Source

fn read_group(&mut self, _names: &[&str])

g name1 name2 ... - default no-op.

Source

fn read_smoothing_group(&mut self, _group: SmoothingGroup)

s 0|off|<n> - default no-op.

Source

fn read_line_element(&mut self, _indices: &[(usize, Option<usize>)])

l v1[/vt1] v2[/vt2] ... - default no-op.

Source

fn read_point_element(&mut self, _indices: &[usize])

p v1 v2 ... - default no-op.

Source

fn read_unknown( &mut self, prefix: &str, _rest: &str, line: usize, ) -> Result<(), ObjError>

Called when a line with an unknown prefix is encountered.

The default implementation returns ParseErrorKind::UnknownPrefix, treating any prefix outside the supported core (NURBS / free-form geometry, display attributes, vendor extensions) as a hard error. Override to skip or otherwise handle these lines.

Implementors§