pub struct GltfScene {
pub nodes: Vec<GltfNode>,
pub meshes: Vec<GltfMesh>,
pub accessors: Vec<GltfAccessor>,
pub buffer_views: Vec<GltfBufferView>,
pub animations: Vec<GltfAnimation>,
pub materials: Vec<GltfMaterial>,
pub cameras: Vec<SceneCamera>,
pub lights: Vec<SceneLight>,
}Expand description
A glTF 2.0 scene: a collection of nodes and meshes.
Fields§
§nodes: Vec<GltfNode>Scene nodes.
meshes: Vec<GltfMesh>Scene meshes.
accessors: Vec<GltfAccessor>Accessors.
buffer_views: Vec<GltfBufferView>Buffer views.
animations: Vec<GltfAnimation>Animations.
materials: Vec<GltfMaterial>Materials.
cameras: Vec<SceneCamera>Cameras.
lights: Vec<SceneLight>Lights (KHR_lights_punctual).
Implementations§
Source§impl GltfScene
impl GltfScene
Sourcepub fn add_camera(&mut self, cam: SceneCamera) -> usize
pub fn add_camera(&mut self, cam: SceneCamera) -> usize
Add a camera and return its index.
Sourcepub fn add_light(&mut self, light: SceneLight) -> usize
pub fn add_light(&mut self, light: SceneLight) -> usize
Add a light and return its index.
Sourcepub fn to_json_with_hierarchy(&self) -> String
pub fn to_json_with_hierarchy(&self) -> String
Serialize the scene as a glTF 2.0 JSON string including cameras and lights.
Cameras are written in the cameras array.
Lights use the KHR_lights_punctual extension.
Sourcepub fn add_mesh(&mut self, mesh: GltfMesh) -> usize
pub fn add_mesh(&mut self, mesh: GltfMesh) -> usize
Add a mesh to the scene and return its index.
Sourcepub fn mesh_count(&self) -> usize
pub fn mesh_count(&self) -> usize
Return the number of meshes in the scene.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Return the number of nodes in the scene.
Sourcepub fn traverse_depth_first<F>(&self, visitor: F)
pub fn traverse_depth_first<F>(&self, visitor: F)
Traverse the scene graph depth-first, calling visitor with
(node_index, depth, accumulated_translation) for each node.
Sourcepub fn collect_mesh_primitives(&self) -> Vec<(&str, &GltfPrimitive)>
pub fn collect_mesh_primitives(&self) -> Vec<(&str, &GltfPrimitive)>
Collect all mesh primitives in the scene with their associated node names.
Sourcepub fn add_material(&mut self, mat: GltfMaterial) -> usize
pub fn add_material(&mut self, mat: GltfMaterial) -> usize
Add a material and return its index.
Sourcepub fn add_animation(&mut self, anim: GltfAnimation) -> usize
pub fn add_animation(&mut self, anim: GltfAnimation) -> usize
Add an animation and return its index.
Sourcepub fn nodes_using_mesh(&self, mesh_idx: usize) -> Vec<usize>
pub fn nodes_using_mesh(&self, mesh_idx: usize) -> Vec<usize>
Find all nodes that reference a given mesh index.
Sourcepub fn total_vertex_count(&self) -> usize
pub fn total_vertex_count(&self) -> usize
Return the total vertex count across all meshes.
Sourcepub fn total_triangle_count(&self) -> usize
pub fn total_triangle_count(&self) -> usize
Return the total triangle count across all meshes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GltfScene
impl RefUnwindSafe for GltfScene
impl Send for GltfScene
impl Sync for GltfScene
impl Unpin for GltfScene
impl UnsafeUnpin for GltfScene
impl UnwindSafe for GltfScene
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
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.