|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.aviatrix3d.SceneGraphObject org.j3d.aviatrix3d.NodeComponent org.j3d.aviatrix3d.Texture org.j3d.aviatrix3d.MRTTexture2D org.j3d.aviatrix3d.MRTOffscreenTexture2D
public class MRTOffscreenTexture2D
Describes the texture that is rendered to an offscreen buffer with the ability to have multiple render targets.
Due to the requirements for OpenGL 2.0, this will only work with frame buffer objects and not Pbuffers. Usage:
Since the format information is provided as part of the GLCapabilities instance, normally there is no need for it to be passed into the constructor like the other texture types do. The logic for determing the format is as follows using the depth bit values:
if the alpha is non-zero if blue is non zero format = RGBA else if red is non-zero format = intensity-alpha else format = alpha else if blue is non-zero format = RGB else format = intensityIf this logic does not cover what you wish the texture to be, then there is an overloaded constructor that can take the explicit format definition that you wish to use. Note that if you wish to create a depth texture, this does not cover that case and you need to explicitly set the format to
Texture.FORMAT_DEPTH_COMPONENT
.
Since an offscreen rendering process has a completely different set of viewing parameters to the main scene, we have to include almost everything here as well. A complete viewing environment must be set up to deal with the texture rendering.
Note:
The current implementation does not work if you use this when using the null
sort stage. A further limitation is that if this is used as part of a
background (eg ShapeBackground
) it will not be rendered correctly.
TODO:
If the scene is set but without root geometry, then the root geometry added
later, then the update handler is not correctly dealt with. It never gets
set. To overcome this, make sure you set a root group node before setting the
scene, even if it is just a proxy value.
Internationalisation Resource Names
Field Summary |
---|
Fields inherited from class org.j3d.aviatrix3d.MRTTexture2D |
---|
bufferData, height |
Fields inherited from class org.j3d.aviatrix3d.NodeComponent |
---|
lastParent, liveCount, parentList |
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject |
---|
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler |
Fields inherited from interface org.j3d.aviatrix3d.rendering.OffscreenBufferRenderable |
---|
FORMAT_ALPHA, FORMAT_DEPTH_COMPONENT, FORMAT_INTENSITY, FORMAT_LUMINANCE, FORMAT_LUMINANCE_ALPHA, FORMAT_RGB, FORMAT_RGBA |
Constructor Summary | |
---|---|
MRTOffscreenTexture2D(javax.media.opengl.GLCapabilities caps,
boolean unclampColorRange,
int width,
int height,
int numTargets)
Constructs an offscreen texture that fits the given setup. |
|
MRTOffscreenTexture2D(javax.media.opengl.GLCapabilities caps,
boolean unclampColorRange,
int width,
int height,
int numTargets,
boolean separateDepthTexture)
Constructs an offscreen texture that fits the given setup. |
|
MRTOffscreenTexture2D(javax.media.opengl.GLCapabilities caps,
boolean unclampColorRange,
int width,
int height,
int fmt,
int numTargets,
boolean separateDepthTexture)
Constructs an offscreen texture that fits the given setup and provides a specific format that overrides the automatic determination. |
|
MRTOffscreenTexture2D(javax.media.opengl.GLCapabilities caps,
int width,
int height,
int numTargets)
Constructs an offscreen texture that fits the given setup. |
|
MRTOffscreenTexture2D(javax.media.opengl.GLCapabilities caps,
int width,
int height,
int numTargets,
boolean separateDepthTexture)
Constructs an offscreen texture that fits the given setup. |
|
MRTOffscreenTexture2D(javax.media.opengl.GLCapabilities caps,
int width,
int height,
int format,
int numTargets)
Constructs an offscreen texture that fits the given setup and provides a specific format that overrides the automatic determination. |
Method Summary | |
---|---|
protected void |
checkForCyclicChild(SceneGraphObject parent)
Check to see if this node is the same reference as the passed node that is a parent of this node. |
int |
compareTo(Texture tex)
Compares this object with the specified object for order. |
boolean |
equals(Texture tex)
Compares this object with the specified object to check for equivalence. |
void |
getClearColor(float[] col)
Set the background colour that this surface should be cleared to before the drawing step. |
LayerCullable |
getCullableLayer(int layerIndex)
Get the cullable layer child that for the given layer index. |
OffscreenRenderTargetRenderable |
getDepthRenderable()
If a separate depth render target has been requested, return the renderable for that object now. |
MRTTexture2D |
getDepthRenderTarget()
If the texture was configured with a separate offscreen depth texture from the colour texture, get that texture representation. |
int |
getFormat(int level)
Get the format for this texture. |
javax.media.opengl.GLCapabilities |
getGLSetup()
Deprecated. Use MRTTexture2D.getBufferSetup() Always returns null |
void |
getLayers(Layer[] layers)
Fetch the current layers that are set. |
int |
getNumRenderTargets()
Get the number of render targets that this offscreen renderable manages. |
OffscreenBufferRenderable |
getOffscreenRenderable()
Fetch the renderable that this offscreen cullable will draw to. |
MRTTexture2D |
getRenderTarget(int index)
Get the numbered render target. |
OffscreenRenderTargetRenderable |
getRenderTargetRenderable(int index)
Get the child render target at the given index. |
boolean |
hasBufferResized()
Check to see if this buffer has resized since the last time it was used. |
boolean |
hasSeparateDepthRenderable()
Check to see if the depth buffer has its own separate renderable object. |
boolean |
isChildRenderTarget()
Check to see if this is a child render target of a parent multiple render target offscreen buffer. |
boolean |
isRepaintRequired()
Get the current state of the repainting enabled flag. |
int |
numCullableChildren()
Returns the number of valid cullable children to process. |
int |
numLayers()
Get the number of layers that are currently set. |
void |
resize(int w,
int h)
Resize this buffer to a new window. |
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 |
setLayers(Layer[] layers,
int numLayers)
Set the collection of geometry that should be rendered to this texture. |
protected void |
setLive(boolean state)
Notification that this object is live now. |
void |
setRepaintRequired(boolean enable)
Set this texture as requiring a repaint for the next frame. |
protected void |
setUpdateHandler(NodeUpdateHandler handler)
Set the scenegraph update handler for this node. |
Methods inherited from class org.j3d.aviatrix3d.MRTTexture2D |
---|
getBoundaryModeT, getBuffer, getBufferSetup, getHeight, getRenderTargetIndex, postRender, registerBuffer, render, setBoundaryModeT, setSources, unregisterBuffer |
Methods inherited from class org.j3d.aviatrix3d.NodeComponent |
---|
addParent, getParents, numParents, removeParent |
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject |
---|
checkForCyclicParent, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setUserData |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.j3d.aviatrix3d.rendering.OffscreenBufferRenderable |
---|
getFormat |
Methods inherited from interface org.j3d.aviatrix3d.rendering.OffscreenRenderTargetRenderable |
---|
getBuffer, getBufferSetup, getHeight, getWidth, registerBuffer, unregisterBuffer |
Methods inherited from interface org.j3d.aviatrix3d.rendering.Renderable |
---|
equals |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Constructor Detail |
---|
public MRTOffscreenTexture2D(javax.media.opengl.GLCapabilities caps, int width, int height, int numTargets)
caps
- The capabilities needed to generate the Pbuffer withwidth
- The width of the texture in pixelsheight
- The height of the texture in pixels
java.lang.IllegalArgumentException
- The capabilities parameter is null
or the number of targets is less than onepublic MRTOffscreenTexture2D(javax.media.opengl.GLCapabilities caps, int width, int height, int numTargets, boolean separateDepthTexture)
caps
- The capabilities needed to generate the Pbuffer withwidth
- The width of the texture in pixelsheight
- The height of the texture in pixelsseparateDepthTexture
- True is a separate depth texture render
target should be created
java.lang.IllegalArgumentException
- The capabilities parameter is null
or the number of targets is less than onepublic MRTOffscreenTexture2D(javax.media.opengl.GLCapabilities caps, boolean unclampColorRange, int width, int height, int numTargets)
caps
- The capabilities needed to generate the Pbuffer withunclampColorRange
- true to make use of vendor-specific
extensions for floating point colour bufferswidth
- The width of the texture in pixelsheight
- The height of the texture in pixels
java.lang.IllegalArgumentException
- The capabilities parameter is null
or the number of targets is less than onepublic MRTOffscreenTexture2D(javax.media.opengl.GLCapabilities caps, boolean unclampColorRange, int width, int height, int numTargets, boolean separateDepthTexture)
caps
- The capabilities needed to generate the Pbuffer withunclampColorRange
- true to make use of vendor-specific
extensions for floating point colour bufferswidth
- The width of the texture in pixelsheight
- The height of the texture in pixelsseparateDepthTexture
- True is a separate depth texture render
target should be created
java.lang.IllegalArgumentException
- The capabilities parameter is null
or the number of targets is less than onepublic MRTOffscreenTexture2D(javax.media.opengl.GLCapabilities caps, int width, int height, int format, int numTargets)
caps
- The capabilities needed to generate the Pbuffer withwidth
- The width of the texture in pixelsheight
- The height of the texture in pixelsformat
- The format to associate with this texture
java.lang.IllegalArgumentException
- The capabilities parameter is null
or the number of targets is less than onepublic MRTOffscreenTexture2D(javax.media.opengl.GLCapabilities caps, boolean unclampColorRange, int width, int height, int fmt, int numTargets, boolean separateDepthTexture)
caps
- The capabilities needed to generate the Pbuffer withunclampColorRange
- true to make use of vendor-specific
extensions for floating point colour bufferswidth
- The width of the texture in pixelsheight
- The height of the texture in pixelsfmt
- The format to associate with this textureseparateDepthTexture
- True is a separate depth texture render
target should be created
java.lang.IllegalArgumentException
- The capabilities parameter is null
or the number of targets is less than oneMethod Detail |
---|
public boolean isRepaintRequired()
isRepaintRequired
in interface OffscreenCullable
public LayerCullable getCullableLayer(int layerIndex)
getCullableLayer
in interface OffscreenCullable
public int numCullableChildren()
numCullableChildren
in interface OffscreenCullable
public OffscreenBufferRenderable getOffscreenRenderable()
getOffscreenRenderable
in interface OffscreenCullable
public void getClearColor(float[] col)
getClearColor
in interface OffscreenBufferRenderable
col
- An array of at least length 4 to copy values intopublic javax.media.opengl.GLCapabilities getGLSetup()
MRTTexture2D.getBufferSetup()
Always returns null
getGLSetup
in interface OffscreenBufferRenderable
public int getFormat(int level)
level
- The mipmap level to get the format for
public int getNumRenderTargets()
getNumRenderTargets
in interface OffscreenBufferRenderable
public OffscreenRenderTargetRenderable getRenderTargetRenderable(int index)
getRenderTargetRenderable
in interface OffscreenBufferRenderable
index
- The index of the target to fetch
public boolean hasSeparateDepthRenderable()
hasSeparateDepthRenderable
in interface OffscreenBufferRenderable
public OffscreenRenderTargetRenderable getDepthRenderable()
getDepthRenderable
in interface OffscreenBufferRenderable
public boolean hasBufferResized()
hasBufferResized
in interface OffscreenBufferRenderable
public boolean isChildRenderTarget()
isChildRenderTarget
in interface OffscreenRenderTargetRenderable
isChildRenderTarget
in class MRTTexture2D
public int compareTo(Texture tex)
compareTo
in class MRTTexture2D
tex
- The texture instance to be compared
public boolean equals(Texture tex)
equals
in class MRTTexture2D
tex
- The texture instance to be compared
protected void checkForCyclicChild(SceneGraphObject parent) throws InvalidWriteTimingException, CyclicSceneGraphStructureException
checkForCyclicChild
in class SceneGraphObject
parent
- The reference to check against this class
CyclicSceneGraphStructureException
- Equal parent and child
InvalidWriteTimingException
protected void setLive(boolean state)
setLive
in class Texture
state
- true if this should be marked as live nowprotected void setUpdateHandler(NodeUpdateHandler handler)
setUpdateHandler
in class Texture
handler
- The instance to use as a handlerpublic MRTTexture2D getRenderTarget(int index)
index
- The render target number to get the texture representation
for
java.lang.IllegalArgumentException
- The index is out of rangepublic MRTTexture2D getDepthRenderTarget()
public void resize(int w, int h)
w
- The new width of the buffer in pixels. Must be positive.h
- The new height of the buffer in pixels. Must be positive.
java.lang.IllegalArgumentException
- if the width or height <= 0
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic void setLayers(Layer[] layers, int numLayers) throws InvalidWriteTimingException, CyclicSceneGraphStructureException
layers
- The collection of layers, in order, to rendernumLayers
- The number of valid layers to use
CyclicSceneGraphStructureException
- Equal parent and child
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic int numLayers()
public void getLayers(Layer[] layers) throws java.lang.IllegalArgumentException
numLayers()
in length. If not, this method does nothing (the
provided array will be unchanged).
layers
- An array to copy the values into
java.lang.IllegalArgumentException
- The array provided is too small or nullpublic void setRepaintRequired(boolean enable)
enable
- true to have this repaint the next framepublic void setClearColor(float r, float g, float b, float a) throws InvalidWriteTimingException
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 colour
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback method
|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |