Re: [Plib-users] (Again) accessing vertex infos of a loaded model
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2001-10-22 02:50:35
|
Filippo wrote: > > This message was sent from Geocrawler.com by "Filippo" <sup...@ho...> > > Hi Steve, thanks for your patience... I saw a lot > of methods to query the geometry in ssgLeaf, but > I can't get these data from the ssgEntity I have > in return from the ssgLoad function because I > don't know how to get to the leaves. Starting with the node returned by the loader, you can say something like: void extract_vertices ( ssgEntity *node ) { /* WARNING - RECURSIVE! */ if ( node -> isAKindOf ( ssgTypeLeaf () ) ) { ssgLeaf *l = (ssgLeaf *) node ; ...extract the vertices from 'l'... } else if ( node -> isAKindOf ( ssgTypeBranch () ) ) { ssgBranch *b = (ssgBranch *)node ; for ( int i = 0 ; i < b->getNumKids() ; i++ ) extract_vertices ( b -> getKid ( i ) ) ; } } It's a *little* more complex than that because there could be ssgTransform nodes in the heirarchy - you'd have to accumulate the matrix transforms to know how to position the vertices you get out of the leaf nodes beneath. Also, you need to think about what you want to do with ssgSelector nodes. ----------------------------- Steve Baker ------------------------------- Mail : <sjb...@ai...> WorkMail: <sj...@li...> URLs : http://web2.airmail.net/sjbaker1 http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net http://freeglut.sf.net http://toobular.sf.net http://lodestone.sf.net |