javax.media.j3d
Class RenderingAttributes

java.lang.Object
  |
  +--javax.media.j3d.SceneGraphObject
        |
        +--javax.media.j3d.NodeComponent
              |
              +--javax.media.j3d.RenderingAttributes

public class RenderingAttributes
extends NodeComponent

The RenderingAttributes object defines all rendering state that can be set as a component object of a Shape3D node.


Field Summary
static int ALLOW_ALPHA_TEST_FUNCTION_READ
          Specifies that this RenderingAttributes object allows reading its alpha test function component information.
static int ALLOW_ALPHA_TEST_FUNCTION_WRITE
          Specifies that this RenderingAttributes object allows writing its alpha test function component information.
static int ALLOW_ALPHA_TEST_VALUE_READ
          Specifies that this RenderingAttributes object allows reading its alpha test value component information.
static int ALLOW_ALPHA_TEST_VALUE_WRITE
          Specifies that this RenderingAttributes object allows writing its alpha test value component information.
static int ALLOW_DEPTH_ENABLE_READ
          Specifies that this RenderingAttributes object allows reading its depth buffer enable and depth buffer write enable component information.
static int ALWAYS
          Indicates pixels are always drawn irrespective of alpha value.
static int EQUAL
          Indicates pixels are drawn if pixel alpha value is equal to alpha test value.
static int GREATER
          Indicates pixels are drawn if pixel alpha value is greater than alpha test value.
static int GREATER_OR_EQUAL
          Indicates pixels are drawn if pixel alpha value is greater than or equal to alpha test value.
static int LESS
          Indicates pixels are drawn if pixel alpha value is less than alpha test value.
static int LESS_OR_EQUAL
          Indicates pixels are drawn if pixel alpha value is less than or equal to alpha test value.
static int NEVER
          Indicates pixels are never drawn irrespective of alpha value.
static int NOT_EQUAL
          Indicates pixels are drawn if pixel alpha value is not equal to alpha test value.
 
Constructor Summary
RenderingAttributes()
          Constructs a RenderingAttributes object with default parameters.
RenderingAttributes(boolean depthBufferEnable, boolean depthBufferWriteEnable, float alphaTestValue, int alphaTestFunction)
          Constructs a RenderingAttributes object with specified values.
 
Method Summary
 NodeComponent cloneNodeComponent()
          Creates a new RenderingAttributes object.
 void duplicateNodeComponent(NodeComponent originalNodeComponent)
          Copies the information found in originalNodeComponent to the current node.
 int getAlphaTestFunction()
          Retrieves current alpha test function.
 float getAlphaTestValue()
          Retrieves the alpha test value.
 boolean getDepthBufferEnable()
          Retrieves the state of zBuffer Enable flag
 boolean getDepthBufferWriteEnable()
          Retrieves the state of Depth Buffer Write Enable flag
 void setAlphaTestFunction(int function)
          Set alpha test function.
 void setAlphaTestValue(float value)
          Set alpha test value used by alpha test function.
 void setDepthBufferEnable(boolean state)
          Enables or disables depth buffer mode for this RenderAttributes component object.
 void setDepthBufferWriteEnable(boolean state)
          Enables or disables writing the depth buffer for this object.
 
Methods inherited from class javax.media.j3d.NodeComponent
getDuplicateOnCloneTree, setDuplicateOnCloneTree
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, duplicateSceneGraphObject, getCapability, getUserData, isCompiled, isLive, setCapability, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALLOW_ALPHA_TEST_VALUE_READ

public static final int ALLOW_ALPHA_TEST_VALUE_READ
Specifies that this RenderingAttributes object allows reading its alpha test value component information.

ALLOW_ALPHA_TEST_VALUE_WRITE

public static final int ALLOW_ALPHA_TEST_VALUE_WRITE
Specifies that this RenderingAttributes object allows writing its alpha test value component information.

ALLOW_ALPHA_TEST_FUNCTION_READ

public static final int ALLOW_ALPHA_TEST_FUNCTION_READ
Specifies that this RenderingAttributes object allows reading its alpha test function component information.

ALLOW_ALPHA_TEST_FUNCTION_WRITE

public static final int ALLOW_ALPHA_TEST_FUNCTION_WRITE
Specifies that this RenderingAttributes object allows writing its alpha test function component information.

ALLOW_DEPTH_ENABLE_READ

public static final int ALLOW_DEPTH_ENABLE_READ
Specifies that this RenderingAttributes object allows reading its depth buffer enable and depth buffer write enable component information.

ALWAYS

public static final int ALWAYS
Indicates pixels are always drawn irrespective of alpha value. This effectively disables alpha testing.

