Re: Traverse Question

New Message Reply Date view Thread view Subject view Author view

Aaron Hightower (aaron++at++qbert.paradigmsim.com)
Fri, 2 Dec 1994 00:01:42 -0600 (CST)


> 1) How can one traverse the scene hierarchy for some
> arbitrary reason?
>
> Is the only way to traverse, by using either pfCull,
> pfDraw, or pfSegsIsectNode?

Nope.

> For example I would like to traverse the hierarchy
> computing some information at each Geode, but not
> draw anything as a result of the traversal. My
> understanding is that pfCull will issue draw commands.
> I want to do my computational traversal with no
> drawing then after that do a regular cull and draw.

/*
 ============================================================================
  General traversal to do stuff on all pfGeodes in a performer subtree
 ============================================================================
*/

void
myTraverse( pfNode *node )
{
  int i,n;

  if( pfGetType( node ) == PFTYPE_GEODE ) {
     
    /*** Do your cool stuff to geodes here ***/

    return;
  }
  if( !(pfGetType( node ) & PFCLASS_GROUP )) return;

  n = pfGetNumChildren( node );

  for(i=0; i<n; i++)
    myTraverse( pfGetChild( node, i) );
}

/* END */

You may want to use the result of such a traversal to build a list of
geodes to process separately so you don't have to go through the enitre
scene graph if your doing stuff for each frame. IE: pfNewList(), pfAdd()

Another way you could do stuff per frame is to install node callbacks.
Check out the man page on pfNodeTravFuncs for information on this. The
short story is that this allows you to call one of your functions from
the cull, draw or intersection process if you need to do so. It will
pass the data for the node to your function when and if the
cull/draw/isect process encounters the given node that has a callback
installed. You'll still want to use the above function to actually
find the nodes in the scene graph so that you can install the callbacks
on them.

>
> Thanks,
>
> Curt Goodhart

Hope this helps!

-- 
   _       _______________________________________________
  | |       
__| |___    Aaron Hightower,        aaron++at++paradigmsim.com 
\    * /    Paradigm Simulation Inc          214-960-2301 
 \_   /     15280 Addison Rd.                             
   \ (      Dallas, TX  75248            Vega Development  
    \/     _______________________________________________

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:43 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.