Quadtrees

Started by
1 comment, last by fettodingo 22 years, 2 months ago
Im reading on how and what the quadtrees are, and I think I get it now. But I still dont understand some things. If I have a triangle that spans over 2 leaves, should I split the triangle or should I make the triangle a member to both? And how should I render the tree? If I where to render one triangle at the time from leaf to leaf, wouldnt it be very slow, since I have to switch textures and stuff all the time?!
;-)
Advertisement
"If I have a triangle that spans over 2 leaves, should I split the triangle or should I make the triangle a member to both?"

if you split it, you get more tris to render. include the tri in BOTH leaves. when the tri is rendered, mark it, so there is no need to render it twice. also store an index, instead the triangle itself in the tree.

"And how should I render the tree? If I where to render one triangle at the time from leaf to leaf, wouldnt it be very slow, since I have to switch textures and stuff all the time?!"

you can "walk" the tree, push all visible tris into a buffer, then sort by texture and render the buffer.
Thanks. Im finaly getting the picture of how to make the quad.
;-)

This topic is closed to new replies.

Advertisement