Currently, if you change something in the tree (like translating a node) it is done for every child at once.
It would be nice to record a Vector of things to do into a tasks field. When calling update on a tree every task will be executed. This way the system would have to "walk down" the tree only once per update, instead of several time (once per action).
API mock up:
update(&mut self, jobs: Option<Vec<Job>>) : applies all jobs, then applies its own jobs, after that appends its own jobs to the recieved jobs and passes them down to all its children
add_job(&mut self, new_job: Job) : Adds new_job of the enum Job to the nodes tasks field.
The only thing which could be optimized after that is some kind of "Scene Registry" which keeps a pointer to every node, sorted by their names. This way the get_node() function could become faster. But we would have to store this big registry.
We'll see if its needed when building scenes at a bigger scale.
Currently, if you change something in the tree (like translating a node) it is done for every child at once. It would be nice to record a Vector of things to do into a
tasks
field. When callingupdate
on a tree every task will be executed. This way the system would have to "walk down" the tree only once per update, instead of several time (once per action).API mock up:
update(&mut self, jobs: Option<Vec<Job>>)
: applies alljobs
, then applies its own jobs, after that appends its own jobs to the recievedjobs
and passes them down to all its childrenadd_job(&mut self, new_job: Job)
: Addsnew_job
of the enumJob
to the nodestasks
field.The only thing which could be optimized after that is some kind of "Scene Registry" which keeps a pointer to every node, sorted by their names. This way the
get_node()
function could become faster. But we would have to store this big registry. We'll see if its needed when building scenes at a bigger scale.