Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Iterating through the nodes in a scenegraph???

This topic is 5286 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

Hello all, I''ve just implemented a scene graph and I''m able to render the children. I''m have some trouble though because I want to start at the root and iterate through the whole scene. Since each node (including the root) can have as many nodes as they want how would I go about iterating through the whole tree?? I hope my question is clear. The way I have it now I have to set a pointer to a certain child and from there I''m able to do transformations on it and its children.

Share this post

Link to post
Share on other sites
call the function recursively (can''t spell it :/..)

procedure update(node: tnode);
for i := 0 to high(nodes) do
the rest of the update code here..

sorta delphi code but that''s the way i do it!

Share this post

Link to post
Share on other sites
Here''s some pseudocode that should,
hopefully, give you the basic idea.

void SceneNode::doSomething() {
// Perform some operation like rendering
// updating

// Now process all child nodes

void SceneNode:rocessChildren() {
// Process all chldren, if any
for all children begin
end loop;

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!