ParallelGraphics Forums
SDK
You are here: [Forums]::[General]::[SDK]

Registration 
Registration
Forgot your password?

Help 
Help
Support

Quick search 

Subscribe to newsletters 

Install Cortona VRML Client for FREE!
Outline 3D
Try RobinZone!
email:  password:
   General - SDK

Subject: Re: Hierarchy of all nodes
Sender: nalex@parallelgraphics.com 21.11.07 00:47
We're planning to use your viewer in program development but still are not sure that it provides all necessary functions. We have to get an hierarchy of all nodes of the scene. Could you tell us please if it is possible? We've tried to use such properties as Nodes and RootNodes but didn't get needed result.

It's definitely possible to get a nodes hierarchy. All you have to do is to traverse the scene graph. This can be shown schematically in pseudocode below.

for (each node in Engine.RootNodes)
traverse(node);

function traverse(node)
{
    if (node is already visited)
        return;

    mark node as visited;
    for (each field of node)
    {
        if (field.type == SFNode)
            traverse(field.value);
        else if (field.type == MFNode)
            for (i = 0; i < field.item.count; ++i)
                traverse(field.value[i]);
    }
}

 


Hierarchy of all nodes / jw2001@mail.ru / 20.11.07 22:42
     Re: Hierarchy of all nodes / nalex@parallelgraphics.com / 21.11.07 00:47
         Re: Hierarchy of all nodes / jw2001@mail.ru / 21.11.07 18:52

Messages in thread: 3


© 1998-2007 ParallelGraphics. All rights reserved. Terms of use.