Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class TextureCubicEnvironmentMap

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.NodeComponent
          extended by org.j3d.aviatrix3d.Texture
              extended by org.j3d.aviatrix3d.TextureCubicEnvironmentMap
All Implemented Interfaces:
java.lang.Comparable, MultipassTextureDestination, DeletableRenderable, ObjectRenderable, Renderable, TransparentObjectRenderable, TransparentRenderable

public class TextureCubicEnvironmentMap
extends Texture
implements MultipassTextureDestination

A specialist object that renders a cubic environment map from pre-built sources.

All textures must be square in size. If they are not square, then an error is generated.

This implementation does not handle dynamic cubic environment mapping, nor mipmaps.

Version:
$Revision: 1.28 $
Author:
Justin Couch

Field Summary
protected  int boundaryModeT
          The boundary mode S value
protected  int height
          The height of the main texture.
protected  int mpNumSources
          The current number of mp sources defined
protected  int[][][] mpOffsets
          The offset for the multipass copy update per-mipmap.
protected  int[] mpReadBuffer
          The buffer that multipass source should read from
protected  int[] mpSourceIndices
          The indices of the known MP sources
static int NEGATIVE_X
          The texture belongs to the negative X axis
static int NEGATIVE_Y
          The texture belongs to the negative Y axis
static int NEGATIVE_Z
          The texture belongs to the negative Z axis
static int POSITIVE_X
          The texture belongs to the positive X axis
static int POSITIVE_Y
          The texture belongs to the positive Y axis
static int POSITIVE_Z
          The texture belongs to the positive Z axis
 
Fields inherited from class org.j3d.aviatrix3d.Texture
ANISOTROPIC_MODE_NONE, ANISOTROPIC_MODE_SINGLE, anisotropicDegree, anisotropicMode, BM_CLAMP, BM_CLAMP_TO_BOUNDARY, BM_CLAMP_TO_EDGE, BM_MIRRORED_REPEAT, BM_WRAP, borderColor, boundaryModeS, COMPARE_FUNCTION_GEQUAL, COMPARE_FUNCTION_LEQUAL, COMPARE_MODE_NONE, COMPARE_MODE_R2TEX, compareFunction, compareMode, depthComponentMode, format, FORMAT_ALPHA, FORMAT_DEPTH_COMPONENT, FORMAT_INTENSITY, FORMAT_INTENSITY_ALPHA, FORMAT_LUMINANCE, FORMAT_LUMINANCE_ALPHA, FORMAT_RGB, FORMAT_RGBA, GENERATE_MIPMAP, GENERATE_MIPMAP_DONT_CARE, GENERATE_MIPMAP_FASTEST, GENERATE_MIPMAP_HINT, GENERATE_MIPMAP_NICEST, generateMipMap, generateMipMapHint, imageChanged, magFilter, MAGFILTER_BASE_LEVEL_LINEAR, MAGFILTER_BASE_LEVEL_POINT, MAGFILTER_FASTEST, MAGFILTER_LINEAR_DETAIL, MAGFILTER_LINEAR_DETAIL_ALPHA, MAGFILTER_LINEAR_DETAIL_RGB, MAGFILTER_NICEST, minFilter, MINFILTER_BASE_LEVEL_LINEAR, MINFILTER_BASE_LEVEL_POINT, MINFILTER_FASTEST, MINFILTER_MULTI_LEVEL_LINEAR, MINFILTER_MULTI_LEVEL_POINT, MINFILTER_NICEST, mipMapMode, MODE_BASE_LEVEL, MODE_MIPMAP, numSources, priority, sources, stateChanged, textureIdMap, textureType, UPDATE_BUFFER_ALL, UPDATE_BUFFER_LAST, UPDATE_DISCARD_OVERWRITES, updateManagers, updateStrategy, width
 
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
 
Constructor Summary
TextureCubicEnvironmentMap()
          Constructs a texture with default values.
TextureCubicEnvironmentMap(TextureComponent2D[] srcImages)
          Constructs a texture with the given list of sources.
 
