public class BGFGCanvas3D extends ImageCaptureCanvas3D
Canvas3D
that renders an list of arbitrary 2D
BGFGImage
objects either behind or over top of the 3D scene. This canvas also
provides a callback that allows you to capture the contents of the canvas and write out
the image information.
Modified by: Joseph A.Huwaldt
Constructor and Description |
---|
BGFGCanvas3D(java.awt.GraphicsConfiguration gconfig)
Constructs and initializes a new BGFGCanvas3D object that Java 3D can render into.
|
BGFGCanvas3D(java.awt.GraphicsConfiguration gconfig,
boolean offscreen)
Constructs and initializes a new BGFGCanvas3D object that Java 3D can render into.
|
Modifier and Type | Method and Description |
---|---|
void |
addBackground(BGFGImage background)
Adds the specified background to this canvas.
|
void |
addOverlay(BGFGImage overlay)
Adds the specified overlay to this canvas.
|
void |
clearBackgrounds()
Removes all the backgrounds from this canvas.
|
void |
clearOverlays()
Removes all the overlays from this canvas.
|
BGFGImage |
getBackground(int index)
Return the specified background used by this canvas.
|
int |
getNumberBackgrounds()
Returns the number of background images associated with this canvas.
|
int |
getNumberOverlays()
Returns the number of overlays/foregrounds associated with this canvas.
|
BGFGImage |
getOverlay(int index)
Return the specified overlay used by this canvas.
|
void |
postRender()
This routine is called by the Java 3D rendering loop after completing all rendering
to the canvas for this frame and before the buffer swap.
|
void |
preRender()
This routine is called by the Java 3D rendering loop after clearing the canvas and
before any rendering has been done for this frame.
|
boolean |
removeBackground(BGFGImage background)
Removes the specified background from this canvas.
|
BGFGImage |
removeBackground(int index)
Removes the specified background from this canvas.
|
boolean |
removeOverlay(BGFGImage overlay)
Removes the specified overlay from this canvas.
|
BGFGImage |
removeOverlay(int index)
Removes the specified overlay from this canvas.
|
BGFGImage |
setBackground(int index,
BGFGImage background)
Set the specified background for use for this canvas.
|
BGFGImage |
setOverlay(int index,
BGFGImage overlay)
Set the specified overlay for use for this canvas.
|
addCaptureObserver, postSwap, removeCaptureObserver
public BGFGCanvas3D(java.awt.GraphicsConfiguration gconfig)
gconfig
- A valid GraphicsConfiguration object that will be used to create the
canvas. May not be null.java.lang.IllegalArgumentException
- if the specified GraphicsConfiguration does not
support 3D renderingpublic BGFGCanvas3D(java.awt.GraphicsConfiguration gconfig, boolean offscreen)
gconfig
- A valid GraphicsConfiguration object that will be used to create
the canvas. May not be null.offscreen
- A flag that indicates whether this canvas is an off-screen 3D
rendering canvas. Note that if offScreen is set to true, this
Canvas3D object cannot be used for normal rendering; it should not
be added to any Container object.java.lang.IllegalArgumentException
- if the specified GraphicsConfiguration does not
support 3D renderingpublic int getNumberBackgrounds()
public BGFGImage getBackground(int index)
index
- The index of the background image to retrieve.public BGFGImage setBackground(int index, BGFGImage background)
index
- The index for the background to set.background
- The background image to set at the specified index. May not be
null.public void addBackground(BGFGImage background)
background
- The background to add to this canvas. May not be null.public BGFGImage removeBackground(int index)
index
- The index for the background to remove.public boolean removeBackground(BGFGImage background)
background
- The background to remove from this canvas. May not be null.public void clearBackgrounds()
public int getNumberOverlays()
public BGFGImage getOverlay(int index)
index
- The index of the overlay (foreground) to return.public BGFGImage setOverlay(int index, BGFGImage overlay)
index
- The index for the overlay to set.overlay
- The overlay to set at the specified index location. May not be null.public void addOverlay(BGFGImage overlay)
overlay
- The overlay to add. May not be null.public BGFGImage removeOverlay(int index)
index
- The index for the overlay to remove.public boolean removeOverlay(BGFGImage overlay)
overlay
- The overlay image to remove from this canvas. May not be null.public void clearOverlays()
public void preRender()
public void postRender()