Aviatrix3D
2.0 Dev

org.j3d.aviatrix3d.pipeline.graphics
Class BaseStateSortStage

java.lang.Object
  extended byorg.j3d.aviatrix3d.pipeline.graphics.BaseSortStage
      extended byorg.j3d.aviatrix3d.pipeline.graphics.BaseStateSortStage
All Implemented Interfaces:
GraphicsSortStage
Direct Known Subclasses:
StateAndTransparencyDepthSortStage, StateSortStage

public abstract class BaseStateSortStage
extends BaseSortStage

Implementation of common functionality used by sort stage that implement state sorting.

Version:
$Revision: 3.4 $
Author:
Justin Couch

Field Summary
protected  java.lang.Object[] clipTmp
          Temp array for fetching clipPlane objects from the HashSets below.
protected  Appearance currentAppearance
          The currently valid appearance
protected  BlendAttributes currentBlendAttr
          The currently valid blend attributes
protected  HashSet currentClipPlanes
          Set of current clip planes that are being processed
protected  DepthAttributes currentDepthAttr
          The currently valid depth buffer attributes
protected  Fog currentFog
          The currently valid local fog
protected  FragmentShader currentFragShader
          The currently valid fragment shader
protected  HashSet currentLights
          Set of current lights that are being processed
protected  LineAttributes currentLineAttr
          The currently valid line attributes
protected  Material currentMaterial
          The currently valid material
protected  PointAttributes currentPointAttr
          The currently valid point attributes
protected  PolygonAttributes currentPolyAttr
          The currently valid polygon attributes
protected  Shader currentShader
          The currently valid GLSlang shader
protected  ShaderArguments currentShaderArgs
          The currently valid shader arguments (GLSLang)
protected  ShaderProgram currentShaderProgram
          The currently valid shader program (GLSLang)
protected  StencilAttributes currentStencilAttr
          The currently valid stencil buffer attributes
protected  TextureUnit[] currentTextures
          Listing of currently valid textures
protected  VertexShader currentVtxShader
          The currently valid vertex shader
protected static int GUESS_NUM_COMPONENTS
          The guess at the number of components in a shape
protected  HashSet keepClipPlanes
          Set to hold onto clip planes that are common between last node and this
protected  HashSet keepLights
          Set to hold onto lights that are common between last node and this
protected  java.util.HashMap lightIdMap
          Mapping of the VisualDetails instance to the global ID
protected  java.lang.Object[] lightTmp
          Temp array for fetching lights objects from the HashSets below.
protected  VisualDetails[] newClipPlanes
          Temp array for holding new clip planes on the object being processed
protected  VisualDetails[] newLights
          Temp array for holdin new lights on the object being processed
protected  int numTextures
          Number of valid textures currently active
protected  HashSet oldClipPlanes
          Set for holding the difference between the current and new sets
protected  HashSet oldLights
          Set for holding the different between the current and new sets
protected  StateSortComparator stateComparator
          Comparator instance for the state sorting
protected static java.lang.Integer[] TEX_IDS
          Listing of int to Integer equivalents for texture IDs
protected  TextureUnit[] textureTmp
          temp array for fetching textures from the appearance
 
Fields inherited from class org.j3d.aviatrix3d.pipeline.graphics.BaseSortStage
commandList, instructionMap, lastGlobalId, LIST_START_SIZE, terminate
 
Constructor Summary
protected BaseStateSortStage(int numSurfaces)
          Create an empty sorting stage that initialises the internal structures to assume that there is a minumum number of surfaces, both on and offscreen.
 
Method Summary
protected  int appendClipPlanes(GraphicsCullOutputDetails node, GraphicsInstructions instr, int offset)
          Append the clip planess onto the existing list.
protected  int appendLights(GraphicsCullOutputDetails node, GraphicsInstructions instr, int offset)
          Append the lights onto the existing list.
protected  int appendObject(GraphicsCullOutputDetails node, GraphicsInstructions instr, int offset)
          Append a single object onto the existing list.
protected  int cleanupObjects(GraphicsInstructions instr, int offset)
          At the end of the scene, we need to make sure that we've turned off all the lights, clip planes and current rendering state that is left.
protected  int cleanupVisuals(GraphicsInstructions instr, int offset)
          Convenience method to clear all the current visual information.
protected  int updateBlendAttribs(Appearance app, GraphicsInstructions instr, int offset)
          Check on the blending attributes setup and change as necessary.
protected  int updateDepthAttribs(Appearance app, GraphicsInstructions instr, int offset)
          Check on the depth attributes setup and change as necessary.
protected  int updateFog(Fog fog, GraphicsInstructions instr, int offset)
          Check on the material setup and change as necessary.
protected  int updateLineAttribs(Appearance app, GraphicsInstructions instr, int offset)
          Check on the line attributes setup and change as necessary.
