How can I determine if a cube is adjacent to another cube, and optimize its buffers if so?

Posted by Christian Frantz on Game Development See other posts from Game Development or by Christian Frantz
Published on 2013-06-28T05:59:07Z Indexed on 2013/06/28 10:30 UTC
Read the original article Hit count: 301

Filed under:
|

I'm trying to optimize the rendering of a collection of cubes, (based on an answer I was given to another question I asked). I understand the logic behind occlusion culling, but I'm having trouble with the code.

When I create a cube, I want to determine if that cube is touching another existing cube, and if so I don't want to generate the redundant data in my vertex or index buffers.

I'm planning on making a method that I call from my cube constructor so that everytime I create a cube, these checks are made, and neither occluded face is ever drawn.

How would I go about this?

© Game Development or respective owner

Related posts about XNA

Related posts about c#