Re: [TuxKart-devel] Question about plib
Status: Alpha
Brought to you by:
sjbaker
From: Matze B. <ma...@br...> - 2004-07-19 15:01:37
|
On Mon, 19 Jul 2004, Jacob Persson wrote: > I've been playing with ODE and plib trying achieve some collision detection > between meshes loaded from AC-models. > > I've seen the getNumTriangles functions and such in ssgLeaf but I don't > understand how you get to them from ssgTransform. I also wonder if > getVertex (0) returns the pointer to the start of the vertex-array. And At > last does plib store it's meshes using indices? if so can get you get access > to them? From what I've seen in plib, getVertex(index) does return the actual vertex (the pointer is to a float[3]). A transform itself has no vertices or faces, you have to look at the children (eventually it's just more ssgBranches), but somewhere down in that tree you'll find ssgLeaf's that contain the geometry. (In my testapp this resulted in a nasty long line like this: //world->print(); // oh how ugly... but this is just a prototype app... ssgBranch* branch = dynamic_cast<ssgBranch*> (world); if(branch) { ssgTransform* trans = dynamic_cast<ssgTransform*> (branch->getKid(0)); if(trans) { ssgBranch* branch = dynamic_cast<ssgBranch*>(trans->getKid(0)); if(branch) { for(int i = 0; i < branch->getNumKids(); ++i) { ssgLeaf* leaf = dynamic_cast<ssgLeaf*> (branch->getKid(i)); ... ). I couldn't find a nicer way so far, maybe Steve knows one... Greetings, Matze |