feat(spatial): basic interface

This commit is contained in:
Nova
2022-06-05 05:04:16 -04:00
parent fedbe17b7a
commit 1d93046d5e
4 changed files with 74 additions and 19 deletions

View File

@@ -11,6 +11,19 @@ pub struct Scenegraph<'a> {
pub nodes: HashMap<String, RcCell<Node<'a>>>,
}
impl<'a> Scenegraph<'a> {
pub fn set_client(&mut self, client: RcCell<Client<'a>>) {
self.client = client.downgrade();
}
pub fn add_node(&mut self, node: Node<'a>) -> RcCell<Node<'a>> {
let path = node.get_path().to_string();
let node_rc = RcCell::new(node);
self.nodes.insert(path, node_rc.clone());
node_rc
}
}
impl<'a> Default for Scenegraph<'a> {
fn default() -> Self {
Scenegraph {