Visibility Tests For QuadTree
Hi,
I have a level 2 quad tree (16 nodes). What I want to do is to determine which node(s) in the quad tree to actually render. The view rectangle that I have setup can only span either 1, 2 or 4 nodes.
Any help appreciated.
MAMEman.
When you're inserting a rectangle into the quadtree, you look for the smallest node that it fits in. Now, you're looking for all nodes that touch your screen rectangle. Basically, what you should do is check against a node to see if it collides with the screen rectangle. If it does, add it to the list of visible nodes and continue checking it's child nodes. By the end, you should have a list containing all (partially) visible nodes.
Hmmm... Thanks Captain P. I'm not really sure how your infos could be put into practice given my implementation. However I was maybe thinking along the lines of doing some sort of point test to determine which octant(s) that I should render. But I'm not to sure on how to actually implement it.
Captain P,
NOW I actually understand what you are getting at!. When you mentioned
I thought that you meant inserting the rectangle as an object, d'oh. But now I know you simply placing the view rectangle at the root and recursively search the tree for the least bounding square that contains the view rectangle. Anyways I understand now and have a pretty fast rendering routine for my terrain.
Thanks ;)
MAMEman.
NOW I actually understand what you are getting at!. When you mentioned
Quote:
inserting a rectangle into the quadtree
I thought that you meant inserting the rectangle as an object, d'oh. But now I know you simply placing the view rectangle at the root and recursively search the tree for the least bounding square that contains the view rectangle. Anyways I understand now and have a pretty fast rendering routine for my terrain.
Thanks ;)
MAMEman.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement