j3d.org Aviatrix3D

org.j3d.aviatrix3d
Class TextureComponent

java.lang.Object
  extended byorg.j3d.aviatrix3d.SceneGraphObject
      extended byorg.j3d.aviatrix3d.NodeComponent
          extended byorg.j3d.aviatrix3d.TextureComponent
Direct Known Subclasses:
TextureComponent1D, TextureComponent2D, TextureComponent3D

public abstract class TextureComponent
extends NodeComponent

A component that contains image data to be used in textures.

Version:
$Revision: 1.3 $
Author:
Justin Couch, Alan Hudson

Field Summary
protected  java.nio.ByteBuffer[] data
          Buffer to hold the data
protected  int format
          The format
static int FORMAT_BGR
          Specifies the image is in Windows BGR format
static int FORMAT_BGRA
          Specifies the image is in Windows BGRA format
static int FORMAT_INTENSITY_ALPHA
          Specifies the image is in 2-component Intensity-Alpha format
static int FORMAT_RGB
          Specifies the image is in RGB format
static int FORMAT_RGBA
          Specifies the image is in RGBA format
static int FORMAT_SINGLE_COMPONENT
          Specifies the image is in 1-component Intensity or Alpha format
protected  boolean invertY
          Flag describing whether the Y axis should be inverted before use.
protected  int numLevels
          The number of levels in this component.
protected  int size
          The size of the data buffer
protected  int type
          The type of the data
static int TYPE_BYTE
          Specifies the data is in byte format
static int TYPE_INT
          Specifies the data is in int format
protected  int width
          The width
 
Fields inherited from class org.j3d.aviatrix3d.NodeComponent
liveCount
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, updateHandler, WRITE_TIMING_MSG
 
Constructor Summary
TextureComponent(int numLevels)
          Constructs an image with default values.
 
Method Summary
protected  void clearData(int level)
          Clear the storage used for this object.
protected abstract  java.nio.ByteBuffer convertImage(int level)
          Convenience method to convert a buffered image into a NIO array of the corresponding type.
protected  java.nio.ByteBuffer getData(int level)
          Get the underlying data object.
 int getFormat(int level)
          Get the format of this image.
 int getNumLevels()
          Get the number of levels in this component.
 int getWidth()
          Get the width of this image.
 boolean isYUp()
          Get the current value of the Y-axis inversion flag.
 
Methods inherited from class org.j3d.aviatrix3d.NodeComponent
addParent, getParents, hasChanged, numParents, removeParent, renderState, restoreState
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, checkForCyclicParent, dataChanged, getUserData, isLive, setLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORMAT_RGB

public static final int FORMAT_RGB
Specifies the image is in RGB format

See Also:
Constant Field Values

FORMAT_RGBA

public static final int FORMAT_RGBA
Specifies the image is in RGBA format

See Also:
Constant Field Values

FORMAT_BGR

public static final int FORMAT_BGR
Specifies the image is in Windows BGR format

See Also:
Constant Field Values

FORMAT_BGRA

public static final int FORMAT_BGRA
Specifies the image is in Windows BGRA format

See Also:
Constant Field Values

FORMAT_INTENSITY_ALPHA

public static final int FORMAT_INTENSITY_ALPHA
Specifies the image is in 2-component Intensity-Alpha format

See Also:
Constant Field Values

FORMAT_SINGLE_COMPONENT

public static final int FORMAT_SINGLE_COMPONENT
Specifies the image is in 1-component Intensity or Alpha format

See Also:
Constant Field Values

TYPE_BYTE

public static final int TYPE_BYTE
Specifies the data is in byte format

See Also:
Constant Field Values

TYPE_INT

public static final int TYPE_INT
Specifies the data is in int format

See Also:
Constant Field Values

width

protected int width
The width


format

protected int format
The format


size

protected int size
The size of the data buffer


type

protected int type
The type of the data


data

protected java.nio.ByteBuffer[] data
Buffer to hold the data


invertY

protected boolean invertY
Flag describing whether the Y axis should be inverted before use. By default, yes


numLevels

protected int numLevels
The number of levels in this component.

Constructor Detail

TextureComponent

public TextureComponent(int numLevels)
Constructs an image with default values.

Parameters:
numLevels - The number of mipmap levels to create
Method Detail

getNumLevels

public int getNumLevels()
Get the number of levels in this component.

Returns:
The number of levels.

getWidth

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

Returns:
the width.

getFormat

public int getFormat(int level)
Get the format of this image.

Returns:
the format.

isYUp

public boolean isYUp()
Get the current value of the Y-axis inversion flag.

Returns:
true if the Y axis should be flipped

getData

protected java.nio.ByteBuffer getData(int level)
Get the underlying data object. This will be an array of the underlying data type.

Parameters:
level - Which image level needs to be converted
Returns:
A reference to the data.

clearData

protected void clearData(int level)
Clear the storage used for this object.

Parameters:
level - Which image level needs to be converted

convertImage

protected abstract java.nio.ByteBuffer convertImage(int level)
Convenience method to convert a buffered image into a NIO array of the corresponding type. Images typically need to be swapped when doing this by the Y axis is in the opposite direction to the one used by OpenGL.

Parameters:
level - Which image level needs to be converted
Returns:
an appropriate array type - either IntBuffer or ByteBuffer

j3d.org Aviatrix3D

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