|
Aviatrix3D 2.0 Beta 2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.j3d.aviatrix3d.output.graphics.BaseRenderingProcessor
Common implementation for rendering handling to render for a single output device - be it on-screen or off.
This class implements everything except for the display() method of GLEventListener.
Field Summary | |
protected boolean |
alwaysLocalClear
Flag to say if we the default clear colour should be used, or if there is at least one background that we can make use of |
protected java.lang.Integer[] |
availableClips
Stack of the available OGL clip IDs that could be assigned to clips |
protected java.lang.Integer[] |
availableLights
Stack of the available OGL light IDs that could be assigned to lights |
protected float[] |
clearColor
The current clear colour |
protected org.j3d.util.IntHashMap |
clipIdMap
Mapping of the object ID to it's used clip ID |
protected java.lang.Integer |
currentShaderProgramId
The current program ID for GLSLang shaders. |
protected float[] |
currentViewport
Data describing the current viewport if explicit values used |
protected DeletableRenderable[] |
deleteQueue
Queue for holding deleted textures |
protected GraphicsEnvironmentData[] |
environmentList
Local storage of the environment data collections |
protected org.j3d.util.ErrorReporter |
errorReporter
Error reporter used to send out messages |
protected float[] |
eyePoint
The eye offset from the normal position |
protected javax.media.opengl.GLContext |
glContext
The context from the drawable |
protected boolean |
initComplete
Flag indicating if any initialisation has been performed yet. |
protected static int |
INITIAL_DELETE_SIZE
Initial size of the deletion queue array |
protected static int |
INITIAL_PATH_DEPTH
Initial depth for the number of transforms above a view,fog or bg |
protected static java.lang.Integer |
INVALID_SHADER
The invalid shader ID |
protected int |
lastClipIdx
index in the availableClips list of the last available |
protected int |
lastLightIdx
index in the availableLights list of the last available |
protected int |
lastShaderInitIdx
The current place to add shader init requestors |
protected int |
lastShaderLogIdx
The current place to add shader log requestors |
protected org.j3d.util.IntHashMap |
lightIdMap
Mapping of the object ID to it's used light ID |
protected static int |
LIST_START_SIZE
The initial size of the children list |
protected int |
numDeletions
The number of deletable objects to handle next frame |
protected int |
numRenderables
Number of items in the renderable list |
protected int[] |
operationList
Local storage of the nodes that need to be rendered |
protected GraphicsDetails[] |
renderableList
Local storage of the nodes that need to be rendered |
protected boolean |
resetColor
Flag to say that colour needs to be reset this frame |
protected ShaderSourceRenderable[] |
shaderInitList
The change requestors for data changed sets |
protected static int |
SHADERLIST_START_SIZE
The initial size of the shader init/log lists |
protected ShaderSourceRenderable[] |
shaderLogList
The change requestors for bounds changed sets |
protected boolean |
singleThreaded
Single threaded rendering mode operation state. |
protected javax.vecmath.Matrix4f |
surfaceMatrix
Combined view and projection matrix. |
protected boolean |
terminate
Request that the current drawing terminate immediately. |
Constructor Summary | |
protected |
BaseRenderingProcessor(javax.media.opengl.GLContext context)
Construct handler for rendering objects to the main screen. |
Method Summary | |
protected abstract void |
display()
Called for each rendering loop. |
void |
disposeSingleThreadResources()
If the output device is marked as single threaded, this instructs the device that the current rendering thread has exited. |
void |
enableSingleThreaded(boolean state)
Notification that this surface is being drawn to with a single thread. |
boolean |
getCenterEyeInSurface(int x,
int y,
int layer,
int subLayer,
javax.vecmath.Point3f position)
Get the Center Eye position in surface coordinates. |
boolean |
getPixelLocationInSurface(int x,
int y,
int layer,
int subLayer,
javax.vecmath.Point3f position)
Convert a pixel location to surface coordinates. |
boolean |
getSurfaceToVWorld(int x,
int y,
int layer,
int subLayer,
javax.vecmath.Matrix4f matrix)
Get the surface to VWorld transformation matrix. |
void |
halt()
Force a halt of the current processing. |
protected void |
init()
Called by the drawable immediately after the OpenGL context is initialized or has changed; the GLContext has already been made current when this method is called. |
protected void |
postLayerEnvironmentDraw(javax.media.opengl.GL gl,
GraphicsEnvironmentData data)
Complete the view environment setup at the end of the layer. |
protected void |
postMPPassEnvironmentDraw(javax.media.opengl.GL gl,
GraphicsEnvironmentData data)
Complete the view environment setup at the end of the layer. |
protected void |
preLayerEnvironmentDraw(javax.media.opengl.GL gl,
GraphicsEnvironmentData data)
Setup the view environment for a specific layer for drawing now. |
protected void |
preMPPassEnvironmentDraw(javax.media.opengl.GL gl,
GraphicsEnvironmentData data)
Setup the view environment for a specific pass of a multipass rendering for drawing now. |
void |
queueDeletedObject(DeletableRenderable obj)
An object has been detected as being deleted (no internal or external references to it left) and it needs to be cleaned up. |
void |
queueShaderRequests(ShaderSourceRenderable[] initList,
int numInit,
ShaderSourceRenderable[] logList,
int numLog)
Queue up a collection of shader objects for processing on the next frame. |
boolean |
render()
Draw to the drawable now. |
protected void |
renderViewpoint(javax.media.opengl.GL gl,
GraphicsEnvironmentData data)
Render the viewpoint setup. |
void |
setClearColor(float r,
float g,
float b,
float a)
Set the background colour that this surface should be cleared to before the drawing step. |
void |
setColorClearNeeded(boolean state)
Set whether we should always force a local colour clear before beginning any drawing. |
void |
setDrawableObjects(GraphicsDetails[] nodes,
int[] renderOps,
int numValid,
GraphicsEnvironmentData[] envData)
Update the list of items to be rendered to the current list. |
void |
setErrorReporter(org.j3d.util.ErrorReporter reporter)
Register an error reporter with the engine so that any errors generated by the node's internals can be reported in a nice, pretty fashion. |
protected void |
setupMultipassViewport(javax.media.opengl.GL gl,
GraphicsEnvironmentData data)
Setup the viewport environment to be drawn for a multipass rendering. |
protected void |
setupViewport(javax.media.opengl.GL gl,
GraphicsEnvironmentData data)
Setup the viewport environment to be drawn, but do not yet set up the viewpoint and other per-layer-specific effects. |
void |
swapBuffers()
Cause the buffers of the underlying drawable to swap now. |
protected void |
terminateCleanup()
If termination has been requested during the last call to the display loop, this method is called to destroy and cleanup the context instance. |
protected void |
updateProjectionMatrix(javax.media.opengl.GL gl,
GraphicsEnvironmentData data)
Update the projection matrix. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int LIST_START_SIZE
protected static final int INITIAL_PATH_DEPTH
protected static final int INITIAL_DELETE_SIZE
protected static final int SHADERLIST_START_SIZE
protected static final java.lang.Integer INVALID_SHADER
protected float[] clearColor
protected boolean resetColor
protected GraphicsDetails[] renderableList
protected int[] operationList
protected int numRenderables
protected GraphicsEnvironmentData[] environmentList
protected DeletableRenderable[] deleteQueue
protected int numDeletions
protected ShaderSourceRenderable[] shaderInitList
protected ShaderSourceRenderable[] shaderLogList
protected int lastShaderInitIdx
protected int lastShaderLogIdx
protected java.lang.Integer currentShaderProgramId
protected java.lang.Integer[] availableLights
protected int lastLightIdx
protected org.j3d.util.IntHashMap lightIdMap
protected java.lang.Integer[] availableClips
protected int lastClipIdx
protected org.j3d.util.IntHashMap clipIdMap
protected boolean alwaysLocalClear
protected javax.vecmath.Matrix4f surfaceMatrix
protected float[] eyePoint
protected float[] currentViewport
protected boolean initComplete
protected boolean terminate
protected org.j3d.util.ErrorReporter errorReporter
protected javax.media.opengl.GLContext glContext
protected boolean singleThreaded
Constructor Detail |
protected BaseRenderingProcessor(javax.media.opengl.GLContext context)
context
- The context that this processor is working onMethod Detail |
public void setErrorReporter(org.j3d.util.ErrorReporter reporter)
setErrorReporter
in interface RenderingProcessor
reporter
- The instance to use or nullpublic void halt()
halt
in interface RenderingProcessor
public void queueDeletedObject(DeletableRenderable obj)
cleanup()
method called and then the
reference to it should be discarded.
queueDeletedObject
in interface RenderingProcessor
obj
- The instance to be queued up as no longer being usedpublic void queueShaderRequests(ShaderSourceRenderable[] initList, int numInit, ShaderSourceRenderable[] logList, int numLog)
queueShaderRequests
in interface RenderingProcessor
initList
- The shaders needing initialisationnumInit
- The number of shaders needing initialisationlogList
- The shaders needing log fetchingnumLog
- The number of shaders needing log fetchingpublic void setClearColor(float r, float g, float b, float a)
setClearColor
in interface RenderingProcessor
r
- The red component of the background clear colourg
- The green component of the background clear colourb
- The blue component of the background clear coloura
- The alpha component of the background clear colourpublic void setColorClearNeeded(boolean state)
setColorClearNeeded
in interface RenderingProcessor
state
- true if we should always locally clear firstpublic void setDrawableObjects(GraphicsDetails[] nodes, int[] renderOps, int numValid, GraphicsEnvironmentData[] envData)
setDrawableObjects
in interface RenderingProcessor
nodes
- The list of nodes in sorted orderrenderOps
- Operation to perform on each nodenumValid
- The number of valid items in the arrayenvData
- environment data to be rendered with this scenepublic final boolean render()
render
in interface RenderingProcessor
public void swapBuffers()
swapBuffers
in interface RenderingProcessor
public void enableSingleThreaded(boolean state)
This method should never be called by end user code. It is purely for
the purposes of the RenderManager
to inform the device about what state it can expect.
enableSingleThreaded
in interface RenderingProcessor
state
- true if the device can expect single threaded behaviourpublic void disposeSingleThreadResources()
disposeSingleThreadResources
in interface RenderingProcessor
public boolean getSurfaceToVWorld(int x, int y, int layer, int subLayer, javax.vecmath.Matrix4f matrix)
getSurfaceToVWorld
in interface RenderingProcessor
x
- The X coordinate on the surfacey
- The Y coordinate on the surfacematrix
- The matrix to copy into It must be preallocated.layer
- The layer ID to fetch from. Layer 0 is the front-mostsubLayer
- The ID of the viewport-layer that is needed. If there
are no sub-layers, use 0.
public boolean getPixelLocationInSurface(int x, int y, int layer, int subLayer, javax.vecmath.Point3f position)
getPixelLocationInSurface
in interface RenderingProcessor
x
- The X coordinatey
- The Y coordinatelayer
- The layer ID to fetch from. Layer 0 is the front-mostsubLayer
- The ID of the viewport-layer that is needed. If there
are no sub-layers, use 0.position
- The converted position. It must be preallocated.
public boolean getCenterEyeInSurface(int x, int y, int layer, int subLayer, javax.vecmath.Point3f position)
getCenterEyeInSurface
in interface RenderingProcessor
x
- The X coordinate on the surfacey
- The Y coordinate on the surfaceposition
- The current eye position. It must be preallocated.layer
- The layer ID to fetch from. Layer 0 is the front-mostsubLayer
- The ID of the viewport-layer that is needed. If there
are no sub-layers, use 0.
protected abstract void display()
protected void init()
protected void terminateCleanup()
protected void setupViewport(javax.media.opengl.GL gl, GraphicsEnvironmentData data)
gl
- The gl context to draw withdata
- The view environment information to setupprotected void setupMultipassViewport(javax.media.opengl.GL gl, GraphicsEnvironmentData data)
gl
- The gl context to draw withdata
- The view environment information to setupprotected void preLayerEnvironmentDraw(javax.media.opengl.GL gl, GraphicsEnvironmentData data)
gl
- The gl context to draw withdata
- The view environment information to setupprotected void postLayerEnvironmentDraw(javax.media.opengl.GL gl, GraphicsEnvironmentData data)
gl
- The gl context to draw withdata
- The view environment information to setupprotected void preMPPassEnvironmentDraw(javax.media.opengl.GL gl, GraphicsEnvironmentData data)
gl
- The gl context to draw withdata
- The view environment information to setupprotected void postMPPassEnvironmentDraw(javax.media.opengl.GL gl, GraphicsEnvironmentData data)
gl
- The gl context to draw withdata
- The view environment information to setupprotected void renderViewpoint(javax.media.opengl.GL gl, GraphicsEnvironmentData data)
gl
- The gl context to draw withdata
- The view environment information to setupprotected void updateProjectionMatrix(javax.media.opengl.GL gl, GraphicsEnvironmentData data)
gl
- The gl context to draw withdata
- The view environment information to setup
|
Aviatrix3D 2.0 Beta 2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |