|
Aviatrix3D 2.0 Dev |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.j3d.aviatrix3d.pipeline.graphics.BaseCullStage
Common implementation of many of the capabilities required by any cull stage.
The class takes care of the majority of the basic implementation requirements such as resizing various data structures, traversing the top of the scene graph super structure (layers, viewports et al) and processing offscreen sources, before sending onto the next stage. All the derived class is required to do is handle traversing a single scene instance and registering any pBuffer offscreens it happens to find. This class will make sure that they are looked after appropriately.
Field Summary | |
protected PBufferTextureSource |
activeParent
The active parent scene of the scene we are processing. |
protected boolean |
checkOffscreens
If set, recurse into Shape3Ds looking for offscreen textures |
protected ClipPlane[] |
clipList
The list of clip plane nodes currently valid while traversing. |
protected float[][] |
clipTxList
The list of clip transforms currently valid while traversing |
protected TransformGroup[] |
currentViewpointPath
Path to the current viewpoint |
protected float[] |
eyePoint
Storage variable for the eye offset values |
protected Fog[] |
fogStack
A stack used to control the depth of the fog nodes down the tree |
protected int |
lastClip
Index to the next place to add items in the clipList |
protected int |
lastFogStack
Index to the next place to add items in the fogStack |
protected int |
lastLight
Index to the next place to add items in the lightList |
protected int |
lastOutputLayer
Index of the the next layer output |
protected int |
lastOutputList
Index to the next output list in the validCullList |
protected int |
lastSubscene
Index of the last subscene in the list |
protected int |
lastTxStack
Index to the next place to add items in the transformStack |
protected int[] |
layerCounts
List of the final layers that are to be passed to the output |
protected Layer[] |
layersTmp
Temporary variable for fetching layers from sub scenes |
protected static int |
LIGHT_INCREMENT
The increment size of the list if it gets overflowed |
protected static int |
LIGHT_START_SIZE
The initial size of the light list |
protected Light[] |
lightList
The list of lights nodes currently valid while traversing. |
protected float[][] |
lightTxList
The list of light transforms currently valid while traversing |
protected static int |
LIST_INCREMENT
The increment size of the list if it gets overflowed |
protected static int |
LIST_START_LENGTH
Initial size of the cull list for the number of offscreen surfaces |
protected MatrixUtils |
matrixUtils
Matrix utility code for doing inversions |
protected javax.vecmath.Matrix4f |
orientationMatrix
Rotation matrix for the orientation provided by user |
protected ViewportCollection[][] |
outputLayers
List of the final layers that are to be passed to the output |
protected SceneGraphObject[][] |
outputSceneParents
List of valid subscene parents as we process them |
protected PBufferTextureSource[] |
pendingParents
Buffer list of sub scenes that still need processing |
protected PBufferTextureSource[] |
pendingSubscenes
Buffer list of sub scenes that still need processing |
protected HashSet |
processedPBufferTextures
Collection of offscreen textures we've found this frame |
protected CulledGeometryReceiver |
receiver
Handler for the output |
protected float[] |
screenOrientation
Storage variable for the screen orientation values |
protected static java.lang.String |
SHARED_BG_MSG
Message when setting the active background if it contains a shared parent |
protected static java.lang.String |
SHARED_VP_MSG
Message when setting the active view if it contains a shared parent |
protected boolean |
terminate
Flag indicating a shutdown of the current processing is requested |
protected TextureUnit[] |
textureUnits
Temp used to get texture units when looking for offscreen textures. |
protected javax.vecmath.Matrix4f[] |
transformStack
A stack used to control the depth of the transform tree |
protected boolean |
useEyePoint
Flag to say explicit eyepoint values have been provided |
protected boolean |
useOrientation
Flag to say explicit screen orientation values have been provided |
protected SceneGraphObject[][] |
validSceneParents
List of valid subscene parents as we process them |
protected javax.vecmath.Matrix4f |
viewMatrix1
Matrix used for pre-computing the view stack |
protected javax.vecmath.Matrix4f |
viewMatrix2
Matrix used for pre-computing the view stack |
protected HashSet |
visitedNodes
Collection of textures we've found for the current parent texture |
protected GraphicsCullOutputDetails[] |
workCullList
List that is being used to fill values into |
Constructor Summary | |
BaseCullStage(int numSurfaces)
Create a basic instance of this class with the list initial internal setup for the given number of renderable surfaces. |
Method Summary | |
protected void |
checkForOffscreens(Shape3D shape,
int buffer)
Check a shape node for the offscreen textures that may be present. |
protected void |
cleanupOldRefs()
Clean up the unused resources after the end of the cull process. |
void |
cull(Layer[] layers,
int numLayers,
int buffer)
Update and cull the scenegraph defined by a set of layers. |
protected void |
cull2DLayer(Layer2D layer,
int subsceneId,
int layerId,
int buffer)
Local internal method to process a single Layer2D instance. |
protected void |
cullCompositeLayer(CompositeLayer layer,
int subsceneId,
int layerId,
int buffer)
Local internal method to process a single CompositeLayer instance. |
protected void |
cullCompositeViewport(CompositeViewport viewport,
int subsceneId,
int layerId,
int viewIndex,
int buffer)
Cull a composite viewport instance. |
protected void |
cullMultipassViewport(MultipassViewport viewport,
int subsceneId,
int layerId,
int viewIndex,
int buffer)
Cull through a simple viewport instance. |
protected void |
cullMultipassViewportLayer(MultipassScene scene,
int subsceneId,
int layerId,
int viewIndex,
int layerIndex,
int buffer)
Cull through a simple viewport instance. |
protected abstract void |
cullRenderPass(RenderPass pass,
int passNumber,
int subsceneId,
int layerId,
int viewIndex,
int layerIndex,
int buffer)
Update and cull the a single pass from a multipass rendering. |
protected abstract void |
cullScene(SimpleScene scene,
int subsceneId,
int layerId,
int viewIndex,
int layerIndex,
int buffer)
Update and cull the scenegraph. |
protected void |
cullSimpleLayer(SimpleLayer layer,
int subsceneId,
int layerId,
int buffer)
Local internal method to process a single SimpleLayer instance. |
protected void |
cullSimpleViewport(SimpleViewport viewport,
int subsceneId,
int layerId,
int viewIndex,
int buffer)
Cull through a simple viewport instance. |
protected abstract int |
cullSingle(Group node,
int buffer)
Update and cull the scenegraph of a single node without doing any other processing. |
protected void |
cullViewport(Viewport view,
int subsceneId,
int layerId,
int viewIndex,
int buffer)
Process a single viewport for culling. |
protected void |
fillEnvData(MultipassScene scene,
GraphicsEnvironmentData envData,
int buffer)
Take a simple scene and fill in a GraphicsEnvironmentData instance. |
protected void |
fillEnvData(RenderPass pass,
GraphicsEnvironmentData envData,
BufferDetails bufferData,
int buffer)
Take a simple scene and fill in a GraphicsEnvironmentData instance. |
protected void |
fillEnvData(SimpleScene scene,
GraphicsEnvironmentData envData,
int buffer)
Take a simple scene and fill in a GraphicsEnvironmentData instance. |
void |
halt()
Force a halt of the current processing. |
boolean |
isOffscreenCheckEnabled()
Find out what the current offscreen check state is. |
protected void |
processSubsceneLayers(Layer[] layers,
int subsceneId,
int numLayers,
int buffer)
Process the layers of a pbuffer texture source. |
protected void |
resizeClipList()
Resize the list if needed. |
protected void |
resizeCullList(int cur_size)
Resize the list if needed. |
protected void |
resizeFogStack()
Resize the fog stack if needed. |
protected void |
resizeLightList()
Resize the list if needed. |
protected void |
resizeOffscreenList()
Resize the list if needed. |
protected void |
resizeOutputLists()
Resize the list if needed. |
protected void |
resizeStack()
Resize the transform stack if needed. |
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 |
Field Detail |
protected static final java.lang.String SHARED_VP_MSG
protected static final java.lang.String SHARED_BG_MSG
protected static final int LIST_START_LENGTH
protected static final int LIST_INCREMENT
protected static final int LIGHT_START_SIZE
protected static final int LIGHT_INCREMENT
protected boolean checkOffscreens
protected PBufferTextureSource[] pendingSubscenes
protected PBufferTextureSource[] pendingParents
protected int lastSubscene
protected ViewportCollection[][] outputLayers
protected int[] layerCounts
protected int lastOutputLayer
protected SceneGraphObject[][] validSceneParents
protected SceneGraphObject[][] outputSceneParents
protected GraphicsCullOutputDetails[] workCullList
protected int lastOutputList
protected javax.vecmath.Matrix4f[] transformStack
protected int lastTxStack
protected Fog[] fogStack
protected int lastFogStack
protected Light[] lightList
protected float[][] lightTxList
protected int lastLight
protected ClipPlane[] clipList
protected float[][] clipTxList
protected int lastClip
protected TextureUnit[] textureUnits
protected HashSet processedPBufferTextures
protected HashSet visitedNodes
protected CulledGeometryReceiver receiver
protected PBufferTextureSource activeParent
protected TransformGroup[] currentViewpointPath
protected javax.vecmath.Matrix4f viewMatrix1
protected javax.vecmath.Matrix4f viewMatrix2
protected javax.vecmath.Matrix4f orientationMatrix
protected float[] screenOrientation
protected float[] eyePoint
protected boolean useOrientation
protected boolean useEyePoint
protected boolean terminate
protected Layer[] layersTmp
protected MatrixUtils matrixUtils
Constructor Detail |
public BaseCullStage(int numSurfaces)
numSurfaces
- Total number of surfaces to prepare rendering forMethod Detail |
public void cull(Layer[] layers, int numLayers, int buffer)
cull
in interface CullStage
layers
- The collection of layers, in order, to rendernumLayers
- The number of valid layers to usebuffer
- The buffer ID to use to output the data to when
multi-threadedpublic void setCulledGeometryReceiver(CulledGeometryReceiver sgr)
setCulledGeometryReceiver
in interface GraphicsCullStage
sgr
- The receiver instance to add or nullpublic void setOffscreenCheckEnabled(boolean state)
setOffscreenCheckEnabled
in interface GraphicsCullStage
state
- true if offscreen textures should be looked forpublic boolean isOffscreenCheckEnabled()
isOffscreenCheckEnabled
in interface GraphicsCullStage
public void setEyePointOffset(float x, float y, float z)
setEyePointOffset
in interface GraphicsCullStage
x
- The x axis offsety
- The y axis offsetz
- The z axis offsetpublic void setScreenOrientation(float x, float y, float z, float a) throws java.lang.IllegalArgumentException
setScreenOrientation
in interface GraphicsCullStage
x
- The x axis componenty
- The y axis componentz
- The z axis componenta
- The angle to rotate around the axis in radians
java.lang.IllegalArgumentException
- The length of the axis is zeropublic void halt()
halt
in interface CullStage
protected abstract void cullScene(SimpleScene scene, int subsceneId, int layerId, int viewIndex, int layerIndex, int buffer)
scene
- The scene instance to cullsubsceneId
- The index of the subscene in the viewport outputlayerId
- The index of the layer in the outputviewIndex
- The index of the viewport in the parent
ViewportCollectionlayerIndex
- The index of the layer within the viewportbuffer
- The buffer ID to use to output the data to when
multi-threadedprotected abstract void cullRenderPass(RenderPass pass, int passNumber, int subsceneId, int layerId, int viewIndex, int layerIndex, int buffer)
pass
- The rendering pass instance to cullsubsceneId
- The index of the subscene in the viewport outputlayerId
- The index of the layer in the outputviewIndex
- The index of the viewport in the parent
ViewportCollectionlayerIndex
- The index of the layer within the viewportbuffer
- The buffer ID to use to output the data to when
multi-threadedprotected abstract int cullSingle(Group node, int buffer)
node
- The root node to start the cull frombuffer
- The buffer ID to use to output the data to when
multi-threaded
protected void cullSimpleLayer(SimpleLayer layer, int subsceneId, int layerId, int buffer)
layer
- The layer instance to processsubsceneId
- The index of the subscene in the viewport outputlayerId
- The index of the layer in the outputbuffer
- The id of the buffer to process for this roundprotected void cullCompositeLayer(CompositeLayer layer, int subsceneId, int layerId, int buffer)
layer
- The layer instance to processsubsceneId
- The index of the subscene in the viewport outputlayerId
- The index of the layer in the outputbuffer
- The id of the buffer to process for this roundprotected void cull2DLayer(Layer2D layer, int subsceneId, int layerId, int buffer)
layer
- The layer instance to processsubsceneId
- The index of the subscene in the viewport outputlayerId
- The index of the layer in the outputbuffer
- The id of the buffer to process for this roundprotected void cullViewport(Viewport view, int subsceneId, int layerId, int viewIndex, int buffer)
view
- The viewport instance to process nowsubsceneId
- The index of the subscene in the viewport outputlayerId
- The index of the layer in the outputviewIndex
- The index of the viewport in the parent
ViewportCollectionbuffer
- The id of the buffer to process for this roundprotected void cullCompositeViewport(CompositeViewport viewport, int subsceneId, int layerId, int viewIndex, int buffer)
viewport
- The viewport instance to processsubsceneId
- The index of the subscene in the viewport outputlayerId
- The index of the layer in the outputviewIndex
- The index of the viewport in the parent
ViewportCollectionbuffer
- The id of the buffer to process for this roundprotected void cullSimpleViewport(SimpleViewport viewport, int subsceneId, int layerId, int viewIndex, int buffer)
viewport
- The viewport instance to processsubsceneId
- The index of the subscene in the viewport outputlayerId
- The index of the layer in the outputviewIndex
- The index of the viewport in the parent
ViewportCollectionbuffer
- The id of the buffer to process for this roundprotected void cullMultipassViewport(MultipassViewport viewport, int subsceneId, int layerId, int viewIndex, int buffer)
viewport
- The viewport instance to processsubsceneId
- The index of the subscene in the viewport outputlayerId
- The index of the layer in the outputviewIndex
- The index of the viewport in the parent
ViewportCollectionbuffer
- The id of the buffer to process for this roundprotected void cullMultipassViewportLayer(MultipassScene scene, int subsceneId, int layerId, int viewIndex, int layerIndex, int buffer)
scene
- The scene instance to processsubsceneId
- The index of the subscene in the viewport outputlayerId
- The index of the layer in the outputviewIndex
- The index of the viewport in the parent
ViewportCollectionlayerIndex
- The index of the layer within the viewportbuffer
- The id of the buffer to process for this roundprotected void processSubsceneLayers(Layer[] layers, int subsceneId, int numLayers, int buffer)
subsceneId
- The index of the subscene in the viewport outputprotected void fillEnvData(SimpleScene scene, GraphicsEnvironmentData envData, int buffer)
scene
- The scene to take data fromenvData
- Data instance to copy it tobuffer
- The buffer ID to use to output the data to when
multi-threadedprotected void fillEnvData(MultipassScene scene, GraphicsEnvironmentData envData, int buffer)
scene
- The scene to take data fromenvData
- Data instance to copy it tobuffer
- The buffer ID to use to output the data to when
multi-threadedprotected void fillEnvData(RenderPass pass, GraphicsEnvironmentData envData, BufferDetails bufferData, int buffer)
envData
- Data instance to copy it tobuffer
- The buffer ID to use to output the data to when
multi-threadedprotected void checkForOffscreens(Shape3D shape, int buffer)
shape
- The object instance to processbuffer
- The id of the buffer to process for this roundprotected void cleanupOldRefs()
This base implementation cleans up the outputLayers list. Derived classes that override this method for their own needs should also make sure to call this method too.
protected final void resizeCullList(int cur_size)
protected final void resizeOutputLists()
protected final void resizeOffscreenList()
protected final void resizeLightList()
protected final void resizeClipList()
protected final void resizeStack()
protected final void resizeFogStack()
|
Aviatrix3D 2.0 Dev |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |