34 lines
827 B
Rust
34 lines
827 B
Rust
use lyra_math::Transform;
|
|
use lyra_resource::{optionally_add_to_dep, ResourceData, UntypedResHandle};
|
|
|
|
use super::Mesh;
|
|
use crate::ResHandle;
|
|
|
|
/// A Node in the Gltf file
|
|
#[derive(Clone, Default)]
|
|
pub struct GltfNode {
|
|
pub name: Option<String>,
|
|
pub mesh: Option<ResHandle<Mesh>>,
|
|
pub transform: Transform,
|
|
pub children: Vec<GltfNode>,
|
|
}
|
|
|
|
impl ResourceData for GltfNode {
|
|
fn dependencies(&self) -> Vec<crate::UntypedResHandle> {
|
|
let mut deps: Vec<UntypedResHandle> = self.children.iter()
|
|
.flat_map(|c| c.mesh.as_ref().map(|h| h.untyped_clone()))
|
|
.collect();
|
|
|
|
optionally_add_to_dep(&mut deps, &self.mesh);
|
|
|
|
deps
|
|
}
|
|
|
|
fn as_any(&self) -> &dyn std::any::Any {
|
|
self
|
|
}
|
|
|
|
fn as_any_mut(&mut self) -> &mut dyn std::any::Any {
|
|
self
|
|
}
|
|
} |