Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class AlphaAttributes

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.NodeComponent
          extended by org.j3d.aviatrix3d.AlphaAttributes
All Implemented Interfaces:
java.lang.Comparable, AppearanceAttributeRenderable, ObjectRenderable, Renderable

public class AlphaAttributes
extends NodeComponent
implements AppearanceAttributeRenderable

Describes attributes used for controlling alpha test state during any drawing operations.

Note

Use of this class will automatically cause the containing appearance and shape nodes to be placed in to the transparency sort bucket of the rendering operations rather than state sorted. Use of this class sparingly is suggested as alpha testing/blending is performed by the rendering pipeline separately. The default blending mode is set up to mimic the defaults used by OpenGL. However, this class should only be used when the GL_ARB_imaging subset is available. This code automatically checks for it's existance and will disable calling itself if it detects the lack of existance.

Default Values

When intialised, this class follows the default OpenGL values for alpha testing:

 Alpha Function:    GL_ALWAYS
 Alpha test value:  0.0
 

Internationalisation Resource Names

Version:
$Revision: 2.3 $
Author:
Justin Couch

Field Summary
static int FUNCTION_ALWAYS
          Comparison function that always passes.
static int FUNCTION_EQUAL
          Comparison function that passes if current alpha == test alpha.
static int FUNCTION_GREATER
          Comparison function that passes if current alpha > test alpha.
static int FUNCTION_GREATER_OR_EQUAL
          Comparison function that passes if current alpha >= test alpha.
static int FUNCTION_LESS
          Comparison function that passes if current alpha < test alpha.
static int FUNCTION_LESS_OR_EQUAL
          Comparison function that passes if current alpha <= test alpha.
static int FUNCTION_NEVER
          Comparison function that always fails.
static int FUNCTION_NOTEQUAL
          Comparison function that passes if current alpha is not equal range.
 
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
 
Fields inherited from interface org.j3d.aviatrix3d.rendering.AppearanceAttributeRenderable
ALPHA_ATTRIBUTE, BLEND_ATTRIBUTE, DEPTH_ATTRIBUTE, LINE_ATTRIBUTE, POINT_ATTRIBUTE, POLYGON_ATTRIBUTE, STENCIL_ATTRIBUTE
 
Constructor Summary
AlphaAttributes()
          Constructs a attribute set with default values as specified above.
 
Method Summary
 int compareTo(AlphaAttributes aa)
          Compares this object with the specified object for order.
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 boolean equals(AlphaAttributes aa)
          Compares this object with the specified object to check for equivalence.
 boolean equals(java.lang.Object o)
          Compare this object for equality to the given object.
 float getAlphaCutoff()
          Get the current cutoff component value.
 int getAlphaFunction()
          Get the current operation used when the alpha tests pass.
 int getAttributeType()
          Get the type this visual attribute represents.
 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 setAlphaCutoff(float value)
          Set the cutoff value for alpha blending.
 void setAlphaFunction(int func)
          Set the determines whether the alpha tests passes.
 
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

FUNCTION_NEVER

public static final int FUNCTION_NEVER
Comparison function that always fails.

See Also:
Constant Field Values

FUNCTION_LESS

public static final int FUNCTION_LESS
Comparison function that passes if current alpha < test alpha.

See Also:
Constant Field Values

FUNCTION_LESS_OR_EQUAL

public static final int FUNCTION_LESS_OR_EQUAL
Comparison function that passes if current alpha <= test alpha.

See Also:
Constant Field Values

FUNCTION_GREATER

public static final int FUNCTION_GREATER
Comparison function that passes if current alpha > test alpha.

See Also:
Constant Field Values

FUNCTION_GREATER_OR_EQUAL

public static final int FUNCTION_GREATER_OR_EQUAL
Comparison function that passes if current alpha >= test alpha.

See Also:
Constant Field Values

FUNCTION_EQUAL

public static final int FUNCTION_EQUAL
Comparison function that passes if current alpha == test alpha.

See Also:
Constant Field Values

FUNCTION_NOTEQUAL

public static final int FUNCTION_NOTEQUAL
Comparison function that passes if current alpha is not equal range.

See Also:
Constant Field Values

FUNCTION_ALWAYS

public static final int FUNCTION_ALWAYS
Comparison function that always passes.

See Also:
Constant Field Values
Constructor Detail

AlphaAttributes

public AlphaAttributes()
Constructs a attribute set with default values as specified above.

Method Detail

getAttributeType

public int getAttributeType()
Get the type this visual attribute represents.

Specified by:
getAttributeType in interface AppearanceAttributeRenderable
Returns:
One of the _ATTRIBUTE constants

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. Does nothing as it assumes the system will disable blending outside of this class.

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

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
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.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - The objec to be compared
Returns:
-1, 0 or 1 depending on order
Throws:
java.lang.ClassCastException - The specified object's type prevents it from being compared to this Object

equals

public boolean equals(java.lang.Object o)
Compare this object for equality to the given object.

Specified by:
equals in interface Renderable
Overrides:
equals in class java.lang.Object
Parameters:
o - The object to be compared
Returns:
True if these represent the same values

setAlphaFunction

public void setAlphaFunction(int func)
                      throws java.lang.IllegalArgumentException,
                             InvalidWriteTimingException
Set the determines whether the alpha tests passes. This should be one of the FUNCTION_ constants at the top of this class.

Parameters:
func - One of the FUNCTION_ constants
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method
java.lang.IllegalArgumentException - The operation value was not one of the valid types.

getAlphaFunction

public int getAlphaFunction()
Get the current operation used when the alpha tests pass.

Returns:
One of the FUNCTION_ constants

setAlphaCutoff

public void setAlphaCutoff(float value)
                    throws java.lang.IllegalArgumentException,
                           InvalidWriteTimingException
Set the cutoff value for alpha blending. The cut off is compared against the current alpha value, so must be in the range [0,1]. The default value is 0.

Parameters:
value - The alpha component cut off value to use
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method
java.lang.IllegalArgumentException - The cutoff value was outside the range [0,1]

getAlphaCutoff

public float getAlphaCutoff()
Get the current cutoff component value. The default value is 0.

Returns:
A value in the range [0,1]

compareTo

public int compareTo(AlphaAttributes aa)
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.

Parameters:
aa - The attributes instance to be compared
Returns:
-1, 0 or 1 depending on order

equals

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

Parameters:
aa - The attributes 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