Skip to main content

ObjWriter

Trait ObjWriter 

Source
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§

Source

fn write_comment<S: AsRef<str>>(&mut self, comment: S) -> Result<()>

Source

fn write_object_name<S: AsRef<str>>(&mut self, name: S) -> Result<()>

Source

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

Source

fn write_texture_coordinate( &mut self, u: F, v: Option<F>, w: Option<F>, ) -> Result<()>

Source

fn write_normal(&mut self, nx: F, ny: F, nz: F) -> Result<()>

Source

fn write_face( &mut self, vertex_indices: &[(usize, Option<usize>, Option<usize>)], ) -> Result<()>

Source

fn write_material_lib<S: AsRef<str>>(&mut self, names: &[S]) -> Result<()>

mtllib lib1.mtl lib2.mtl ... - reference one or more material libraries.

Source

fn write_use_material<S: AsRef<str>>(&mut self, name: S) -> Result<()>

usemtl name - select a material from a previously declared library.

Source

fn write_group<S: AsRef<str>>(&mut self, names: &[S]) -> Result<()>

g name1 name2 ... - assign subsequent elements to one or more groups.

Source

fn write_smoothing_group(&mut self, group: SmoothingGroup) -> Result<()>

s 0|off|<n> - select a smoothing group for subsequent faces.

Source

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.

Source

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.

Implementors§

Source§

impl<W: Write, F: ObjFloat> ObjWriter<F> for IoObjWriter<W, F>