protected  int updateMaterial(Appearance app, GraphicsInstructions instr, int offset)
          Check on the material setup and change as necessary.
protected  int updatePointAttribs(Appearance app, GraphicsInstructions instr, int offset)
          Check on the polygon attributes setup and change as necessary.
protected  int updatePolyAttribs(Appearance app, GraphicsInstructions instr, int offset)
          Check on the polygon attributes setup and change as necessary.
protected  int updateShader(Appearance app, GraphicsInstructions instr, int offset)
          Check on the shader setup and change as necessary.
protected  int updateStencilAttribs(Appearance app, GraphicsInstructions instr, int offset)
          Check on the stencil attributes setup and change as necessary.
protected  int updateTextures(Appearance app, GraphicsInstructions instr, int offset)
          Check on the texture listing setup and change as necessary.
 
Methods inherited from class org.j3d.aviatrix3d.pipeline.graphics.BaseSortStage
estimateInstructionSize, estimateInstructionSize, halt, realloc, setSortedGeometryReceiver, sort, sortNodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GUESS_NUM_COMPONENTS

protected static final int GUESS_NUM_COMPONENTS
The guess at the number of components in a shape

See Also:
Constant Field Values

TEX_IDS

protected static final java.lang.Integer[] TEX_IDS
Listing of int to Integer equivalents for texture IDs


stateComparator

protected StateSortComparator stateComparator
Comparator instance for the state sorting


newLights

protected VisualDetails[] newLights
Temp array for holdin new lights on the object being processed


lightTmp

protected java.lang.Object[] lightTmp
Temp array for fetching lights objects from the HashSets below.


currentLights

protected HashSet currentLights
Set of current lights that are being processed


oldLights

protected HashSet oldLights
Set for holding the different between the current and new sets


keepLights

protected HashSet keepLights
Set to hold onto lights that are common between last node and this


lightIdMap

protected java.util.HashMap lightIdMap
Mapping of the VisualDetails instance to the global ID


newClipPlanes

protected VisualDetails[] newClipPlanes
Temp array for holding new clip planes on the object being processed


clipTmp

protected java.lang.Object[] clipTmp
Temp array for fetching clipPlane objects from the HashSets below.


currentClipPlanes

protected HashSet currentClipPlanes
Set of current clip planes that are being processed


oldClipPlanes

protected HashSet oldClipPlanes
Set for holding the difference between the current and new sets


keepClipPlanes

protected HashSet keepClipPlanes
Set to hold onto clip planes that are common between last node and this


currentAppearance

protected Appearance currentAppearance
The currently valid appearance


currentMaterial

protected Material currentMaterial
The currently valid material


currentPolyAttr

protected PolygonAttributes currentPolyAttr
The currently valid polygon attributes


currentLineAttr

protected LineAttributes currentLineAttr
The currently valid line attributes


currentPointAttr

protected PointAttributes currentPointAttr
The currently valid point attributes


currentBlendAttr

protected BlendAttributes currentBlendAttr
The currently valid blend attributes


currentDepthAttr

protected DepthAttributes currentDepthAttr
The currently valid depth buffer attributes


currentStencilAttr

protected StencilAttributes currentStencilAttr
The currently valid stencil buffer attributes


currentShader

protected Shader currentShader
The currently valid GLSlang shader


currentShaderProgram

protected ShaderProgram currentShaderProgram
The currently valid shader program (GLSLang)


currentShaderArgs

protected ShaderArguments currentShaderArgs
The currently valid shader arguments (GLSLang)


currentVtxShader

protected VertexShader currentVtxShader
The currently valid vertex shader


currentFragShader

protected FragmentShader currentFragShader
The currently valid fragment shader


currentFog

protected Fog currentFog
The currently valid local fog


textureTmp

protected TextureUnit[] textureTmp
temp array for fetching textures from the appearance


currentTextures

protected TextureUnit[] currentTextures
Listing of currently valid textures


numTextures

protected int numTextures
Number of valid textures currently active

Constructor Detail

BaseStateSortStage

protected BaseStateSortStage(int numSurfaces)
Create an empty sorting stage that initialises the internal structures to assume that there is a minumum number of surfaces, both on and offscreen.

Method Detail

appendObject

protected int appendObject(GraphicsCullOutputDetails node,
                           GraphicsInstructions instr,
                           int offset)
Append a single object onto the existing list. Checks versus existing state and starts and stops as required.

Parameters:
node - The node instance to look at appending
offset - The distance into instr array of values to start
instr - Instruction instant to put the details into
Returns:
The completed offset into the instr array we finished at

appendLights

protected int appendLights(GraphicsCullOutputDetails node,
                           GraphicsInstructions instr,
                           int offset)
