resource: implement retrieving loaded SceneGraph dependencies
This commit is contained in:
parent
aa8d94851c
commit
a3118f32e2
|
@ -79,8 +79,7 @@ async fn main() {
|
|||
let separate_gltf = resman.request::<Gltf>("assets/pos-testing/child-node-cubes.glb").unwrap(); */
|
||||
//drop(resman);
|
||||
|
||||
//cube_gltf.wait_recurse_dependencies_load();
|
||||
thread::sleep(Duration::from_millis(500));
|
||||
cube_gltf.wait_recurse_dependencies_load();
|
||||
let cube_mesh = &cube_gltf.data_ref()
|
||||
.unwrap().meshes[0];
|
||||
/* let crate_mesh = &crate_gltf.data_ref()
|
||||
|
@ -92,8 +91,7 @@ async fn main() {
|
|||
let sponza_model = resman.request::<Gltf>("../assets/sponza/Sponza.gltf").unwrap();
|
||||
drop(resman);
|
||||
|
||||
//sponza_model.wait_recurse_dependencies_load();
|
||||
thread::sleep(Duration::from_millis(10000));
|
||||
sponza_model.wait_recurse_dependencies_load();
|
||||
let sponza_scene = &sponza_model.data_ref()
|
||||
.unwrap().scenes[0];
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ impl ModelLoader {
|
|||
let handle = ResHandle::new_ready(None, new_mesh);
|
||||
ctx.resource_manager.store_uuid(handle.clone());
|
||||
node.mesh = Some(handle.clone());
|
||||
scene.insert(&scene_node, handle);
|
||||
scene.insert(&scene_node, (handle.clone(), handle.untyped_clone()));
|
||||
}
|
||||
|
||||
for child in gnode.children() {
|
||||
|
|
|
@ -2,7 +2,6 @@ pub mod loader;
|
|||
pub use loader::*;
|
||||
|
||||
pub mod material;
|
||||
use lyra_math::Transform;
|
||||
use lyra_scene::SceneGraph;
|
||||
use crate::ResourceData;
|
||||
pub use material::*;
|
||||
|
@ -51,11 +50,4 @@ impl ResourceData for Gltf {
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
impl Gltf {
|
||||
/// Collects all Gltf meshes and gets their world Transform.
|
||||
pub fn collect_world_meshes(&self) -> Vec<(ResHandle<Mesh>, Transform)> {
|
||||
todo!()
|
||||
}
|
||||
}
|
|
@ -97,7 +97,10 @@ impl GltfScene {
|
|||
|
||||
impl ResourceData for SceneGraph {
|
||||
fn dependencies(&self) -> Vec<crate::UntypedResHandle> {
|
||||
todo!()
|
||||
self.world().view::<&crate::UntypedResHandle>()
|
||||
.iter()
|
||||
.map(|han| han.clone())
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
|
|
|
@ -96,7 +96,7 @@ pub struct UntypedResource {
|
|||
pub(crate) condvar: Arc<(Mutex<bool>, Condvar)>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Component)]
|
||||
pub struct UntypedResHandle{
|
||||
pub(crate) res: Arc<RwLock<UntypedResource>>,
|
||||
#[allow(dead_code)]
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use std::any::Any;
|
||||
|
||||
use crossbeam::channel::Receiver;
|
||||
use lyra_ecs::World;
|
||||
use notify_debouncer_full::DebouncedEvent;
|
||||
|
|
Loading…
Reference in New Issue