Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

rjwr10

Stan Melax Plane shifting BSP

This topic is 5388 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

Hey all, In my engine i''m trying to implement stan melax''s plane shifting bsp theory, details at: http://www.melax.com/bsp/index.html Anyhow, I''m trying to get my engine to be able to load his example worlds. The BSP tree is added at the end of a world geometry file (he uses a basic text format) heres a demo file: vertices, faces texcoords, blah area_bsp 0.000000 0.000000 1.000000 -4.000000 0.000000 0.000000 1.000000 0.000000 NULL 1.000000 0.000000 0.000000 9.000000 0.000000 1.000000 0.000000 9.000000 1.000000 0.000000 0.000000 13.000000 0.000000 -1.000000 0.000000 -11.000000 NULL 1.000000 0.000000 0.000000 20.000000 NULL 0.000000 1.000000 0.000000 20.000000 NULL NULL 0.000000 -1.000000 0.000000 -12.000000 NULL NULL *snip* they get long, obviously... anyhow, each line is of the form (x,y,z,d), xyz is the normal coords of the plane and d is the distance of the plane from the origin. The plane on the area_bsp line is the head of the tree. I have them loaded in a binary tree fine, but my question is, when I traverse the tree, how do i know if a leaf is a solid or an empty leaf. All the leaves are just NULL in the file. Has anyone worked with Melax'' demos? Can anyone provide some insight? Heres what I''m doing right now (pseudocode) CollidePointBSP(node, point3) { if(node->isleaf) // if it is NULL in file return true; classifypoint(point3, node->plane) //front or back if(test == front) return CollidePointBSP(node->right, point3); else if(test == back) return CollidePointBSP(node->left, point3); else //point is coplanar with the plane return false; //what do i return when coplanar? } Thanks a lot, rj

Share this post


Link to post
Share on other sites
Advertisement

  • 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!