|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.aviatrix3d.SceneGraphObject org.j3d.aviatrix3d.NodeComponent org.j3d.aviatrix3d.TextureAttributes
public class TextureAttributes
Describes how a texture gets applied to the underlying geometry.
All of these attributes are part of the texture object so we only issue OGL commands when they change. This will update the Texture Object's values for all future uses.
If point sprites are available, this class can be used to enable or
disable their use. Note that to use them completely, you also need to enable
the equivalent state with
PointAttributes.setPointSpriteEnabled(boolean)
When providing texture unit identfiers for the source for the combiner functions, not all the constants are defined. Since OpenGL uses sequential numbering, if you need anything greater than 8, you can specify the value buy making the call with SOURCE_TEXUTRE_0 + n where n is the texture unit ID that you want to use.
The default values for this class are:
Texture Mode: GL.GL_REPLACE RGB Scale: 1 Alpha Scale: 1 RGB CombineMode: COMBINE_MODULATE Alpha CombineMode: COMBINE_MODULATE RGB Source0: SOURCE_CURRENT_TEXTURE RGB Source1: SOURCE_PREVIOUS_UNIT RGB Source2: SOURCE_CONSTANT_COLOR Alpha Source0: SOURCE_CURRENT_TEXTURE Alpha Source1: SOURCE_PREVIOUS_UNIT Alpha Source2: SOURCE_CONSTANT_COLOR RGB Operand0: SRC_COLOR RGB Operand1: SRC_COLOR RGB Operand2: SRC_ALPHA Alpha Operand0: SRC_ALPHA Alpha Operand1: SRC_ALPHA Alpha Operand2: SRC_ALPHAPoint sprites are disabled by default.
Internationalisation Resource Names
Field Summary | |
---|---|
static int |
COMBINE_ADD
Set combine mode for applying textures to objects to GL_ADD |
static int |
COMBINE_ADD_SIGNED
Set combine mode for applying textures to objects to GL_ADD_SIGNED |
static int |
COMBINE_DOT3_RGB
Set combine mode for applying textures to objects to GL_DOT3_RGB |
static int |
COMBINE_DOT3_RGBA
Set combine mode for applying textures to objects to GL_DOT3_RGBA |
static int |
COMBINE_INTERPOLATE
Set combine mode for applying textures to objects to GL_INTERPOLATE |
static int |
COMBINE_MODULATE
Set combine mode for applying textures to objects to GL_MODULATE |
static int |
COMBINE_REPLACE
Set combine mode for applying textures to objects to GL_REPLACE |
static int |
COMBINE_SUBTRACT
Set combine mode for applying textures to objects to GL_SUBTRACT |
static int |
MODE_ADD
Set the mode for applying textures to objects to GL_ADD |
static int |
MODE_BLEND
Set the mode for applying textures to objects to GL_BLEND |
static int |
MODE_COMBINE
Set the mode for applying textures to objects to GL_COMBINE |
static int |
MODE_DECAL
Set the mode for applying textures to objects to GL_DECAL |
static int |
MODE_MODULATE
Set the mode for applying textures to objects to GL_MODULATE |
static int |
MODE_REPLACE
Set the mode for applying textures to objects to GL_REPLACE |
static int |
ONE_MINUS_SRC_ALPHA
Use one minus source alpha for the incoming operation |
static int |
ONE_MINUS_SRC_COLOR
Use one minus source colour for the incoming operation |
static int |
SOURCE_BASE_COLOR
The source is the base colour of the object before texturing has been applied. |
static int |
SOURCE_CONSTANT_COLOR
The source is the provided texture blend colour |
static int |
SOURCE_CURRENT_TEXTURE
The source is the current texture stage |
static int |
SOURCE_PREVIOUS_UNIT
The source is the output of the previous texture unit |
static int |
SOURCE_TEXTURE_0
The source is texture stage 0 |
static int |
SOURCE_TEXTURE_1
The source is texture stage 1 |
static int |
SOURCE_TEXTURE_2
The source is texture stage 2 |
static int |
SOURCE_TEXTURE_3
The source is texture stage 3 |
static int |
SOURCE_TEXTURE_4
The source is texture stage 4 |
static int |
SOURCE_TEXTURE_5
The source is texture stage 5 |
static int |
SOURCE_TEXTURE_6
The source is texture stage 6 |
static int |
SOURCE_TEXTURE_7
The source is texture stage 7 |
static int |
SRC_ALPHA
Use the source alpha for the incoming operation |
static int |
SRC_COLOR
Use the source colour for the incoming operation |
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 | |
---|---|
TextureAttributes()
Constructs a Texture Unit with default values. |
Method Summary | |
---|---|
int |
compareTo(java.lang.Object o)
Compares this object with the specified object for order. |
int |
compareTo(TextureAttributes ta)
Compares this object with the specified object for order. |
boolean |
equals(java.lang.Object o)
Compare this object for equality to the given object. |
boolean |
equals(TextureAttributes ta)
Compares this object with the specified object to check for equivalence. |
void |
getBlendColor(float[] col)
Get the current blend colour. |
int |
getCombineMode(boolean alpha)
Get the combine mode in use. |
int |
getCombineOperand(boolean alpha,
int opIdx)
Get the current value of the combine operand in use. |
float |
getCombineScale(boolean alpha)
Get the combine scale factor. |
int |
getCombineSource(boolean alpha,
int opIdx)
Get the current value of the combine source function in use |
int |
getTextureMode()
Get the current texture mode in use. |
boolean |
isPointSpriteAllowed()
Convenience method to check if this code has detected the prescense of multitexture extensions. |
boolean |
isPointSpriteCoordEnabled()
Get the current state of the whether the point sprites coordinates are enabled. |
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 |
setBlendColor(float r,
float g,
float b,
float a)
Set the blend colour to use for this texture. |
void |
setCombineMode(boolean alpha,
int mode)
Set the combine mode for the alpha or RGB side. |
void |
setCombineOperand(boolean alpha,
int opIdx,
int function)
Set the operand to use for alpha or RGB combine mode. |
void |
setCombineScale(boolean alpha,
float scale)
Set the combine scale factor. |
void |
setCombineSource(boolean alpha,
int opIdx,
int source)
Set the combine source type for alpha or RGB combine mode. |
void |
setPointSpriteCoordEnabled(boolean state)
Set the point sprite coordinate enabled flag. |
void |
setTextureMode(int mode)
Set the texture mode. |
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, setLive, setUpdateHandler, setUserData |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MODE_REPLACE
public static final int MODE_MODULATE
public static final int MODE_BLEND
public static final int MODE_DECAL
public static final int MODE_ADD
public static final int MODE_COMBINE
public static final int COMBINE_REPLACE
public static final int COMBINE_MODULATE
public static final int COMBINE_ADD
public static final int COMBINE_ADD_SIGNED
public static final int COMBINE_INTERPOLATE
public static final int COMBINE_SUBTRACT
public static final int COMBINE_DOT3_RGB
public static final int COMBINE_DOT3_RGBA
public static final int SOURCE_CURRENT_TEXTURE
public static final int SOURCE_TEXTURE_0
public static final int SOURCE_TEXTURE_1
public static final int SOURCE_TEXTURE_2
public static final int SOURCE_TEXTURE_3
public static final int SOURCE_TEXTURE_4
public static final int SOURCE_TEXTURE_5
public static final int SOURCE_TEXTURE_6
public static final int SOURCE_TEXTURE_7
public static final int SOURCE_CONSTANT_COLOR
public static final int SOURCE_BASE_COLOR
public static final int SOURCE_PREVIOUS_UNIT
public static final int SRC_COLOR
public static final int ONE_MINUS_SRC_COLOR
public static final int SRC_ALPHA
public static final int ONE_MINUS_SRC_ALPHA
Constructor Detail |
---|
public TextureAttributes()
Method Detail |
---|
public void render(javax.media.opengl.GL gl)
render
in interface ObjectRenderable
gl
- The gl context to draw withpublic void postRender(javax.media.opengl.GL gl)
postRender
in interface ObjectRenderable
gl
- The gl context to draw withpublic int compareTo(java.lang.Object o) throws java.lang.ClassCastException
compareTo
in interface java.lang.Comparable
o
- The objec to be compared
java.lang.ClassCastException
- The specified object's type prevents it from
being compared to this Objectpublic boolean equals(java.lang.Object o)
equals
in interface Renderable
equals
in class java.lang.Object
o
- The object to be compared
public void setTextureMode(int mode) throws InvalidWriteTimingException
mode
- The new mode
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic int getTextureMode()
public void setBlendColor(float r, float g, float b, float a) throws InvalidWriteTimingException
r
- The red component of the blend colourg
- The green component of the blend colourb
- The blue component of the blend coloura
- The alpha component of the blend colour
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic void getBlendColor(float[] col)
col
- An array to copy the colour in, in RGBA formatpublic void setCombineMode(boolean alpha, int mode) throws InvalidWriteTimingException
alpha
- True if this is setting the combine mode for the alpha
channel. False for the RGB channelsmode
- one of the valid COMBINE_* mode types
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic int getCombineMode(boolean alpha)
alpha
- true when this should fetch the alpha setting, false for
the RGB setting
public void setCombineScale(boolean alpha, float scale) throws InvalidWriteTimingException
alpha
- Scale the alpha channel (true) Or the Rgb channelscale
- The amount to scale the channel by
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic float getCombineScale(boolean alpha)
alpha
- True if to return the the alpha channel, false for RGB
public void setCombineOperand(boolean alpha, int opIdx, int function) throws InvalidWriteTimingException
alpha
- true when this should set the alpha setting, false for
the RGB settingopIdx
- A value of 0, 1 or 2 indicating which operand argument
this should effect
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic int getCombineOperand(boolean alpha, int opIdx)
alpha
- true when this should fetch the alpha setting, false for
the RGB settingopIdx
- A value of 0, 1 or 2 indicating which operand argument
this should fetch
public void setCombineSource(boolean alpha, int opIdx, int source) throws InvalidWriteTimingException
alpha
- true when this should set the alpha setting, false for
the RGB settingopIdx
- A value of 0, 1 or 2 indicating which operand argument
this should effect
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic int getCombineSource(boolean alpha, int opIdx)
alpha
- true when this should fetch the alpha setting, false for
the RGB settingopIdx
- A value of 0, 1 or 2 indicating which operand argument
this should fetch
public void setPointSpriteCoordEnabled(boolean state) throws InvalidWriteTimingException
PointAttributes.setPointSpriteEnabled(boolean)
state
- true if this texture unit should enable point sprite
coordinates. False to disable
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic boolean isPointSpriteCoordEnabled()
public boolean isPointSpriteAllowed()
public int compareTo(TextureAttributes ta)
ta
- The attributes instance to be compared
public boolean equals(TextureAttributes ta)
ta
- The attributes instance to be compared
|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |