Struct wavefront::Obj[][src]

pub struct Obj { /* fields omitted */ }

A struct representing the contents of a parsed OBJ file.

Implementations

impl Obj[src]

pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Error>[src]

Read an OBJ from a file.

pub fn from_reader<R: Read>(reader: R) -> Result<Self, Error>[src]

Read an OBJ from a reader (something implementing std::io::Read).

pub fn from_lines<I: Iterator<Item = L>, L: AsRef<str>>(
    lines: I
) -> Result<Self, Error>
[src]

Read an OBJ from an iterator over its lines.

pub fn write<W: Write>(&self, writer: W) -> Result<(), Error>[src]

Write this Obj to a writer (something implementing std::io::Write) in OBJ format.

pub fn save<P: AsRef<Path>>(&self, path: P) -> Result<(), Error>[src]

Write this Obj to a file in OBJ format.

pub fn object(&self, name: &str) -> Option<Object<'_>>[src]

Returns a specific Object by name.

Note that if a name is not specified in the OBJ file, the name defaults to an empty string.

pub fn objects(
    &self
) -> impl ExactSizeIterator<Item = (&str, Object<'_>)> + Clone + '_
[src]

Returns an iterator over the Objects in this Obj.

pub fn groups(&self) -> impl Iterator<Item = (&String, Group<'_>)> + Clone + '_[src]

Returns an iterator over the Groups in this Obj.

pub fn polygons(&self) -> impl Iterator<Item = Polygon<'_>> + Clone + '_[src]

Returns an iterator over the Polygons in this Obj.

pub fn triangles(&self) -> impl Iterator<Item = [Vertex<'_>; 3]> + Clone + '_[src]

Returns an iterator over the triangles in this Obj.

See Polygon::triangles for more information.

pub fn vertices(&self) -> impl ExactSizeIterator<Item = Vertex<'_>> + Clone + '_[src]

Returns an iterator over the vertices in this Obj.

Methods from Deref<Target = Buffers>

pub fn positions(&self) -> &[[f32; 3]][src]

Returns a reference to the position attributes contained within this Obj.

pub fn uvs(&self) -> &[[f32; 3]][src]

Returns a reference to the texture coordinate attributes contained within this Obj.

pub fn normals(&self) -> &[[f32; 3]][src]

Returns a reference to the normal attributes contained within this Obj.

pub fn add_position(&mut self, position: [f32; 3]) -> usize[src]

Add a new position attribute to this Obj, returning its index.

pub fn add_uv(&mut self, uv: [f32; 3]) -> usize[src]

Add a new texture coordinate attribute to this Obj, returning its index.

pub fn add_normal(&mut self, normal: [f32; 3]) -> usize[src]

Add a new normal attribute to this Obj, returning its index.

Trait Implementations

impl Clone for Obj[src]

impl Debug for Obj[src]

impl Deref for Obj[src]

type Target = Buffers

The resulting type after dereferencing.

impl DerefMut for Obj[src]

impl Display for Obj[src]

Auto Trait Implementations

impl RefUnwindSafe for Obj

impl Send for Obj

impl Sync for Obj

impl Unpin for Obj

impl UnwindSafe for Obj

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.