コード例 #1
0
 public void Draw(DoubleVector3 cameraLocation, BoundingFrustum originBasedViewFrustum, Matrix originBasedViewMatrix, Matrix projectionMatrix)
 {
     if (_hasSubnodes)
     {
         // TODO: we'd like to stop traversing into subnodes if this node's mesh isn't visibile, but our
         // horizon culling algorithm isn't that great right now and the primary faces are so large that
         // sometimes all of their sample points are below the horizon even though we're above that face
         // and would want to draw its children.  For now, we'll scan all subnodes regardless.  The child
         // node's meshes will do visibility culling on an individual basis.
         foreach (var subnode in _subnodes)
         {
             subnode.Draw(cameraLocation, originBasedViewFrustum, originBasedViewMatrix, projectionMatrix);
         }
     }
     else
     {
         _renderer.Draw(_locationRelativeToPlanet, cameraLocation, originBasedViewMatrix, projectionMatrix);
         _mesh.Draw(cameraLocation, originBasedViewFrustum, originBasedViewMatrix, projectionMatrix);
     }
 }