edu.mines.jtk.sgl
Class CullContext

java.lang.Object
  extended by edu.mines.jtk.sgl.TraversalContext
      extended by edu.mines.jtk.sgl.TransformContext
          extended by edu.mines.jtk.sgl.CullContext

public class CullContext
extends TransformContext

A context for view frustum culling.

A cull context has a draw list, in which it accumulates copies of its node stack. Typically, a leaf node copies the node stack to the draw list when its bounding sphere intersects the view frustum of the cull context.

Version:
2005.05.26
Author:
Dave Hale, Colorado School of Mines

Constructor Summary
CullContext(ViewCanvas canvas)
          Constructs a transform context for the specified view canvas.
 
Method Summary
 void appendNodes()
          Appends the node stack to the draw list in this context.
 boolean frustumIntersectsSphereOf(Node node)
          Determines whether the view frustrum intersects the bounding sphere of the specified node.
 DrawList getDrawList()
          Gets the draw list accumulated in this context.
 void popLocalToWorld()
          Restores the most recently saved (pushed) local-to-world transform.
 void popNode()
          Restores the most recently saved (pushed) node.
 void pushLocalToWorld(Matrix44 transform)
          Saves the local-to-world transform before appending a transform.
 void pushNode(Node node)
          Saves the current node, and then makes the specified node current.
 
Methods inherited from class edu.mines.jtk.sgl.TransformContext
getCubeToLocal, getCubeToPixel, getCubeToView, getCubeToWorld, getLocalToCube, getLocalToPixel, getLocalToView, getLocalToWorld, getPixelToCube, getPixelToLocal, getPixelToView, getPixelToWorld, getView, getViewCanvas, getViewToCube, getViewToLocal, getViewToPixel, getViewToWorld, getWorld, getWorldToCube, getWorldToLocal, getWorldToPixel, getWorldToView
 
Methods inherited from class edu.mines.jtk.sgl.TraversalContext
countNodes, getNode, getNode, getNodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CullContext

public CullContext(ViewCanvas canvas)
Constructs a transform context for the specified view canvas.

Parameters:
canvas - the view canvas.
Method Detail

frustumIntersectsSphereOf

public boolean frustumIntersectsSphereOf(Node node)
Determines whether the view frustrum intersects the bounding sphere of the specified node.

Parameters:
node - the node with a bounding sphere.
Returns:
true, if the view frustum intersects the bounding sphere; false, otherwise.

appendNodes

public void appendNodes()
Appends the node stack to the draw list in this context.


getDrawList

public DrawList getDrawList()
Gets the draw list accumulated in this context.

Returns:
the draw list.

pushNode

public void pushNode(Node node)
Saves the current node, and then makes the specified node current.

Overrides:
pushNode in class TraversalContext
Parameters:
node - the new current node.

popNode

public void popNode()
Restores the most recently saved (pushed) node. Discards the current node.

Overrides:
popNode in class TraversalContext

pushLocalToWorld

public void pushLocalToWorld(Matrix44 transform)
Saves the local-to-world transform before appending a transform. The specified transform matrix is post-multiplied with the current local-to-world transform, such that the specified transform is applied first when transforming local coordinates to world coordinates.

Overrides:
pushLocalToWorld in class TransformContext
Parameters:
transform - the transform to append.

popLocalToWorld

public void popLocalToWorld()
Restores the most recently saved (pushed) local-to-world transform. Discards the current local-to-world transform.

Overrides:
popLocalToWorld in class TransformContext