NEVER

public static final int NEVER
Indicates pixels are never drawn irrespective of alpha value.

EQUAL

public static final int EQUAL
Indicates pixels are drawn if pixel alpha value is equal to alpha test value.

NOT_EQUAL

public static final int NOT_EQUAL
Indicates pixels are drawn if pixel alpha value is not equal to alpha test value.

LESS

public static final int LESS
Indicates pixels are drawn if pixel alpha value is less than alpha test value.

LESS_OR_EQUAL

public static final int LESS_OR_EQUAL
Indicates pixels are drawn if pixel alpha value is less than or equal to alpha test value.

GREATER

public static final int GREATER
Indicates pixels are drawn if pixel alpha value is greater than alpha test value.

GREATER_OR_EQUAL

public static final int GREATER_OR_EQUAL
Indicates pixels are drawn if pixel alpha value is greater than or equal to alpha test value.
Constructor Detail

RenderingAttributes

public RenderingAttributes()
Constructs a RenderingAttributes object with default parameters. The default values are as follows:

RenderingAttributes

public RenderingAttributes(boolean depthBufferEnable,
                           boolean depthBufferWriteEnable,
                           float alphaTestValue,
                           int alphaTestFunction)
Constructs a RenderingAttributes object with specified values.
Parameters:
depthBufferEnable - a flag to turn depth buffer on/off.
depthBufferWriteEnable - a flag to to make depth buffer read/write or read only.
alphaTestValue - the alpha test reference value.
alphaTestFunction - the function for comparing alpha values.
Method Detail

setDepthBufferEnable

public final void setDepthBufferEnable(boolean state)
Enables or disables depth buffer mode for this RenderAttributes component object.
Parameters:
state - true or false to enable or disable depth buffer mode
Throws:
RestrictedAccessException - if the method is called when this object is part of live or compiled scene graph

getDepthBufferEnable

public final boolean getDepthBufferEnable()
Retrieves the state of zBuffer Enable flag
Returns:
true if depth buffer mode is enabled, false if depth buffer mode is disabled
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setDepthBufferWriteEnable

public final void setDepthBufferWriteEnable(boolean state)
Enables or disables writing the depth buffer for this object. During the transparent rendering pass, this attribute can be overridden by the depthBufferFreezeTransparent attribute in the View object.
Parameters:
state - true or false to enable or disable depth buffer Write mode
Throws:
RestrictedAccessException - if the method is called when this object is part of live or compiled scene graph
See Also:
View.setDepthBufferFreezeTransparent(boolean)

getDepthBufferWriteEnable

public final boolean getDepthBufferWriteEnable()
Retrieves the state of Depth Buffer Write Enable flag
Returns:
true if depth buffer is writable, false if depth buffer is read-only
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setAlphaTestValue

public final void setAlphaTestValue(float value)
Set alpha test value used by alpha test function. This value is compared to the alpha value of each rendered pixel.
Parameters:
value - the alpha value
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getAlphaTestValue

public final float getAlphaTestValue()
Retrieves the alpha test value.
Returns:
the alpha test value.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setAlphaTestFunction

public final void setAlphaTestFunction(int function)
Set alpha test function. This function is used to compare the alpha test value with each per-pixel alpha value. If the test passes, then the pixel is written otherwise the pixel is not written.
Parameters:
function - the new alpha test function. One of: ALWAYS, NEVER, EQUAL, NOT_EQUAL, LESS, LESS_OR_EQUAL, GREATER, GREATER_OR_EQUAL.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getAlphaTestFunction

public final int getAlphaTestFunction()
Retrieves current alpha test function.
Returns:
the current alpha test function
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

cloneNodeComponent

public NodeComponent cloneNodeComponent()
Creates a new RenderingAttributes object. Called from a Leaf node's duplicateNode method.
Overrides:
cloneNodeComponent in class NodeComponent
Returns:
a duplicate of the RenderingAttributes object.
See Also:
Node.duplicateNode(javax.media.j3d.Node, boolean), Node.cloneTree(), NodeComponent.setDuplicateOnCloneTree(boolean)

duplicateNodeComponent

public void duplicateNodeComponent(NodeComponent originalNodeComponent)
Copies the information found in originalNodeComponent to the current node. This routine is called as part of the cloneTree operation.
Overrides:
duplicateNodeComponent in class NodeComponent
Parameters:
originalNodeComponent - the node to duplicate.
See Also:
Node.cloneTree(), Node.duplicateNode(javax.media.j3d.Node, boolean), NodeComponent.setDuplicateOnCloneTree(boolean)