|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.j3d.aviatrix3d.output.graphics.BaseSurface
public abstract class BaseSurface
Implementation of the most basic drawable surface, supporting the minimal number of features that is to be used by other, more complete implementations.
This implementation of GraphicsOutputDevice renders to a normal GLCanvas or GLJPanel (depending on if "lightweight" is true) instance and provides pBuffer support as needed. Stereo support is not provided and all associated methods always indicate negative returns on query about support.
Field Summary | |
---|---|
protected float |
alphaCutoff
Alpha Test value for the parts of transparent objects that should be handled as opaque |
protected boolean |
canCreatePBuffers
Flag to say whether the underlying factory can create pbuffers |
protected javax.media.opengl.GLDrawable |
canvas
The real canvas that we draw to |
protected javax.media.opengl.GLContext |
canvasContext
The context of the main canvas |
protected org.j3d.aviatrix3d.output.graphics.MainCanvasDescriptor |
canvasDescriptor
Buffer descriptor for the main canvas |
protected RenderingProcessor |
canvasRenderer
Abstract representation of the underlying primary renderer |
protected org.j3d.util.ErrorReporter |
errorReporter
Error reporter used to send out messages |
protected static java.lang.String |
FAILED_CONTEXT_MSG
Message when the GL context failed to initialise |
protected boolean |
initComplete
Flag to say that init has been called on the canvas |
protected int |
numRenderables
Number of items in the renderable list |
protected OffscreenBufferRenderable[] |
renderableList
Local storage of the nodes that need to be rendered |
protected java.util.Map<OffscreenBufferRenderable,RenderingProcessor> |
rendererMap
Maps from a ofscreen texture instance to the rendererProcessor for it |
protected BaseSurface |
sharedSurface
Flag indicating if this surface is shared with another |
protected boolean |
singleThreaded
Single threaded rendering mode operation state. |
protected SurfaceMonitor |
surfaceMonitor
Manager of surface status so that we know what to do with the context (ie refresh it or makeCurrent again). |
protected boolean |
terminate
Flag indicating whether rendering should be stopped right now |
protected boolean |
useTwoPassTransparent
Flag indicating if we should do single or two-pass rendering of transparent objects. |
Fields inherited from interface org.j3d.aviatrix3d.pipeline.graphics.GraphicsOutputDevice |
---|
ALTERNATE_FRAME_STEREO, NO_STEREO, QUAD_BUFFER_STEREO, TWO_CANVAS_STEREO |
Constructor Summary | |
---|---|
protected |
BaseSurface(BaseSurface sharedWith)
Construct a surface shares it's GL context with the given surface. |
Method Summary | |
---|---|
void |
addSurfaceInfoListener(SurfaceInfoListener l)
Add a surface info listener instance to this surface. |
void |
checkForExtension(java.lang.String glExtensionString)
Add an extension string to check for at startup. |
boolean |
completeCanvasInitialisation(javax.media.opengl.GL gl)
Used during initialisation of the system for the first time. |
protected RenderingProcessor |
createRenderingProcessor(javax.media.opengl.GLContext ctx)
Create a new RenderingProcessor instance for this surface. |
void |
dispose()
Instruct this surface that you have finished with the resources needed and to dispose all rendering resources. |
void |
disposeSingleThreadResources()
If the output device is marked as single threaded, this instructs the device that the current rendering thread has exited. |
boolean |
draw(ProfilingData profilingData)
Instruct the surface to draw the collected set of nodes now. |
void |
enableSingleThreaded(boolean state)
Notification that this surface is being drawn to with a single thread. |
void |
enableTwoPassTransparentRendering(boolean state)
Enable or disable two pass rendering of transparent objects. |
float |
getAlphaTestCutoff()
Get the current value of the alpha test cutoff number. |
boolean |
getCenterEyeInSurface(int x,
int y,
int layer,
int subLayer,
javax.vecmath.Point3f position,
java.lang.String deviceId,
boolean useLastFound)
Get the Center Eye position in surface coordinates. |
javax.media.opengl.GLContext |
getGLContext()
Package local method to fetch the GLContext that this surface has. |
boolean |
getPixelLocationInSurface(int x,
int y,
int layer,
int subLayer,
javax.vecmath.Point3f position,
java.lang.String deviceId,
boolean useLastFound)
Convert a pixel location to surface coordinates. |
protected javax.media.opengl.GLContext |
getSharedGLContext()
Get the context object from the shared surface, if there is one set. |
float |
getStereoEyeSeparation()
Get the current eye separation value - always returns 0. |
int |
getStereoRenderingPolicy()
Get the current stereo rendering policy in use. |
boolean |
getSurfaceToVWorld(int x,
int y,
int layer,
int subLayer,
javax.vecmath.Matrix4f matrix,
java.lang.String deviceId,
boolean useLastFound)
Get the surface to VWorld transformation matrix. |
protected void |
init()
Common internal initialisation for the constructors. |
protected boolean |
initCanvas()
Called by the drawable immediately after the OpenGL context is initialized; the GLContext has already been made current when this method is called. |
boolean |
isDisposed()
Check to see the disposal state of the surface. |
boolean |
isQuadStereoAvailable()
Check to see whether this surface supports Quad buffer stereo rendering - which it does not. |
boolean |
isShared()
Check to see whether this object is currently shared. |
boolean |
isStereoAvailable()
Check to see whether this surface supports stereo rendering - which is does not. |
boolean |
isTwoPassTransparentEnabled()
Check the state of the two pass transprent rendering flag. |
void |
removeSurfaceInfoListener(SurfaceInfoListener l)
Remove a surface info listener from this surface. |
void |
setAlphaTestCutoff(float cutoff)
If two pass rendering of transparent objects is enabled, this is the alpha test value used when deciding what to render. |
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(GraphicsRequestData otherData,
GraphicsInstructions[] commands,
int numValid)
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 |
setStereoEyeSeparation(float sep)
Set the eye separation value when rendering stereo. |
void |
setStereoRenderingPolicy(int policy)
Set the rendering policy used when handling stereo. |
void |
swap()
Swap the buffers now if the surface supports multiple buffer drawing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.j3d.aviatrix3d.pipeline.graphics.GraphicsOutputDevice |
---|
addGraphicsResizeListener, removeGraphicsResizeListener |
Methods inherited from interface org.j3d.aviatrix3d.pipeline.OutputDevice |
---|
getSurfaceObject |
Field Detail |
---|
protected static final java.lang.String FAILED_CONTEXT_MSG
protected javax.media.opengl.GLDrawable canvas
protected javax.media.opengl.GLContext canvasContext
protected SurfaceMonitor surfaceMonitor
protected RenderingProcessor canvasRenderer
protected org.j3d.aviatrix3d.output.graphics.MainCanvasDescriptor canvasDescriptor
protected OffscreenBufferRenderable[] renderableList
protected int numRenderables
protected boolean initComplete
protected java.util.Map<OffscreenBufferRenderable,RenderingProcessor> rendererMap
protected BaseSurface sharedSurface
protected boolean canCreatePBuffers
protected org.j3d.util.ErrorReporter errorReporter
protected boolean terminate
protected boolean singleThreaded
protected float alphaCutoff
protected boolean useTwoPassTransparent
Constructor Detail |
---|
protected BaseSurface(BaseSurface sharedWith)
If the sharedWith parameter is null, then this is just treated as an ordinary non-shared frame. The return flag will be set appropriately.
sharedWith
- The surface that you'd like this surface to share
the GL context with, if possible. May be null.Method Detail |
---|
public boolean isStereoAvailable()
isStereoAvailable
in interface GraphicsOutputDevice
public boolean isQuadStereoAvailable()
isQuadStereoAvailable
in interface GraphicsOutputDevice
public void setStereoEyeSeparation(float sep)
setStereoEyeSeparation
in interface GraphicsOutputDevice
sep
- The amount of eye separationpublic float getStereoEyeSeparation()
getStereoEyeSeparation
in interface GraphicsOutputDevice
public void setStereoRenderingPolicy(int policy)
setStereoRenderingPolicy
in interface GraphicsOutputDevice
policy
- The policy to currently use
java.lang.IllegalArgumentException
- The policy type is not one of the legal
selections.public int getStereoRenderingPolicy()
NO_STEREO
. May be
overridden by derived class to provide a different answer.
getStereoRenderingPolicy
in interface GraphicsOutputDevice
public void setClearColor(float r, float g, float b, float a)
setClearColor
in interface GraphicsOutputDevice
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 GraphicsOutputDevice
state
- true if we should always locally clear firstpublic void enableTwoPassTransparentRendering(boolean state)
enableTwoPassTransparentRendering
in interface GraphicsOutputDevice
state
- true if we should enable two pass renderingpublic boolean isTwoPassTransparentEnabled()
isTwoPassTransparentEnabled
in interface GraphicsOutputDevice
public void setAlphaTestCutoff(float cutoff)
This flag applies to this surface and any offscreen surfaces that are children of this surface (FBOs, PBuffers etc).
setAlphaTestCutoff
in interface GraphicsOutputDevice
cutoff
- The alpha value at which to enable renderingpublic float getAlphaTestCutoff()
getAlphaTestCutoff
in interface GraphicsOutputDevice
public void setDrawableObjects(GraphicsRequestData otherData, GraphicsInstructions[] commands, int numValid)
setDrawableObjects
in interface GraphicsOutputDevice
otherData
- data to be processed before the renderingcommands
- The list of drawable surfaces to rendernumValid
- The number of valid items in the arraypublic void swap()
swap
in interface GraphicsOutputDevice
public boolean getSurfaceToVWorld(int x, int y, int layer, int subLayer, javax.vecmath.Matrix4f matrix, java.lang.String deviceId, boolean useLastFound)
getSurfaceToVWorld
in interface GraphicsOutputDevice
x
- The X coordinate in the entire surfacey
- The Y coordinate in the entire surfacelayer
- 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.matrix
- The matrix to copy intodeviceId
- A user-defined identifier for the requesting device when
using the lastFound itemsuseLastFound
- Should we skip the search process and use the last
data found for this layer/sublayer combo.
public boolean getPixelLocationInSurface(int x, int y, int layer, int subLayer, javax.vecmath.Point3f position, java.lang.String deviceId, boolean useLastFound)
getPixelLocationInSurface
in interface GraphicsOutputDevice
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.deviceId
- A user-defined identifier for the requesting device when
using the lastFound itemsuseLastFound
- Should we skip the search process and use the last
data found for this layer/sublayer combo.
public boolean getCenterEyeInSurface(int x, int y, int layer, int subLayer, javax.vecmath.Point3f position, java.lang.String deviceId, boolean useLastFound)
getCenterEyeInSurface
in interface GraphicsOutputDevice
x
- The X coordinate in the entire surfacey
- The Y coordinate in the entire surfacelayer
- 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 current eye position. It must be preallocated.deviceId
- A user-defined identifier for the requesting device when
using the lastFound itemsuseLastFound
- Should we skip the search process and use the last
data found for this layer/sublayer combo.
public void addSurfaceInfoListener(SurfaceInfoListener l)
addSurfaceInfoListener
in interface GraphicsOutputDevice
l
- The new listener instance to addpublic void removeSurfaceInfoListener(SurfaceInfoListener l)
removeSurfaceInfoListener
in interface GraphicsOutputDevice
l
- The listener instance to removepublic void setErrorReporter(org.j3d.util.ErrorReporter reporter)
setErrorReporter
in interface OutputDevice
reporter
- The instance to use or nullpublic boolean draw(ProfilingData profilingData)
The return value indicates success or failure in the ability to render this frame. Typically it will indicate failure if the underlying surface has been disposed of, either directly through the calling of the method on this interface, or through an internal check mechanism. If failure is indicated, then check to see if the surface has been disposed of and discontinue rendering if it has.
draw
in interface OutputDevice
profilingData
- The timing and load data
public void dispose()
dispose
in interface OutputDevice
public boolean isDisposed()
dispose()
method has been called or an internal dispose handler
has detected the underlying surface is no longer valid to draw to.
isDisposed
in interface OutputDevice
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 OutputDevice
state
- true if the device can expect single threaded behaviourpublic void disposeSingleThreadResources()
disposeSingleThreadResources
in interface OutputDevice
protected RenderingProcessor createRenderingProcessor(javax.media.opengl.GLContext ctx)
StandardRenderingProcessor
. Implementations may
override this to provide their own processor instance.
ctx
- The parent context to use for the processor
public void checkForExtension(java.lang.String glExtensionString)
glExtensionString
- String to check for being validpublic boolean isShared()
public boolean completeCanvasInitialisation(javax.media.opengl.GL gl)
The return value indicates success or failure in the ability to initialise this surface. Typically it will indicate failure if the underlying surface has been disposed of or a failure to find the capabilities needed. The default implementation returns true.
gl
- An initialised, current gl context to play with
protected void init()
protected boolean initCanvas()
initComplete
is currently set to false.
The return value indicates success or failure in the ability to initialise this surface. Typically it will indicate failure if the underlying surface has been disposed of or a failure to find the capabilities needed. The default implementation returns true.
public javax.media.opengl.GLContext getGLContext()
protected javax.media.opengl.GLContext getSharedGLContext()
|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |