pub struct Model3D {
pub meshes: Vec<Mesh>,
pub materials: Vec<Material>,
pub format: ModelFormat,
}Fields§
§meshes: Vec<Mesh>All meshes the Model has.
Some 3D Formats do not have multiple meshes and have just vertices, In this case there will be one Mesh with all the Vertices
materials: Vec<Material>All Materials the Model has.
Some 3D Formats do not support Materials/Textures, In this case the Vec will be empty
format: ModelFormatThe format which was used to load the Model
Implementations§
Source§impl Model3D
impl Model3D
Sourcepub fn load<P: AsRef<Path>>(path: P) -> Result<Self, ModelError>
pub fn load<P: AsRef<Path>>(path: P) -> Result<Self, ModelError>
Load an Full 3D Model from the Given File extension
§Examples
use modelz::Model3D;
let model = Model3D::load("model.gltf");
for mesh in model.meshes {
println!("{}", mesh.name.unwrap());
for vert in mesh.vertices {
println!("{:?}", vert)
}
}§Errors
Returns an Error is loading the Model was unsuccessful
Sourcepub fn from_format<P: AsRef<Path>>(
path: P,
format: &ModelFormat,
) -> Result<Self, ModelError>
pub fn from_format<P: AsRef<Path>>( path: P, format: &ModelFormat, ) -> Result<Self, ModelError>
Auto Trait Implementations§
impl Freeze for Model3D
impl RefUnwindSafe for Model3D
impl Send for Model3D
impl Sync for Model3D
impl Unpin for Model3D
impl UnwindSafe for Model3D
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more