Append the lights onto the existing list. Checks versus existing state and starts and stops as required.

Parameters:
node - The node instance to look at appending
offset - The distance into instr array of values to start
instr - Instruction instant to put the details into
Returns:
The completed offset into the instr array we finished at

appendClipPlanes

protected int appendClipPlanes(GraphicsCullOutputDetails node,
                               GraphicsInstructions instr,
                               int offset)
Append the clip planess onto the existing list. Checks versus existing state and starts and stops as required.

Parameters:
node - The node instance to look at appending
offset - The distance into instr array of values to start
instr - Instruction instant to put the details into
Returns:
The completed offset into the instr array we finished at

updateFog

protected int updateFog(Fog fog,
                        GraphicsInstructions instr,
                        int offset)
Check on the material setup and change as necessary.

Parameters:
fog - The Fog instance to source info from
offset - The distance into instr array of values to start
instr - Instruction instant to put the details into
Returns:
The completed offset into the instr array we finished at

updateShader

protected int updateShader(Appearance app,
                           GraphicsInstructions instr,
                           int offset)
Check on the shader setup and change as necessary.

Parameters:
app - The appearance instance to source info from
offset - The distance into instr array of values to start
instr - Instruction instant to put the details into
Returns:
The completed offset into the instr array we finished at

updateMaterial

protected int updateMaterial(Appearance app,
                             GraphicsInstructions instr,
                             int offset)
Check on the material setup and change as necessary.

Parameters:
app - The appearance instance to source info from
offset - The distance into instr array of values to start
instr - Instruction instant to put the details into
Returns:
The completed offset into the instr array we finished at

updatePolyAttribs

protected int updatePolyAttribs(Appearance app,
                                GraphicsInstructions instr,
                                int offset)
Check on the polygon attributes setup and change as necessary.

Parameters:
app - The appearance instance to source info from
offset - The distance into instr array of values to start
instr - Instruction instant to put the details into
Returns:
The completed offset into the instr array we finished at

updateLineAttribs

protected int updateLineAttribs(Appearance app,
                                GraphicsInstructions instr,
                                int offset)
Check on the line attributes setup and change as necessary.

Parameters:
app - The appearance instance to source info from
offset - The distance into instr array of values to start
instr - Instruction instant to put the details into
Returns:
The completed offset into the instr array we finished at

updateDepthAttribs

protected int updateDepthAttribs(Appearance app,
                                 GraphicsInstructions instr,
                                 int offset)
Check on the depth attributes setup and change as necessary.

Parameters:
app - The appearance instance to source info from
offset - The distance into instr array of values to start
instr - Instruction instant to put the details into
Returns:
The completed offset into the instr array we finished at

updateStencilAttribs

protected int updateStencilAttribs(Appearance app,
                                   GraphicsInstructions instr,
                                   int offset)
Check on the stencil attributes setup and change as necessary.

Parameters:
app - The appearance instance to source info from
offset - The distance into instr array of values to start
instr - Instruction instant to put the details into
Returns:
The completed offset into the instr array we finished at

updatePointAttribs

protected int updatePointAttribs(Appearance app,
                                 GraphicsInstructions instr,
                                 int offset)
Check on the polygon attributes setup and change as necessary.

Parameters:
app - The appearance instance to source info from
offset - The distance into instr array of values to start
instr - Instruction instant to put the details into
Returns:
The completed offset into the instr array we finished at

updateBlendAttribs

protected int updateBlendAttribs(Appearance app,
                                 GraphicsInstructions instr,
                                 int offset)
Check on the blending attributes setup and change as necessary.

Parameters:
app - The appearance instance to source info from
offset - The distance into instr array of values to start
instr - Instruction instant to put the details into
Returns:
The completed offset into the instr array we finished at

updateTextures

protected int updateTextures(Appearance app,
                             GraphicsInstructions instr,
                             int offset)
Check on the texture listing setup and change as necessary.

Parameters:
app - The appearance instance to source info from
offset - The distance into instr array of values to start
instr - Instruction instant to put the details into
Returns:
The completed offset into the instr array we finished at

cleanupObjects

protected int cleanupObjects(GraphicsInstructions instr,
                             int offset)
At the end of the scene, we need to make sure that we've turned off all the lights, clip planes and current rendering state that is left. Do that now.

Parameters:
offset - The distance into instr array of values to start
instr - Instruction instant to put the details into
Returns:
The completed offset into the instr array we finished at

cleanupVisuals

protected int cleanupVisuals(GraphicsInstructions instr,
                             int offset)
Convenience method to clear all the current visual information. Visuals are defined as material, shaders various attributes etc.

Parameters:
offset - The distance into instr array of values to start
instr - Instruction instant to put the details into
Returns:
The completed offset into the instr array we finished at

Aviatrix3D
2.0 Dev

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