Method Summary
 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.
 int getBoundaryModeT()
          Get the current boundary handling for the S parameter.
 void getCopyOffset(int imgNum, int level, int[] offsets)
          Get the current copy offset.
 int getHeight()
          Get the height of the texture in pixels.
 void getMultipassSources(MultipassTextureSource[] sources, int[] images)
          Fetch all of the currently specified multipass texture sources in this instance of the class.
 int getReadBuffer(int imgNum)
          Get the current read buffer that is being used.
 int numMultipassSources()
          Check to see how many multipass texture sources are actually set for.
 void postRender(javax.media.opengl.GL gl)
          Restore all openGL state to the given drawable
 void render(javax.media.opengl.GL gl)
          Issue ogl commands needed for this component
 void setBoundaryModeT(int mode)
          Set the boundary handling for the S parameter.
 void setCopyOffset(int imgNum, int level, int xoffset, int yoffset)
          Set the offsets in this texture to use for update the sub image update values.
 void setReadBuffer(int imgNum, int buffer)
          Set the buffer that this texture should read it's input from during the update callback.
 void setSources(int mipMapMode, int format, TextureSource[] texSources, int num)
          Set a new collection of sources for this texture to use.
 void updateMultipassSource(javax.media.opengl.GL gl, int x, int y, int width, int height, int imgNum, int level)
          The multipass source has completed rendering and the implemented class should now copy the image data across now.
 
Methods inherited from class org.j3d.aviatrix3d.Texture
cleanup, compareTo, equals, getAnisotropicFilterDegree, getAnisotropicFilterMode, getBorderColor, getBoundaryModeS, getCompareFunction, getCompareMode, getDepthFormat, getFormat, getGenerateMipMap, getGenerateMipMapHint, getMagFilter, getMinFilter, getPriority, getTextureType, getUpdateStrategy, getWidth, hasTransparency, setAnisotropicFilterDegree, setAnisotropicFilterMode, setBorderColor, setBoundaryModeS, setCompareFunction, setCompareMode, setDepthFormat, setGenerateMipMap, setGenerateMipMapHint, setLive, setMagFilter, setMinFilter, setPriority, setUpdateHandler, setUpdateStrategy
 
Methods inherited from class org.j3d.aviatrix3d.NodeComponent
addParent, getParents, numParents, removeParent
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, 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
 

Field Detail

POSITIVE_X

public static final int POSITIVE_X
The texture belongs to the positive X axis

See Also:
Constant Field Values

NEGATIVE_X

public static final int NEGATIVE_X
The texture belongs to the negative X axis

See Also:
Constant Field Values

POSITIVE_Y

public static final int POSITIVE_Y
The texture belongs to the positive Y axis

See Also:
Constant Field Values

NEGATIVE_Y

public static final int NEGATIVE_Y
The texture belongs to the negative Y axis

See Also:
Constant Field Values

POSITIVE_Z

public static final int POSITIVE_Z
The texture belongs to the positive Z axis

See Also:
Constant Field Values

NEGATIVE_Z

public static final int NEGATIVE_Z
The texture belongs to the negative Z axis

See Also:
Constant Field Values

height

protected int height
The height of the main texture.


boundaryModeT

protected int boundaryModeT
The boundary mode S value


mpReadBuffer

protected int[] mpReadBuffer
The buffer that multipass source should read from


mpOffsets

protected int[][][] mpOffsets
The offset for the multipass copy update per-mipmap. [imageNum][mipmaplevel][x,y]


mpNumSources

protected int mpNumSources
The current number of mp sources defined


mpSourceIndices

protected int[] mpSourceIndices
The indices of the known MP sources

Constructor Detail

TextureCubicEnvironmentMap

public TextureCubicEnvironmentMap()
Constructs a texture with default values.


TextureCubicEnvironmentMap

public TextureCubicEnvironmentMap(TextureComponent2D[] srcImages)
Constructs a texture with the given list of sources. The provided array must be at least 6 items long, even if some are null. The order taken for the sources must follow the constants defined for the image IDs. MipMaps are not handled in this case.

Method Detail

numMultipassSources

public int numMultipassSources()
Check to see how many multipass texture sources are actually set for. this instance of the destination.

Specified by:
numMultipassSources in interface MultipassTextureDestination
Returns:
The number of defined sources >= 0

getMultipassSources

public void getMultipassSources(MultipassTextureSource[] sources,
                                int[] images)
