refactor(model): move into drawable

This commit is contained in:
Nova
2022-09-25 03:41:36 -04:00
parent 0e09aae9f8
commit 69f7a432d5
7 changed files with 77 additions and 55 deletions

19
src/nodes/drawable/mod.rs Normal file
View File

@@ -0,0 +1,19 @@
pub mod model;
use super::Node;
use crate::core::{client::Client, registry::Registry};
use std::sync::Arc;
use stereokit::{lifecycle::DrawContext, StereoKit};
pub trait Drawable: Send + Sync {
fn draw(&self, sk: &StereoKit, draw_ctx: &DrawContext);
}
pub static DRAWABLE_REGISTRY: Registry<dyn Drawable> = Registry::new();
pub fn create_interface(client: &Arc<Client>) {
let node = Node::create(client, "", "drawable", false);
node.add_local_signal("createModelFromFile", model::create_from_file);
node.add_local_signal("createModelFromResource", model::create_from_resource);
node.add_to_scenegraph();
}