• Advertisement
Sign in to follow this  

Problem with my Scenegraph tree

This topic is 4172 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, First sorry for the very general subject, but i didn't how how to describe my problem in that short subjetc line. I have a design problem(i haven't been programming for abou 2 months just because of design probs) with my scenegraph(a simple tree): I want to store the traversed form of the tree(a std::list of nodes) somewhere(atm it's stored with the root of the tree) and i thought it would be faster to update that list when adding a node to the tree and not building the list every frame from scratch. Now i have some problems with that approach. I thought i simply store an iterator for the list in every node, and when adding a children to a node it can just add itself at the right position in the list,as it has the iterator of its parent(and the iterator for its siblings). But that would mean i would be restricted to building the tree from the top(root) down(leaves) and i have to pay special attention in what order i add children to nodes. This introduces potential bug sources and is not good design(is it?). So should i just build the list from scratch each frame? or update it everytime something changes. If later: how can i accomplish that? i hope i made clear what i want. thanks in advance. regards, m4gnus

Share this post


Link to post
Share on other sites
Advertisement
Sounds like you've fallen victim to premature optimization.

Neverminding any hackish issues with updating a traversal list, why bother with the traversal list instead of just traversing your tree? Are you dealing with tens of thousands of tree nodes?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement