Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class MultipassTextureComponent

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.NodeComponent
          extended by org.j3d.aviatrix3d.MultipassTextureComponent
All Implemented Interfaces:
MultipassTextureSource, OffscreenTextureSource, TextureSource

Deprecated. Use OffscreenTexture2D or MRTOffscreenTexture2D

public class MultipassTextureComponent
extends NodeComponent
implements MultipassTextureSource

A source for texture information that is dynamically generated as required per frame.

Note: This class does nothing in Aviatrix3D 1.0

The texture width and height are dynamically found each time it is requested. If no scene is set, or the scene does not have a ViewEnvironment with a valid viewport set, then the width and height will both return zero.

Version:
$Revision: 1.10 $
Author:
Justin Couch

Field Summary
protected  float[] clearColor
          Deprecated. The current clear colour
protected  int format
          Deprecated. The format
protected  int[] formats
          Deprecated. The listing of formats defined for each level
protected  int glBuffers
          Deprecated. The collection of GL buffer IDs needed by the rendering
protected  int numLevels
          Deprecated. The number of levels in this component.
protected  MultipassRenderObserver observer
          Deprecated. The observer instance to use for update callbacks
protected  ViewportLayer viewLayer
          Deprecated. The Scene Graph viewLayer
 
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.MultipassTextureSource
ACCUMULATION_BUFFER, COLOR_BUFFER, DEPTH_BUFFER, STENCIL_BUFFER
 
Fields inherited from interface org.j3d.aviatrix3d.TextureSource
FORMAT_BGR, FORMAT_BGRA, FORMAT_INTENSITY_ALPHA, FORMAT_LUMINANCE_ALPHA, FORMAT_RGB, FORMAT_RGBA, FORMAT_SINGLE_COMPONENT
 
Constructor Summary
MultipassTextureComponent(int width, int height)
          Deprecated. Construct a multipass texture with the buffer set to the colour buffer only and of the specified dimensions.
 
Method Summary
protected  void checkForCyclicChild(SceneGraphObject parent)
          Deprecated. Check to see if this node is the same reference as the passed node that is a parent of this node.
 void getClearColor(float[] col)
          Deprecated. Set the background colour that this surface should be cleared to before the drawing step.
 int getFormat(int level)
          Deprecated. Get the format of this image at the given mipmap level.
 int getHeight()
          Deprecated. Get the height of the texture in pixels.
 int getNumLevels()
          Deprecated. Get the number of levels for the mipmapping in this source.
 MultipassRenderObserver getRenderObserver()
          Deprecated. Fetch the observer instance that may be associated with the texture source.
 int getUsedBuffers()
          Deprecated. Get the list of buffers that are required to be rendered by this source.
 ViewportLayer getViewportLayer()
          Deprecated. Get the root of the currently rendered scene.
 int getWidth()
          Deprecated. Get the width of this image.
 boolean isRepaintRequired()
          Deprecated. Get the current state of the repainting enabled flag.
 void setClearColor(float r, float g, float b, float a)
          Deprecated. Set the background colour that this surface should be cleared to before the drawing step.
protected  void setLive(boolean state)
          Deprecated. Notification that this object is live now.
 void setNumLevels(int numLevels)
          Deprecated. Set the number of levels of mipmap generation that should be rendered.
 void setRenderObserver(MultipassRenderObserver obs)
          Deprecated. Set the observer instance to be associated with the texture source.
 void setRepaintRequired(boolean enable)
          Deprecated. Set this texture as requiring a repaint for the next frame.
protected  void setUpdateHandler(NodeUpdateHandler handler)
          Deprecated. Set the scenegraph update handler for this node.
 void setUsedBuffers(int buffers)
          Deprecated. Set the list of buffers that this source needs to write to.
 void setViewportLayer(ViewportLayer layer)
          Deprecated. Set the collection of geometry that should be rendered to this texture.
 
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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

format

protected int format
Deprecated. 
The format


viewLayer

protected ViewportLayer viewLayer
Deprecated. 
The Scene Graph viewLayer


clearColor

protected float[] clearColor
Deprecated. 
The current clear colour


numLevels

protected int numLevels
Deprecated. 
The number of levels in this component.


formats

protected int[] formats
Deprecated. 
The listing of formats defined for each level


observer

protected MultipassRenderObserver observer
Deprecated. 
The observer instance to use for update callbacks


glBuffers

protected int glBuffers
Deprecated. 
The collection of GL buffer IDs needed by the rendering

Constructor Detail

MultipassTextureComponent

public MultipassTextureComponent(int width,
                                 int height)
Deprecated. 
Construct a multipass texture with the buffer set to the colour buffer only and of the specified dimensions. Both the width and height must be a power of two.

Parameters:
width - The width of the texture to create
height - The height of the texture to create
Throws:
java.lang.IllegalArgumentException - Either the width or height are not powers of two
Method Detail

getRenderObserver

public MultipassRenderObserver getRenderObserver()
Deprecated. 
Fetch the observer instance that may be associated with the texture source. If no instance is associated, this will return null.

Specified by:
getRenderObserver in interface MultipassTextureSource
Returns:
The current observer instance, or null if none

getUsedBuffers

public int getUsedBuffers()
Deprecated. 
Get the list of buffers that are required to be rendered by this source. This will be used by the glClear() call to clear the appropriate buffers. These are the buffers that are to be cleared and used at the start of the multipass rendering. If the application needs to clear buffers during individual passes, that should be performed as part of the MultipassRenderObserver callbacks.

Specified by:
getUsedBuffers in interface MultipassTextureSource
Returns:
A bitwise OR mask of the required buffers

setNumLevels

public void setNumLevels(int numLevels)
                  throws InvalidWriteTimingException,
                         java.lang.IllegalArgumentException
Deprecated. 
Set the number of levels of mipmap generation that should be rendered. Each level will become a separate rendering pass that will be updated. A check is performed to make sure that the number of levels does not produce a situation where the width or height goes negative in thier values - eg a starting size of 32 pixels square and requesting 6 levels of mipmaps being generated.

Specified by:
setNumLevels in interface MultipassTextureSource
Parameters:
numLevels - The number of levels to render
Throws:
java.lang.IllegalArgumentException - The number of levels is more than what the current size could reduce to
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

getViewportLayer

public ViewportLayer getViewportLayer()
Deprecated. 
Get the root of the currently rendered scene. If none is set, this will return null.

Specified by:
getViewportLayer in interface MultipassTextureSource
Returns:
The current scene root or null.

getHeight

public int getHeight()
Deprecated. 
Get the height of the texture in pixels. If no image is set, this returns -1.

Specified by:
getHeight in interface OffscreenTextureSource
Returns:
a number >= -1

isRepaintRequired

public boolean isRepaintRequired()
Deprecated. 
Get the current state of the repainting enabled flag.

Specified by:
isRepaintRequired in interface OffscreenTextureSource
Returns:
true when the texture requires re-drawing

getClearColor

public void getClearColor(float[] col)
Deprecated. 
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.

Specified by:
getClearColor in interface OffscreenTextureSource
Parameters:
col - An array of at least length 4 to copy values into

getWidth

public int getWidth()
Deprecated. 
Get the width of this image.

Specified by:
getWidth in interface TextureSource
Returns:
the width.

getNumLevels

public int getNumLevels()
Deprecated. 
Get the number of levels for the mipmapping in this source.

Specified by:
getNumLevels in interface TextureSource
Returns:
The number of levels.

getFormat

public int getFormat(int level)
Deprecated. 
Get the format of this image at the given mipmap level.

Specified by:
getFormat in interface TextureSource
Parameters:
level - The mipmap level to get the format for
Returns:
the format.

checkForCyclicChild

protected void checkForCyclicChild(SceneGraphObject parent)
                            throws CyclicSceneGraphStructureException
Deprecated. 
Check to see if this node is the same reference as the passed node that is a parent of this node. This is the downwards check to ensure that there is no cyclic scene graph structures at the point where someone adds a node to the scenegraph. When the reference and this are the same, an exception is generated. Since each class may have different lists of child node setups, this should be overriden by any class that can take children, and have the call passed along to the children.

Overrides:
checkForCyclicChild in class SceneGraphObject
Parameters:
parent - The reference to check against this class
Throws:
CyclicSceneGraphStructureException - Equal parent and child

setLive

protected void setLive(boolean state)
Deprecated. 
Notification that this object is live now. Overridden to make sure that the live state of the nodes represents the same state as the parent scene graph.

Overrides:
setLive in class SceneGraphObject
Parameters:
state - true if this should be marked as live now

setUpdateHandler

protected void setUpdateHandler(NodeUpdateHandler handler)
Deprecated. 
Set the scenegraph update handler for this node. It will notify all its children of the value. A null value will clear the current handler.

Overrides:
setUpdateHandler in class SceneGraphObject
Parameters:
handler - The instance to use as a handler

setViewportLayer

public void setViewportLayer(ViewportLayer layer)
                      throws InvalidWriteTimingException,
                             CyclicSceneGraphStructureException
Deprecated. 
Set the collection of geometry that should be rendered to this texture. The geometry is, in effect, a completely separate rendarable space, with it's own culling and sorting pass. In addition, a check is made to make sure that no cyclic scene graph structures are created, as this can create really major headachesfor nested surface rendering. A null value will clear the current geometry and result in only rendering the background, if set. if not set, then whatever the default colour is, is used (typically black).

Parameters:
layer - The new scene instance to use or null
Throws:
CyclicSceneGraphStructureException - Equal parent and child
InvalidWriteTimingException - An attempt was made to write outside of the data changed callback method

setRenderObserver

public void setRenderObserver(MultipassRenderObserver obs)
                       throws InvalidWriteTimingException
Deprecated. 
Set the observer instance to be associated with the texture source. To clear the current instance, use a value of null

Parameters:
obs - The new observer instance to use, or null if none
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the data changed callback method

setRepaintRequired

public void setRepaintRequired(boolean enable)
                        throws InvalidWriteTimingException
Deprecated. 
Set this texture as requiring a repaint for the next frame. If no repaint is required, reset this to null at the point where no repainting is required. The internal flag is a user-defined state, so For the first frame at least, this should be set to true so that the initial paint can be performed (assuming data is present, of course).

Parameters:
enable - true to have this repaint the next frame
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the ApplicationUpdateObserver callback method

setClearColor

public void setClearColor(float r,
                          float g,
                          float b,
                          float a)
                   throws InvalidWriteTimingException
Deprecated. 
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
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

setUsedBuffers

public void setUsedBuffers(int buffers)
                    throws InvalidWriteTimingException
Deprecated. 
Set the list of buffers that this source needs to write to.

Parameters:
buffers - The list of buffers bitwise OR together
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

Aviatrix3D
2.1.0

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