Fix #6: Rendering Shared 3D Models #10
|
@ -79,8 +79,7 @@ async fn main() {
|
||||||
let separate_gltf = resman.request::<Gltf>("assets/pos-testing/child-node-cubes.glb").unwrap(); */
|
let separate_gltf = resman.request::<Gltf>("assets/pos-testing/child-node-cubes.glb").unwrap(); */
|
||||||
//drop(resman);
|
//drop(resman);
|
||||||
|
|
||||||
//cube_gltf.wait_recurse_dependencies_load();
|
cube_gltf.wait_recurse_dependencies_load();
|
||||||
thread::sleep(Duration::from_millis(500));
|
|
||||||
let cube_mesh = &cube_gltf.data_ref()
|
let cube_mesh = &cube_gltf.data_ref()
|
||||||
.unwrap().meshes[0];
|
.unwrap().meshes[0];
|
||||||
/* let crate_mesh = &crate_gltf.data_ref()
|
/* 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();
|
let sponza_model = resman.request::<Gltf>("../assets/sponza/Sponza.gltf").unwrap();
|
||||||
drop(resman);
|
drop(resman);
|
||||||
|
|
||||||
//sponza_model.wait_recurse_dependencies_load();
|
sponza_model.wait_recurse_dependencies_load();
|
||||||
thread::sleep(Duration::from_millis(10000));
|
|
||||||
let sponza_scene = &sponza_model.data_ref()
|
let sponza_scene = &sponza_model.data_ref()
|
||||||
.unwrap().scenes[0];
|
.unwrap().scenes[0];
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ impl ModelLoader {
|
||||||
let handle = ResHandle::new_ready(None, new_mesh);
|
let handle = ResHandle::new_ready(None, new_mesh);
|
||||||
ctx.resource_manager.store_uuid(handle.clone());
|
ctx.resource_manager.store_uuid(handle.clone());
|
||||||
node.mesh = Some(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() {
|
for child in gnode.children() {
|
||||||
|
|
|
@ -2,7 +2,6 @@ pub mod loader;
|
||||||
pub use loader::*;
|
pub use loader::*;
|
||||||
|
|
||||||
pub mod material;
|
pub mod material;
|
||||||
use lyra_math::Transform;
|
|
||||||
use lyra_scene::SceneGraph;
|
use lyra_scene::SceneGraph;
|
||||||
use crate::ResourceData;
|
use crate::ResourceData;
|
||||||
pub use material::*;
|
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 {
|
impl ResourceData for SceneGraph {
|
||||||
fn dependencies(&self) -> Vec<crate::UntypedResHandle> {
|
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 {
|
fn as_any(&self) -> &dyn std::any::Any {
|
||||||
|
|
|
@ -96,7 +96,7 @@ pub struct UntypedResource {
|
||||||
pub(crate) condvar: Arc<(Mutex<bool>, Condvar)>,
|
pub(crate) condvar: Arc<(Mutex<bool>, Condvar)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Component)]
|
||||||
pub struct UntypedResHandle{
|
pub struct UntypedResHandle{
|
||||||
pub(crate) res: Arc<RwLock<UntypedResource>>,
|
pub(crate) res: Arc<RwLock<UntypedResource>>,
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
use std::any::Any;
|
|
||||||
|
|
||||||
use crossbeam::channel::Receiver;
|
use crossbeam::channel::Receiver;
|
||||||
use lyra_ecs::World;
|
use lyra_ecs::World;
|
||||||
use notify_debouncer_full::DebouncedEvent;
|
use notify_debouncer_full::DebouncedEvent;
|
||||||
|
|
Loading…
Reference in New Issue