javax.media.j3d
Class RenderingAttributes

java.lang.Object
  extended by javax.media.j3d.SceneGraphObject
      extended by javax.media.j3d.NodeComponent
          extended by javax.media.j3d.RenderingAttributes

public class RenderingAttributes
extends NodeComponent

The RenderingAttributes object defines common rendering attributes for all primitive types. The rendering attributes are:

See Also:
Appearance

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 ALLOW_DEPTH_ENABLE_WRITE
          Specifies that this RenderingAttributes object allows writing its depth buffer enable and depth buffer write enable component information.
static int ALLOW_IGNORE_VERTEX_COLORS_READ
          Specifies that this RenderingAttributes object allows reading its ignore vertex colors information.
static int ALLOW_IGNORE_VERTEX_COLORS_WRITE
          Specifies that this RenderingAttributes object allows writing its ignore vertex colors information.
static int ALLOW_RASTER_OP_READ
          Specifies that this RenderingAttributes object allows reading its raster operation information.
static int ALLOW_RASTER_OP_WRITE
          Specifies that this RenderingAttributes object allows writing its raster operation information.
static int ALLOW_VISIBLE_READ
          Specifies that this RenderingAttributes object allows reading its visibility information.
static int ALLOW_VISIBLE_WRITE
          Specifies that this RenderingAttributes object allows writing its visibility 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.
static int ROP_COPY
          Raster operation: DST = SRC.
static int ROP_XOR
          Raster operation: DST = SRC ^ DST.
 
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.
RenderingAttributes(boolean depthBufferEnable, boolean depthBufferWriteEnable, float alphaTestValue, int alphaTestFunction, boolean visible, boolean ignoreVertexColors, boolean rasterOpEnable, int rasterOp)
          Constructs a RenderingAttributes object with specified values
 
Method Summary
 NodeComponent cloneNodeComponent()
          Deprecated. replaced with cloneNodeComponent(boolean forceDuplicate)
 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.
 boolean getIgnoreVertexColors()
          Retrieves the ignoreVertexColors flag for this RenderingAttributes object.
 int getRasterOp()
          Retrieves the current raster operation for this RenderingAttributes object.
 boolean getRasterOpEnable()
          Retrieves the rasterOp enable flag for this RenderingAttributes object.
 boolean getVisible()
          Retrieves the visibility flag for this RenderingAttributes object.
 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 RenderingAttributes component object.
 void setDepthBufferWriteEnable(boolean state)
          Enables or disables writing the depth buffer for this object.
 void setIgnoreVertexColors(boolean ignoreVertexColors)
          Sets a flag that indicates whether vertex colors are ignored for this RenderingAttributes object.
 void setRasterOp(int rasterOp)
          Sets the raster operation function for this RenderingAttributes component object.
 void setRasterOpEnable(boolean rasterOpEnable)
          Sets the rasterOp enable flag for this RenderingAttributes component object.
 void setVisible(boolean visible)
          Sets the visibility flag for this RenderingAttributes component object.
 
Methods inherited from class javax.media.j3d.NodeComponent
cloneNodeComponent, duplicateNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setUserData, updateNodeReferences
 
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.

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

ALLOW_DEPTH_ENABLE_WRITE

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

Since:
Java 3D 1.3
See Also:
Constant Field Values

ALLOW_VISIBLE_READ

public static final int ALLOW_VISIBLE_READ
Specifies that this RenderingAttributes object allows reading its visibility information.

Since:
Java 3D 1.2
See Also:
Constant Field Values

ALLOW_VISIBLE_WRITE

public static final int ALLOW_VISIBLE_WRITE
Specifies that this RenderingAttributes object allows writing its visibility information.

Since:
Java 3D 1.2
See Also:
Constant Field Values

ALLOW_IGNORE_VERTEX_COLORS_READ

public static final int ALLOW_IGNORE_VERTEX_COLORS_READ
Specifies that this RenderingAttributes object allows reading its ignore vertex colors information.

Since:
Java 3D 1.2
See Also:
Constant Field Values

ALLOW_IGNORE_VERTEX_COLORS_WRITE

public static final int ALLOW_IGNORE_VERTEX_COLORS_WRITE
Specifies that this RenderingAttributes object allows writing its ignore vertex colors information.

Since:
Java 3D 1.2
See Also:
Constant Field Values

ALLOW_RASTER_OP_READ

public static final int ALLOW_RASTER_OP_READ
Specifies that this RenderingAttributes object allows reading its raster operation information.

Since:
Java 3D 1.2
See Also:
Constant Field Values

ALLOW_RASTER_OP_WRITE

public static final int ALLOW_RASTER_OP_WRITE
Specifies that this RenderingAttributes object allows writing its raster operation information.

Since:
Java 3D 1.2
See Also:
Constant Field Values

ALWAYS

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

See Also:
Constant Field Values

NEVER

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

See Also:
Constant Field Values

EQUAL

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

See Also:
Constant Field Values

