pub struct ObjScene {
pub nodes: Vec<ObjSceneNode>,
pub meshes: Vec<ObjMesh>,
pub materials: Vec<ObjMaterial>,
}Expand description
A simple scene graph for OBJ scenes.
Fields§
§nodes: Vec<ObjSceneNode>All nodes in the scene.
meshes: Vec<ObjMesh>All meshes in the scene.
materials: Vec<ObjMaterial>All materials in the scene.
Implementations§
Source§impl ObjScene
impl ObjScene
Sourcepub fn add_mesh(&mut self, mesh: ObjMesh) -> usize
pub fn add_mesh(&mut self, mesh: ObjMesh) -> usize
Add a mesh to the scene and return its index.
Sourcepub fn add_material(&mut self, mat: ObjMaterial) -> usize
pub fn add_material(&mut self, mat: ObjMaterial) -> usize
Add a material to the scene and return its index.
Sourcepub fn add_node(
&mut self,
name: &str,
mesh_index: Option<usize>,
transform: MeshTransform,
) -> usize
pub fn add_node( &mut self, name: &str, mesh_index: Option<usize>, transform: MeshTransform, ) -> usize
Add a node to the scene and return its index.
Sourcepub fn add_child(&mut self, parent_idx: usize, child_idx: usize)
pub fn add_child(&mut self, parent_idx: usize, child_idx: usize)
Set a node as a child of another node.
Sourcepub fn flatten(&self) -> ObjMesh
pub fn flatten(&self) -> ObjMesh
Flatten the scene hierarchy into a single merged ObjMesh.
Each node’s mesh is transformed by the node’s local transform.
Sourcepub fn total_vertices(&self) -> usize
pub fn total_vertices(&self) -> usize
Total number of vertices across all meshes.
Sourcepub fn total_faces(&self) -> usize
pub fn total_faces(&self) -> usize
Total number of faces across all meshes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ObjScene
impl RefUnwindSafe for ObjScene
impl Send for ObjScene
impl Sync for ObjScene
impl Unpin for ObjScene
impl UnsafeUnpin for ObjScene
impl UnwindSafe for ObjScene
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.