org.j3d.geom.overlay
Class SubOverlay

class SubOverlay
A SubOverlay is one of the pieces which displays a portion of the overlay. This is used internally by Overlay and should not be referenced directly.
Version:
$Revision: 1.5 $
Author:
David Yazel
Field Detail

NEXT_BUFFER

static final int NEXT_BUFFER
Represents that a buffer being activated or updated sould be the next avaiable one.

buffer

private java.awt.image.BufferedImage[] buffer
The list of images being used as the buffers

bufferHolder

private javax.media.j3d.ImageComponent2D[] bufferHolder
The component version of the buffer images used by Java3D

numBuffers

private int numBuffers
The number of buffers we are using

activeBufferIndex

private int activeBufferIndex
The index of the currently active buffer

texture

private javax.media.j3d.Texture2D texture
texture mapped to one double buffer

shape

private javax.media.j3d.Shape3D shape
Textured quad used to hold geometry

space

private java.awt.Rectangle space
The part of the overlay covered by this suboverlay

transferBuffer

private int[] transferBuffer
Used for transferring scan lines from main image to sub-image

Constructor Detail

SubOverlay

SubOverlay(java.awt.Rectangle space)
Creates a double buffered suboverlay for the specified region that has no transparency.
Parameters:
space - The area in screen space coords to create this for

SubOverlay

SubOverlay(java.awt.Rectangle space,
           javax.media.j3d.Material material)
Creates a double buffered suboverlay for the specified region that has no transparency.
Parameters:
space - The area in screen space coords to create this for
material - The common material for all to use

SubOverlay

SubOverlay(java.awt.Rectangle space,
           int numBuffers)
Creates a suboverlay for the specified region that has a given number of buffers and no transparency.
Parameters:
space - The area in screen space coords to create this for
numBuffers - The number of buffers to create

SubOverlay

SubOverlay(java.awt.Rectangle space,
           int numBuffers,
           javax.media.j3d.Material material)
Creates a suboverlay for the specified region that has a given number of buffers and no transparency.
Parameters:
space - The area in screen space coords to create this for
numBuffers - The number of buffers to create
material - The common material for all to use

SubOverlay

SubOverlay(java.awt.Rectangle space,
           boolean hasAlpha)
Creates a double buffered suboverlay for the specified region with the option to set the transparency.
Parameters:
space - The area in screen space coords to create this for
hasAlpha - true If the overlay should include an alpha component

SubOverlay

SubOverlay(java.awt.Rectangle space,
           boolean hasAlpha,
           javax.media.j3d.Material material)
Creates a double buffered suboverlay for the specified region with the option to set the transparency.
Parameters:
space - The area in screen space coords to create this for
hasAlpha - true If the overlay should include an alpha component
material - The common material for all to use

SubOverlay

SubOverlay(java.awt.Rectangle space,
           int numBuffers,
           boolean hasAlpha)
Creates a buffered suboverlay for the specified region with the option to set the transparency and number of buffers.
Parameters:
space - The area in screen space coords to create this for
numBuffers - The number of buffers to create
hasAlpha - true If the overlay should include an alpha component
material - The common material for all to use

SubOverlay

SubOverlay(java.awt.Rectangle space,
           int numBuffers,
           boolean hasAlpha,
           javax.media.j3d.Material material)
Creates a buffered suboverlay for the specified region with the option to set the transparency and number of buffers.
Parameters:
space - The area in screen space coords to create this for
numBuffers - The number of buffers to create
hasAlpha - true If the overlay should include an alpha component
material - The common material for all to use

SubOverlay

SubOverlay(java.awt.Rectangle space,
           int numBuffers,
           boolean hasAlpha,
           javax.media.j3d.PolygonAttributes polyAttr,
           javax.media.j3d.RenderingAttributes renderAttr,
           javax.media.j3d.TextureAttributes texAttr,
           javax.media.j3d.TransparencyAttributes transAttr,
           javax.media.j3d.Material material)
Creates the suboverlay with customisable attribute information. If any parameter is null, defaults are used.
Parameters:
space - The area in screen space coords to create this for
numBuffers - The number of buffers to create
hasAlpha - true If the overlay should include an alpha component
polyAttr - PolygonAttributes from the parent overlay
renderAttr - RenderingAttributes from the parent overlay
texAttr - TextureAttributes from the parent overlay
transAttr - TransparencyAttributes from the parent overlay
material - The common material for all to use

Method Detail

updateBuffer

void updateBuffer(java.awt.image.BufferedImage fullOverlayImage,
                  int bufferIndex)
Draws the portion of fullOverlayImage corresponding to space into the buffer at bufferIndex.
Parameters:
fullOverlayImage - The full image that we take a section from
bufferIndex - The index of the buffer to use to do the update

getNextBufferIndex

int getNextBufferIndex()
Returns the index of the next buffer in line to be painted

setActiveBufferIndex

void setActiveBufferIndex(int newIndex)
This will change the buffer being displayed. It does not write anything, only switched the image so it must be used carefully. It is intended for use where more than one buffer has been prepped ahead of time. If you do this without having the buffers preprepped then you will get strange things.

getShape

javax.media.j3d.Shape3D getShape()
Return the underlying shape that this partial overlay is drawn on.
Returns:
The shape representing this texture

buildShape

private javax.media.j3d.Shape3D buildShape(javax.media.j3d.Appearance appearance,
                                           java.awt.Rectangle space)
Builds a Shape3D with the specified appearance covering the specified rectangle. The shape is created as a rectangle in the X,Y plane.
Parameters:
appearance - The appearance to use for the shape
texture - The texture used for the buffer
space - The coordinates of the shape to create
Returns:
A shape3D object representing the given information