CHAPTER 2 ■ SETTING UP DIFFERENT CAMERA MODES IN YOUR 3D WORLD
116
Inyourmainapplication,youwanttocallonlytheDraw method of the root node of your
quadtree to render all nodes that are in sight of the camera.
Therootnodeshouldcheckwhetheritisinsightofthecamera.Ifitisn’t,itshoulddo
nothing.Ifitis,itshouldpassontheDraw call to each of its four child nodes.
Each of the child nodes should do the same: detect whether they are in sight, and if they
are,passthecallontotheirchildnodesuntilthesmallestnodesarereached.Ifthesearein
sight, they should actually render a grid from their vertices:
public void Draw(Matrix worldMatrix, Matrix viewMatrix, Matrix
➥
projectionMatrix, BoundingFrustum cameraFrustum) ...