javax.media.j3d
Class ShaderAppearance

java.lang.Object
  extended by javax.media.j3d.SceneGraphObject
      extended by javax.media.j3d.NodeComponent
          extended by javax.media.j3d.Appearance
              extended by javax.media.j3d.ShaderAppearance

public class ShaderAppearance
extends Appearance

The ShaderAppearance object defines programmable shading attributes that can be set as a component object of a Shape3D node. The ShaderAppearance rendering state adds the following attributes in addition to those defined by Appearance:

The ShaderAppearance object modifies the definition of some of the attributes in Appearance:

Since:
Java 3D 1.4
See Also:
ShaderProgram, ShaderAttributeSet

Field Summary
static int ALLOW_SHADER_ATTRIBUTE_SET_READ
          Specifies that this ShaderAppearance object allows reading its ShaderAttributeSet component information.
static int ALLOW_SHADER_ATTRIBUTE_SET_WRITE
          Specifies that this ShaderAppearance object allows writing its ShaderAttributeSet component information.
static int ALLOW_SHADER_PROGRAM_READ
          Specifies that this ShaderAppearance object allows reading its ShaderProgram component information.
static int ALLOW_SHADER_PROGRAM_WRITE
          Specifies that this ShaderAppearance object allows writing its ShaderProgram component information.
private static int[] readCapabilities
           
 
Fields inherited from class javax.media.j3d.Appearance
ALLOW_COLORING_ATTRIBUTES_READ, ALLOW_COLORING_ATTRIBUTES_WRITE, ALLOW_LINE_ATTRIBUTES_READ, ALLOW_LINE_ATTRIBUTES_WRITE, ALLOW_MATERIAL_READ, ALLOW_MATERIAL_WRITE, ALLOW_POINT_ATTRIBUTES_READ, ALLOW_POINT_ATTRIBUTES_WRITE, ALLOW_POLYGON_ATTRIBUTES_READ, ALLOW_POLYGON_ATTRIBUTES_WRITE, ALLOW_RENDERING_ATTRIBUTES_READ, ALLOW_RENDERING_ATTRIBUTES_WRITE, ALLOW_TEXGEN_READ, ALLOW_TEXGEN_WRITE, ALLOW_TEXTURE_ATTRIBUTES_READ, ALLOW_TEXTURE_ATTRIBUTES_WRITE, ALLOW_TEXTURE_READ, ALLOW_TEXTURE_UNIT_STATE_READ, ALLOW_TEXTURE_UNIT_STATE_WRITE, ALLOW_TEXTURE_WRITE, ALLOW_TRANSPARENCY_ATTRIBUTES_READ, ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE
 
Fields inherited from class javax.media.j3d.NodeComponent
forceDuplicate
 
Fields inherited from class javax.media.j3d.SceneGraphObject
nodeHashtable, retained
 
Constructor Summary
ShaderAppearance()
          Constructs a ShaderAppearance component object using defaults for all state variables.
 
Method Summary
 NodeComponent cloneNodeComponent()
          Deprecated. replaced with cloneNodeComponent(boolean forceDuplicate)
(package private)  void createRetained()
          Creates the retained mode ShaderAppearanceRetained object that this ShaderAppearance component object will point to.
(package private)  void duplicateAttributes(NodeComponent originalNodeComponent, boolean forceDuplicate)
          Copies all ShaderAppearance information from originalNodeComponent into the current node.
(package private)  boolean duplicateChild()
          This function is called from getNodeComponent() to see if any of the sub-NodeComponents duplicateOnCloneTree flag is true.
 void duplicateNodeComponent(NodeComponent originalNodeComponent)
          Deprecated. replaced with duplicateNodeComponent( NodeComponent originalNodeComponent, boolean forceDuplicate)
 ShaderAttributeSet getShaderAttributeSet()
          Retrieves the current ShaderAttributeSet object.
 ShaderProgram getShaderProgram()
          Retrieves the current ShaderProgram object.
 void setShaderAttributeSet(ShaderAttributeSet shaderAttributeSet)
          Sets the ShaderAttributeSet object to the specified object.
 void setShaderProgram(ShaderProgram shaderProgram)
          Sets the ShaderProgram object to the specified object.
 
Methods inherited from class javax.media.j3d.Appearance
getColoringAttributes, getLineAttributes, getMaterial, getPointAttributes, getPolygonAttributes, getRenderingAttributes, getTexCoordGeneration, getTexture, getTextureAttributes, getTextureUnitCount, getTextureUnitState, getTextureUnitState, getTransparencyAttributes, setColoringAttributes, setLineAttributes, setMaterial, setPointAttributes, setPolygonAttributes, setRenderingAttributes, setTexCoordGeneration, setTexture, setTextureAttributes, setTextureUnitState, setTextureUnitState, setTransparencyAttributes
 
