pub trait ObjWriter<F: ObjFloat = f64> {
// Required methods
fn write_comment<S: AsRef<str>>(&mut self, comment: S) -> Result<()>;
fn write_object_name<S: AsRef<str>>(&mut self, name: S) -> Result<()>;
fn write_vertex(&mut self, x: F, y: F, z: F, w: Option<F>) -> Result<()>;
fn write_texture_coordinate(
&mut self,
u: F,
v: Option<F>,
w: Option<F>,
) -> Result<()>;
fn write_normal(&mut self, nx: F, ny: F, nz: F) -> Result<()>;
fn write_face(
&mut self,
vertex_indices: &[(usize, Option<usize>, Option<usize>)],
) -> Result<()>;
fn write_material_lib<S: AsRef<str>>(&mut self, names: &[S]) -> Result<()>;
fn write_use_material<S: AsRef<str>>(&mut self, name: S) -> Result<()>;
fn write_group<S: AsRef<str>>(&mut self, names: &[S]) -> Result<()>;
fn write_smoothing_group(&mut self, group: SmoothingGroup) -> Result<()>;
fn write_line_element(
&mut self,
indices: &[(usize, Option<usize>)],
) -> Result<()>;
fn write_point_element(&mut self, indices: &[usize]) -> Result<()>;
}Expand description
Trait for writing 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§
fn write_comment<S: AsRef<str>>(&mut self, comment: S) -> Result<()>
fn write_object_name<S: AsRef<str>>(&mut self, name: S) -> Result<()>
fn write_vertex(&mut self, x: F, y: F, z: F, w: Option<F>) -> Result<()>
fn write_texture_coordinate( &mut self, u: F, v: Option<F>, w: Option<F>, ) -> Result<()>
fn write_normal(&mut self, nx: F, ny: F, nz: F) -> Result<()>
fn write_face( &mut self, vertex_indices: &[(usize, Option<usize>, Option<usize>)], ) -> Result<()>
Sourcefn write_material_lib<S: AsRef<str>>(&mut self, names: &[S]) -> Result<()>
fn write_material_lib<S: AsRef<str>>(&mut self, names: &[S]) -> Result<()>
mtllib lib1.mtl lib2.mtl ... - reference one or more material libraries.
Sourcefn write_use_material<S: AsRef<str>>(&mut self, name: S) -> Result<()>
fn write_use_material<S: AsRef<str>>(&mut self, name: S) -> Result<()>
usemtl name - select a material from a previously declared library.
Sourcefn write_group<S: AsRef<str>>(&mut self, names: &[S]) -> Result<()>
fn write_group<S: AsRef<str>>(&mut self, names: &[S]) -> Result<()>
g name1 name2 ... - assign subsequent elements to one or more groups.
Sourcefn write_smoothing_group(&mut self, group: SmoothingGroup) -> Result<()>
fn write_smoothing_group(&mut self, group: SmoothingGroup) -> Result<()>
s 0|off|<n> - select a smoothing group for subsequent faces.
Sourcefn write_line_element(
&mut self,
indices: &[(usize, Option<usize>)],
) -> Result<()>
fn write_line_element( &mut self, indices: &[(usize, Option<usize>)], ) -> Result<()>
l v1[/vt1] v2[/vt2] ... - polyline element. Each index is a vertex,
optionally with a texture coordinate.
Sourcefn write_point_element(&mut self, indices: &[usize]) -> Result<()>
fn write_point_element(&mut self, indices: &[usize]) -> Result<()>
p v1 v2 ... - point element.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.