j3d.org Aviatrix3D

org.j3d.aviatrix3d.pipeline
Class FrustumCullStage

java.lang.Object
  extended byorg.j3d.aviatrix3d.pipeline.FrustumCullStage
All Implemented Interfaces:
CullStage

public class FrustumCullStage
extends java.lang.Object
implements CullStage

Handles the complete set of scenegraph maintenance and culling operations.

The culling phase generates a list of nodes to render trimmed according to what is visible in the view frustum, and return values from Cullable.

By default, the implementation will walk into shape3Ds looking for any offscreen textures to be rendered. If you know that you do not have any in the scene, then you can set an internal flag to not look for them, thus achieving a simple performance boost.

Note:

Layers are not implemented yet.

Version:
$Revision: 1.2 $
Author:
Alan Hudson, Justin Couch

Constructor Summary
FrustumCullStage()
          Create a basic instance of this class with the list assuming there are no off-screen buffers in use for the initial internal setup.
FrustumCullStage(int numSurfaces)
          Create a basic instance of this class with the list initial internal setup for the given number of renderable surfaces.
 
Method Summary
 void cull(Layer[] layers, int numLayers, int buffer)
          Update and cull the scenegraph defined by a set of layers.
 void cull(Scene scene, int buffer)
          Update and cull the scenegraph.
 boolean isOffscreenCheckEnabled()
          Find out what the current offscreen check state is.
 void setCulledGeometryReceiver(CulledGeometryReceiver sgr)
          Register a reciever for the output of the sorter.
 void setEyePointOffset(float x, float y, float z)
          Set the eyepoint offset from the centre position.
 void setOffscreenCheckEnabled(boolean state)
          Set the flag for whether to check for offscreen textures or not.
 void setScreenOrientation(float x, float y, float z, float a)
          Set the orientation of this screen relative to the user's normal view direction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FrustumCullStage

public FrustumCullStage()
Create a basic instance of this class with the list assuming there are no off-screen buffers in use for the initial internal setup.


FrustumCullStage

public FrustumCullStage(int numSurfaces)
Create a basic instance of this class with the list initial internal setup for the given number of renderable surfaces. The size is just an initial esstimate, and is used for optimisation purposes to prevent frequent array reallocations internally. As such, the number does not have to be perfect, just good enough.

Parameters:
numSurfaces - Total number of surfaces to prepare rendering for
Method Detail

cull

public void cull(Scene scene,
                 int buffer)
Update and cull the scenegraph. This generates an ordered list of nodes to render. It will not return until the culling is complete.

Specified by:
cull in interface CullStage
Parameters:
scene - The scene instance to cull
buffer - The buffer ID to use to output the data to when multi-threaded

cull

public void cull(Layer[] layers,
                 int numLayers,
                 int buffer)
Update and cull the scenegraph defined by a set of layers. This generates an ordered list of nodes to render. It will not return until the culling is complete.

Specified by:
cull in interface CullStage
Parameters:
layers - The collection of layers, in order, to render
numLayers - The number of valid layers to use
buffer - The buffer ID to use to output the data to when multi-threaded

setCulledGeometryReceiver

public void setCulledGeometryReceiver(CulledGeometryReceiver sgr)
Register a reciever for the output of the sorter. If the value is null, it will clear the currently set receiver.

Specified by:
setCulledGeometryReceiver in interface CullStage
Parameters:
sgr - The receiver instance to add or null

setOffscreenCheckEnabled

public void setOffscreenCheckEnabled(boolean state)
Set the flag for whether to check for offscreen textures or not. By default, this flag is set to true.

Specified by:
setOffscreenCheckEnabled in interface CullStage
Parameters:
state - true if offscreen textures should be looked for

isOffscreenCheckEnabled

public boolean isOffscreenCheckEnabled()
Find out what the current offscreen check state is.

Specified by:
isOffscreenCheckEnabled in interface CullStage
Returns:
true if the checking is being performed

setEyePointOffset

public void setEyePointOffset(float x,
                              float y,
                              float z)
Set the eyepoint offset from the centre position. This is used to model offset view frustums, such as multiple displays or a powerwall. This method will be called with the appropriate values from the RenderPipeline that this culler is inserted into.

Specified by:
setEyePointOffset in interface CullStage
Parameters:
x - The x axis offset
y - The y axis offset
z - The z axis offset

setScreenOrientation

public void setScreenOrientation(float x,
                                 float y,
                                 float z,
                                 float a)
                          throws java.lang.IllegalArgumentException
Set the orientation of this screen relative to the user's normal view direction. The normal orientation of the screen is along the negative Z axis. This method provides and axis-angle reorientation of that direction to one that is facing the screen. Typically this will just involve a rotation around the Y axis of some amount (45 and 90 deg being the most common used in walls and caves). This method will be called with the appropriate values from the RenderPipeline that this culler is inserted into.

Specified by:
setScreenOrientation in interface CullStage
Parameters:
x - The x axis component
y - The y axis component
z - The z axis component
a - The angle to rotate around the axis in radians
Throws:
java.lang.IllegalArgumentException - The length of the axis is zero

j3d.org Aviatrix3D

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - j3d.org