Aviatrix3D
2.1.0

org.j3d.aviatrix3d.pipeline.graphics
Class BaseStateSortStage

java.lang.Object
  extended by org.j3d.aviatrix3d.pipeline.graphics.BaseSortStage
      extended by org.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.12 $
Author:
Justin Couch

Field Summary
protected  java.lang.Object[] clipTmp
          Temp array for fetching clipPlane objects from the HashSets below.
protected  AppearanceRenderable currentAppearance
          The currently valid appearance
protected  AppearanceAttributeRenderable currentBlendAttr
          The currently valid blend attributes
protected  org.j3d.util.HashSet currentClipPlanes
          Set of current clip planes that are being processed
protected  AppearanceAttributeRenderable currentDepthAttr
          The currently valid depth buffer attributes
protected  Renderable currentFog
          The currently valid local fog
protected  java.util.Stack<VisualDetails> currentLights
          List of current lights that are being processed
protected  AppearanceAttributeRenderable currentLineAttr
          The currently valid line attributes
protected  ObjectRenderable currentMaterial
          The currently valid material
protected  AppearanceAttributeRenderable currentPointAttr
          The currently valid point attributes
protected  AppearanceAttributeRenderable currentPolyAttr
          The currently valid polygon attributes
protected  ShaderRenderable currentShader
          The currently valid GLSlang shader
protected  ComponentRenderable currentShaderArgs
          The currently valid shader arguments (GLSLang)
protected  AppearanceAttributeRenderable currentStencilAttr
          The currently valid stencil buffer attributes
protected  ComponentRenderable[] currentTextures
          Listing of currently valid textures
protected static int GUESS_NUM_COMPONENTS
          The guess at the number of components in a shape
protected  org.j3d.util.HashSet keepClipPlanes
          Set to hold onto clip planes that are common between last node and this
protected  java.util.Stack<VisualDetails> keepLights
          List to hold onto lights that are common between last node and this
protected  java.util.HashMap<VisualDetails,java.lang.Integer> lightIdMap
          Mapping of the VisualDetails instance to the global ID
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  org.j3d.util.HashSet oldClipPlanes
          Set for holding the difference between the current and new sets
protected  java.util.Stack<VisualDetails> oldLights
          List of lights for holding the difference between the current and new light lists
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
 
Fields inherited from class org.j3d.aviatrix3d.pipeline.graphics.BaseSortStage
commandList, errorReporter, 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(AppearanceRenderable app, GraphicsInstructions instr, int offset)
          Check on the blending attributes setup and change as necessary.
protected  int updateDepthAttribs(AppearanceRenderable app, GraphicsInstructions instr, int offset)
          Check on the depth attributes setup and change as necessary.
protected  int updateFog(Renderable fog, GraphicsInstructions instr, int offset)
          Check on the material setup and change as necessary.
protected  int updateLineAttribs(AppearanceRenderable app, GraphicsInstructions instr, int offset)
          Check on the line attributes setup and change as necessary.
protected  int updateMaterial(AppearanceRenderable app, GraphicsInstructions instr, int offset)
          Check on the material setup and change as necessary.
protected  int updatePointAttribs(AppearanceRenderable app, GraphicsInstructions instr, int offset)
          Check on the polygon attributes setup and change as necessary.
protected  int updatePolyAttribs(AppearanceRenderable app, GraphicsInstructions instr, int offset)
          Check on the polygon attributes setup and change as necessary.
protected  int updateShader(AppearanceRenderable app, GraphicsInstructions instr, int offset)
          Check on the shader setup and change as necessary.
protected  int updateStencilAttribs(AppearanceRenderable app, GraphicsInstructions instr, int offset)
          Check on the stencil attributes setup and change as necessary.
protected  int updateTextures(AppearanceRenderable 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, setErrorReporter, setSortedGeometryReceiver, sort, sort2DNodes, 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


currentLights

protected java.util.Stack<VisualDetails> currentLights
List of current lights that are being processed


oldLights

protected java.util.Stack<VisualDetails> oldLights
List of lights for holding the difference between the current and new light lists


keepLights

protected java.util.Stack<VisualDetails> keepLights
List to hold onto lights that are common between last node and this


lightIdMap

protected java.util.HashMap<VisualDetails,java.lang.Integer> 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 org.j3d.util.HashSet currentClipPlanes
Set of current clip planes that are being processed


oldClipPlanes

protected org.j3d.util.HashSet oldClipPlanes
Set for holding the difference between the current and new sets


keepClipPlanes

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


currentAppearance

protected AppearanceRenderable currentAppearance
The currently valid appearance


currentMaterial

protected ObjectRenderable currentMaterial
The currently valid material


currentPolyAttr

protected AppearanceAttributeRenderable currentPolyAttr
The currently valid polygon attributes


currentLineAttr

protected AppearanceAttributeRenderable currentLineAttr
The currently valid line attributes


currentPointAttr

protected AppearanceAttributeRenderable currentPointAttr
The currently valid point attributes


currentBlendAttr

protected AppearanceAttributeRenderable currentBlendAttr
The currently valid blend attributes


currentDepthAttr

protected AppearanceAttributeRenderable currentDepthAttr
The currently valid depth buffer attributes


currentStencilAttr

protected AppearanceAttributeRenderable currentStencilAttr
The currently valid stencil buffer attributes


currentShader

protected ShaderRenderable currentShader
The currently valid GLSlang shader


currentShaderArgs

protected ComponentRenderable currentShaderArgs
The currently valid shader arguments (GLSLang)


currentFog

protected Renderable currentFog
The currently valid local fog


currentTextures

protected ComponentRenderable[] 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(Renderable 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(AppearanceRenderable 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(AppearanceRenderable 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(AppearanceRenderable 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(AppearanceRenderable 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(AppearanceRenderable 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(AppearanceRenderable 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(AppearanceRenderable 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(AppearanceRenderable 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(AppearanceRenderable 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.1.0

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