Methods inherited from class javax.media.j3d.NodeComponent
checkDuplicateNodeComponent, cloneNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree, validateImageIllegalSharing
 
Methods inherited from class javax.media.j3d.SceneGraphObject
capabilityBitsEmpty, checkForLiveOrCompiled, clearCapability, clearCapabilityIsFrequent, clearLive, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getNamePrefix, getNodeComponent, getUserData, isCompiled, isLive, isLiveOrCompiled, setCapability, setCapabilityIsFrequent, setCompiled, setDefaultReadCapabilities, setLive, setName, setUserData, toString, updateNodeReferences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ALLOW_SHADER_PROGRAM_READ

public static final int ALLOW_SHADER_PROGRAM_READ
Specifies that this ShaderAppearance object allows reading its ShaderProgram component information.

See Also:
Constant Field Values

ALLOW_SHADER_PROGRAM_WRITE

public static final int ALLOW_SHADER_PROGRAM_WRITE
Specifies that this ShaderAppearance object allows writing its ShaderProgram component information.

See Also:
Constant Field Values

ALLOW_SHADER_ATTRIBUTE_SET_READ

public static final int ALLOW_SHADER_ATTRIBUTE_SET_READ
Specifies that this ShaderAppearance object allows reading its ShaderAttributeSet component information.

See Also:
Constant Field Values

ALLOW_SHADER_ATTRIBUTE_SET_WRITE

public static final int ALLOW_SHADER_ATTRIBUTE_SET_WRITE
Specifies that this ShaderAppearance object allows writing its ShaderAttributeSet component information.

See Also:
Constant Field Values

readCapabilities

private static final int[] readCapabilities
Constructor Detail

ShaderAppearance

public ShaderAppearance()
Constructs a ShaderAppearance component object using defaults for all state variables. All component object references are initialized to null.

Method Detail

createRetained

void createRetained()
Creates the retained mode ShaderAppearanceRetained object that this ShaderAppearance component object will point to.

Overrides:
createRetained in class Appearance

setShaderProgram

public void setShaderProgram(ShaderProgram shaderProgram)
Sets the ShaderProgram object to the specified object. Setting it to null causes a default pass-through shader to be used ???

Parameters:
shaderProgram - object that specifies the desired shader program
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getShaderProgram

public ShaderProgram getShaderProgram()
Retrieves the current ShaderProgram object.

Returns:
the ShaderProgram object
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setShaderAttributeSet

public void setShaderAttributeSet(ShaderAttributeSet shaderAttributeSet)
Sets the ShaderAttributeSet object to the specified object. Setting it to null is equivalent to specifying an empty set of attributes.

Parameters:
shaderAttributeSet - object that specifies the desired shader attributes
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getShaderAttributeSet

public ShaderAttributeSet getShaderAttributeSet()
Retrieves the current ShaderAttributeSet object.

Returns:
the ShaderAttributeSet object
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

cloneNodeComponent

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

Overrides:
cloneNodeComponent in class Appearance

duplicateNodeComponent

public void duplicateNodeComponent(NodeComponent originalNodeComponent)
Deprecated. replaced with duplicateNodeComponent( NodeComponent originalNodeComponent, boolean forceDuplicate)

NOTE: Applications should not call this method directly. It should only be called by the cloneNode method.

Overrides:
duplicateNodeComponent in class Appearance

duplicateAttributes

void duplicateAttributes(NodeComponent originalNodeComponent,
                         boolean forceDuplicate)
Copies all ShaderAppearance information from originalNodeComponent into the current node. This method is called from the cloneNode method which is, in turn, called by the cloneTree method.

Overrides:
duplicateAttributes in class Appearance
Parameters:
originalNodeComponent - the original node to duplicate.
forceDuplicate - when set to true, causes the duplicateOnCloneTree flag to be ignored. When false, the value of each node's duplicateOnCloneTree variable determines whether NodeComponent data is duplicated or copied.
Throws:
RestrictedAccessException - if this object is part of a live or compiled scenegraph.
See Also:
Node.cloneTree(), NodeComponent.setDuplicateOnCloneTree(boolean)

duplicateChild

boolean duplicateChild()
This function is called from getNodeComponent() to see if any of the sub-NodeComponents duplicateOnCloneTree flag is true. If it is the case, current NodeComponent needs to duplicate also even though current duplicateOnCloneTree flag is false. This should be overwrite by NodeComponent which contains sub-NodeComponent.

Overrides:
duplicateChild in class Appearance


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.