Fetch all of the currently specified multipass texture sources in this instance of the class. The values are copied into the arrays, along with their corresponding image index and level for mipmapping. The array must be at least as long as numMultipassSources().

Specified by:
getMultipassSources in interface MultipassTextureDestination
Parameters:
sources - An array to copy the current sources into
images - The indices of each of the source images

updateMultipassSource

public void updateMultipassSource(javax.media.opengl.GL gl,
                                  int x,
                                  int y,
                                  int width,
                                  int height,
                                  int imgNum,
                                  int level)
The multipass source has completed rendering and the implemented class should now copy the image data across now.

Specified by:
updateMultipassSource in interface MultipassTextureDestination
Parameters:
gl - The gl context to draw with * @param x The x offset in pixels to start the copy from
y - The y offset in pixels to start the copy from
width - The width in pixels of the texture that was rendered
height - The height in pixels of the texture that was rendered
imgNum - The index of the texture source to copy to
level - The mipmap level that this corresponds to

setReadBuffer

public void setReadBuffer(int imgNum,
                          int buffer)
                   throws InvalidWriteTimingException
Set the buffer that this texture should read it's input from during the update callback. For 2D textures the image number is ignored.

Specified by:
setReadBuffer in interface MultipassTextureDestination
Parameters:
imgNum - The index of the image that this offset applies to
buffer - The identifier of the buffer to read from
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

getReadBuffer

public int getReadBuffer(int imgNum)
Get the current read buffer that is being used. For 2D textures the image number is ignored.

Specified by:
getReadBuffer in interface MultipassTextureDestination
Parameters:
imgNum - The index of the image that this offset applies to
Returns:
One of the buffer indicies.

setCopyOffset

public void setCopyOffset(int imgNum,
                          int level,
                          int xoffset,
                          int yoffset)
                   throws InvalidWriteTimingException
Set the offsets in this texture to use for update the sub image update values. For 2D textures the image number is ignored.

Specified by:
setCopyOffset in interface MultipassTextureDestination
Parameters:
imgNum - The index of the image that this offset applies to
xoffset - The x offset in pixels to start the copy at
yoffset - The y offset in pixels to start the copy at
level - The mipmap level that this corresponds to
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

getCopyOffset

public void getCopyOffset(int imgNum,
                          int level,
                          int[] offsets)
Get the current copy offset. The return values are copied into the user provided array as [xoffset, yoffset].

Specified by:
getCopyOffset in interface MultipassTextureDestination
Parameters:
imgNum - The index of the image that this offset applies to
level - The mipmap level that this corresponds to
offsets - An array to copy the values into

setSources

public void setSources(int mipMapMode,
                       int format,
                       TextureSource[] texSources,
                       int num)
                throws InvalidWriteTimingException
Set a new collection of sources for this texture to use.

Overrides:
setSources in class Texture
Parameters:
mipMapMode - Flag stating the type of texture mode to use
format - Image format to use for grayscale sources
texSources - The source data to use, single for base level
num - The valid number of sources to use from the array
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

render

public void render(javax.media.opengl.GL gl)
Issue ogl commands needed for this component

Specified by:
render in interface ObjectRenderable
Parameters:
gl - The gl context to draw with

postRender

public void postRender(javax.media.opengl.GL gl)
Restore all openGL state to the given drawable

Specified by:
postRender in interface ObjectRenderable
Parameters:
gl - The gl context to draw with

setBoundaryModeT

public void setBoundaryModeT(int mode)
                      throws InvalidWriteTimingException
Set the boundary handling for the S parameter.

Parameters:
mode - The new mode.
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

getBoundaryModeT

public int getBoundaryModeT()
Get the current boundary handling for the S parameter.

Returns:
The current mode.

getHeight

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

Returns:
a number >= -1

compareTo

public int compareTo(Texture tex)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. Derived instances should override this to add texture-specific extensions.

Overrides:
compareTo in class Texture
Parameters:
tex - The texture instance to be compared
Returns:
-1, 0 or 1 depending on order

equals

public boolean equals(Texture tex)
Compares this object with the specified object to check for equivalence.

Overrides:
equals in class Texture
Parameters:
tex - The texture instance to be compared
Returns:
true if the objects represent identical values

Aviatrix3D
2.1.0

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