[][src]Struct obj::ObjData

pub struct ObjData {
    pub position: Vec<[f32; 3]>,
    pub texture: Vec<[f32; 2]>,
    pub normal: Vec<[f32; 3]>,
    pub objects: Vec<Object>,
    pub material_libs: Vec<Mtl>,
}

The data model associated with each Obj file.

Fields

position: Vec<[f32; 3]>

Vertex positions.

texture: Vec<[f32; 2]>

2D texture coordinates.

normal: Vec<[f32; 3]>

A set of normals.

objects: Vec<Object>

A collection of associated objects indicated by o, as well as the default object at the top level.

material_libs: Vec<Mtl>

The set of all mtllib references to .mtl files.

Implementations

impl ObjData[src]

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

Save the current ObjData at the given file path as well as any associated .mtl files.

If a file already exists, it will be overwritten.

pub fn save_mtls(&self, base_dir: impl AsRef<Path>) -> Result<(), ObjError>[src]

Save all material libraries referenced in this Obj to the given base directory.

pub fn save_mtls_with_fn<W: Write>(
    &self,
    base_dir: &Path,
    resolve: impl FnMut(&Path, &str) -> Result<W>
) -> Result<(), ObjError>
[src]

Save all material libraries referenced in this Obj struct according to resolve.

pub fn write_to_buf(&self, out: &mut impl Write) -> Result<(), ObjError>[src]

Serialize this Obj into the given writer.

impl ObjData[src]

pub fn load_buf<R: Read>(input: R) -> Result<Self, ObjError>[src]

pub fn load_buf_with_config<R: Read>(
    input: R,
    config: LoadConfig
) -> Result<Self, ObjError>
[src]

Trait Implementations

impl Clone for ObjData[src]

impl Debug for ObjData[src]

impl Default for ObjData[src]

impl PartialEq<ObjData> for ObjData[src]

impl StructuralPartialEq for ObjData[src]

Auto Trait Implementations

impl RefUnwindSafe for ObjData

impl Send for ObjData

impl Sync for ObjData

impl Unpin for ObjData

impl UnwindSafe for ObjData

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, 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.