Aviatrix3D
2.0 Beta 2

org.j3d.aviatrix3d.output.graphics
Interface RenderingProcessor

All Known Subinterfaces:
StereoRenderingProcessor
All Known Implementing Classes:
BaseRenderingProcessor, QuadBufferStereoProcessor, SingleEyeStereoProcessor

public interface RenderingProcessor

Handles the rendering for a single output device - be it on-screen or off.

The code expects that everything is set up before each call of the display() callback. It does not handle any recursive rendering requests as that is assumed to have been sorted out before calling this renderer.

Version:
$Revision: 3.8 $
Author:
Justin Couch

Method Summary
 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.
 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.
 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.
 void swapBuffers()
          Cause the buffers of the underlying drawable to swap now.
 

Method Detail

setErrorReporter

public 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. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.

Parameters:
reporter - The instance to use or null

queueDeletedObject

public 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. The next oppourtunity this drawable and any sub-drawables get, this object should have it's cleanup() method called and then the reference to it should be discarded.

Parameters:
obj - The object to queue up for deletion

queueShaderRequests

public void queueShaderRequests(ShaderSourceRenderable[] initList,
                                int numInit,
                                ShaderSourceRenderable[] logList,
                                int numLog)
Queue up a collection of shader objects for processing on the next frame. These processing requests are for either initialisation or log handling, not for rendering.

Parameters:
initList - The shaders needing initialisation
numInit - The number of shaders needing initialisation
logList - The shaders needing log fetching
numLog - The number of shaders needing log fetching

setClearColor

public 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. Colours range from 0 to 1 in the normal manner.

Parameters:
r - The red component of the background clear colour
g - The green component of the background clear colour
b - The blue component of the background clear colour
a - The alpha component of the background clear colour

setColorClearNeeded

public void setColorClearNeeded(boolean state)
Set whether we should always force a local colour clear before beginning any drawing. If this is set to false, then we can assume that there is at least one background floating around that we can use to clear whatever was drawn in the previous frame, and so we can ignore the glClear(GL.GL_COLOR_BUFFER_BIT) call. The default is set to true.

Parameters:
state - true if we should always locally clear first

setDrawableObjects

public void setDrawableObjects(GraphicsDetails[] nodes,
                               int[] renderOps,
                               int numValid,
                               GraphicsEnvironmentData[] envData)
Update the list of items to be rendered to the current list. Draw them at the next oppourtunity.

Parameters:
nodes - The list of nodes in sorted order
renderOps - Operation to perform on each node
numValid - The number of valid items in the array
envData - environment data to be rendered with this scene

render

public boolean render()
Draw to the drawable now. This causes the drawable's context to be made current and the GL commands are issued. Derived classes should not override this method, instead they should use the display() or init() methods as needed.

Returns:
false if the rendering should not continue

swapBuffers

public void swapBuffers()
Cause the buffers of the underlying drawable to swap now.


enableSingleThreaded

public void enableSingleThreaded(boolean state)
Notification that this surface is being drawn to with a single thread. This can be used to optmise internal state handling when needed in a single versus multithreaded environment.

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.

Parameters:
state - true if the device can expect single threaded behaviour

disposeSingleThreadResources

public void disposeSingleThreadResources()
If the output device is marked as single threaded, this instructs the device that the current rendering thread has exited. Next time the draw method is called, a new rendering context will need to be created for a new incoming thread instance. Also, if any other per-thread resources are around, clean those up now. This is called just before that thread exits.


getSurfaceToVWorld

public boolean getSurfaceToVWorld(int x,
                                  int y,
                                  int layer,
                                  int subLayer,
                                  javax.vecmath.Matrix4f matrix)
Get the surface to VWorld transformation matrix. The coordinate system is in the window-system interface: The x,y position is the lower left corner, with height going up the screen and width heading to the right.

Parameters:
x - The X coordinate in the entire surface
y - The Y coordinate in the entire surface
layer - The layer ID to fetch from. Layer 0 is the front-most
subLayer - The ID of the viewport-layer that is needed. If there are no sub-layers, use 0.
matrix - The matrix to copy into
Returns:
Whether the coordinates where on the layer

getPixelLocationInSurface

public boolean getPixelLocationInSurface(int x,
                                         int y,
                                         int layer,
                                         int subLayer,
                                         javax.vecmath.Point3f position)
Convert a pixel location to surface coordinates. The coordinate system is in the window-system interface: The x,y position is the lower left corner, with height going up the screen and width heading to the right.

Parameters:
x - The X coordinate in the entire surface
y - The Y coordinate in the entire surface
layer - The layer ID to fetch from. Layer 0 is the front-most
subLayer - 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.
Returns:
Whether the coordinates where on the layer

getCenterEyeInSurface

public boolean getCenterEyeInSurface(int x,
                                     int y,
                                     int layer,
                                     int subLayer,
                                     javax.vecmath.Point3f position)
Get the Center Eye position in surface coordinates. The coordinate system is in the window-system interface: The x,y position is the lower left corner, with height going up the screen and width heading to the right.

Parameters:
x - The X coordinate in the entire surface
y - The Y coordinate in the entire surface
layer - The layer ID to fetch from. Layer 0 is the front-most
subLayer - The ID of the viewport-layer that is needed. If there are no sub-layers, use 0.
position - The current eye position. It must be preallocated.
Returns:
Whether the coordinates where on the layer

halt

public void halt()
Force a halt of the current processing. Any processing in progress should exit immediately. Used to abort the current scene processing due to application shutdown.


Aviatrix3D
2.0 Beta 2

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