NOT_EQUAL

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

See Also:
Constant Field Values

LESS

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

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

GREATER

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

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

ROP_COPY

public static final int ROP_COPY
Raster operation: DST = SRC.

Since:
Java 3D 1.2
See Also:
setRasterOp(int), Constant Field Values

ROP_XOR

public static final int ROP_XOR
Raster operation: DST = SRC ^ DST.

Since:
Java 3D 1.2
See Also:
setRasterOp(int), Constant Field Values
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

RenderingAttributes

public RenderingAttributes(boolean depthBufferEnable,
                           boolean depthBufferWriteEnable,
                           float alphaTestValue,
                           int alphaTestFunction,
                           boolean visible,
                           boolean ignoreVertexColors,
                           boolean rasterOpEnable,
                           int rasterOp)
Constructs a RenderingAttributes object with specified values

Parameters:
depthBufferEnable - a flag to turn depth buffer on/off
depthBufferWriteEnable - a flag to make depth buffer read/write or read only
alphaTestValue - the alpha test reference value
alphaTestFunction - the function for comparing alpha values
visible - a flag that specifies whether the object is visible
ignoreVertexColors - a flag to enable or disable the ignoring of per-vertex colors
rasterOpEnable - a flag that specifies whether logical raster operations are enabled for this RenderingAttributes object. This disables all alpha blending operations.
rasterOp - the logical raster operation, one of ROP_COPY or ROP_XOR.
Since:
Java 3D 1.2
Method Detail

setDepthBufferEnable

public void setDepthBufferEnable(boolean state)
Enables or disables depth buffer mode for this RenderingAttributes component object.

Parameters:
state - true or false to enable or disable depth buffer mode
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getDepthBufferEnable

public 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 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:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
See Also:
View.setDepthBufferFreezeTransparent(boolean)

getDepthBufferWriteEnable

public 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 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 test value
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getAlphaTestValue

public 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 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, 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 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

setVisible

public void setVisible(boolean visible)
Sets the visibility flag for this RenderingAttributes component object. Invisible objects are not rendered (subject to the visibility policy for the current view), but they can be picked or collided with. The default value is true.

Parameters:
visible - true or false to enable or disable visibility
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
Since:
Java 3D 1.2
See Also:
View.setVisibilityPolicy(int)

getVisible

public boolean getVisible()
Retrieves the visibility flag for this RenderingAttributes object.

Returns:
true if the object is visible; false if the object is invisible.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
Since:
Java 3D 1.2

setIgnoreVertexColors

public void setIgnoreVertexColors(boolean ignoreVertexColors)
Sets a flag that indicates whether vertex colors are ignored for this RenderingAttributes object. If ignoreVertexColors is false, per-vertex colors are used, when present in the associated Geometry objects, taking precedence over the ColoringAttributes color and the specified Material color(s). If ignoreVertexColors is true, per-vertex colors are ignored. In this case, if lighting is enabled, the Material diffuse color will be used as the object color. If lighting is disabled, the ColoringAttributes color will be used. The default value is false.

Parameters:
ignoreVertexColors - true or false to enable or disable the ignoring of per-vertex colors
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
Since:
Java 3D 1.2
See Also:
ColoringAttributes, Material

getIgnoreVertexColors

public boolean getIgnoreVertexColors()
Retrieves the ignoreVertexColors flag for this RenderingAttributes object.

Returns:
true if per-vertex colors are ignored; false if per-vertex colors are used.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
Since:
Java 3D 1.2

setRasterOpEnable

public void setRasterOpEnable(boolean rasterOpEnable)
Sets the rasterOp enable flag for this RenderingAttributes component object. When set to true, this enables logical raster operations as specified by the setRasterOp method. Enabling raster operations effectively disables alpha blending, which is used for transparency and antialiasing. Raster operations, especially XOR mode, are primarily useful when rendering to the front buffer in immediate mode. Most applications will not wish to enable this mode.

Parameters:
rasterOpEnable - true or false to enable or disable raster operations
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
Since:
Java 3D 1.2
See Also:
setRasterOp(int)

getRasterOpEnable

public boolean getRasterOpEnable()
Retrieves the rasterOp enable flag for this RenderingAttributes object.

Returns:
true if raster operations are enabled; false if raster operations are disabled.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
Since:
Java 3D 1.2

setRasterOp

public void setRasterOp(int rasterOp)
Sets the raster operation function for this RenderingAttributes component object.

Parameters:
rasterOp - the logical raster operation, one of ROP_COPY or ROP_XOR
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
Since:
Java 3D 1.2

getRasterOp

public int getRasterOp()
Retrieves the current raster operation for this RenderingAttributes object.

Returns:
one of ROP_COPY or ROP_XOR.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
Since:
Java 3D 1.2

cloneNodeComponent

public NodeComponent cloneNodeComponent()
Deprecated. replaced with cloneNodeComponent(boolean forceDuplicate)

Overrides:
cloneNodeComponent in class NodeComponent