Struct wavefront::Obj [−][src]
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]
lines: I
) -> Result<Self, Error>
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]
&self
) -> impl ExactSizeIterator<Item = (&str, Object<'_>)> + Clone + '_
pub fn groups(&self) -> impl Iterator<Item = (&String, Group<'_>)> + Clone + '_
[src]
pub fn polygons(&self) -> impl Iterator<Item = Polygon<'_>> + Clone + '_
[src]
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]
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,