Jump to content
  • Advertisement
Sign in to follow this  
mameman

Visibility Tests For QuadTree

This topic is 4089 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Captain P,

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.


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!