RE: [Plib-users] Custom Traversal
Brought to you by:
sjbaker
From: Dave M. <Dav...@dy...> - 2000-12-01 17:53:40
|
> I want to add pre and post draw callback > functions for each node under a certain > branch ( an flt model ). Since there are > no callbacks for branches I need to > traverse the branch to find all the > ssgLeaf's.. Is there a ssgTraverse > function or a class ? in plib-cvs, look at ssgEntity::setTravCallback(). also, traversing a graph is pretty simple: void traverse ( ssgEntity *e ) { if ( e -> isAKindOf ( SSG_TYPE_BRANCH ) ) { ssgBranch *br = (ssgBranch *) e ; for ( int i = 0 ; i < br -> getNumKids () ; i++ ) traverse ( br -> getKid ( i ) ) ; } if ( e -> isAKindOf ( SSG_TYPE_LEAF ) ) { ssgLeaf* leaf = (ssgLeaf*) e ; // do something } } --Dave |