public class ShaderAttributeSet extends NodeComponent
There are two ways in which values can be specified for uniform attributes: explicitly, by providing a value; and implicitly, by defining a binding between a Java 3D system attribute and a uniform attribute. This functionality is provided by two subclasses of ShaderAttribute: ShaderAttributeObject, which is used to specify explicitly defined attributes; and ShaderAttributeBinding, which is used to specify implicitly defined, automatically tracked attributes.
Depending on the shading language (and profile) being used, several Java 3D state attributes are automatically made available to the shader program as pre-defined uniform attributes. The application doesn't need to do anything to pass these attributes in to the shader program. The implementation of each shader language (e.g., Cg, GLSL) defines its own bindings from Java 3D attribute to uniform variable name. A list of these attributes for each shader language can be found in the concrete subclass of ShaderProgram for that shader language.
ShaderAttribute
,
ShaderProgram
,
ShaderAppearance.setShaderAttributeSet(org.scijava.java3d.ShaderAttributeSet)
Modifier and Type | Field and Description |
---|---|
static int |
ALLOW_ATTRIBUTES_READ
Specifies that this ShaderAttributeSet object allows reading
its attributes.
|
static int |
ALLOW_ATTRIBUTES_WRITE
Specifies that this ShaderAttributeSet object allows writing
its attributes.
|
Constructor and Description |
---|
ShaderAttributeSet()
Constructs an empty ShaderAttributeSet object.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all shader attributes from the attributes set.
|
ShaderAttribute |
get(String attrName)
Retrieves the shader attribute with the specified
attrName from the attributes set. |
ShaderAttribute[] |
getAll()
Returns a shallow copy of the attributes set.
|
void |
put(ShaderAttribute attr)
Adds the specified shader attribute to the attributes set.
|
void |
remove(ShaderAttribute attr)
Removes the specified shader attribute from the attributes
set.
|
void |
remove(String attrName)
Removes the shader attribute with the specified
attrName from the attributes set. |
int |
size()
Returns the number of elements in the attributes set.
|
cloneNodeComponent, cloneNodeComponent, duplicateNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
public static final int ALLOW_ATTRIBUTES_READ
public static final int ALLOW_ATTRIBUTES_WRITE
public ShaderAttributeSet()
public void put(ShaderAttribute attr)
attr
- the shader attribute to be added to the setNullPointerException
- if attr is nullCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic ShaderAttribute get(String attrName)
attrName
from the attributes set. If attrName does
not exist in the attributes set, null is returned.attrName
- the name of the shader attribute to be retrievedNullPointerException
- if attrName is nullCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void remove(String attrName)
attrName
from the attributes set. If attrName does
not exist in the attributes set then nothing happens.attrName
- the name of the shader attribute to be removedNullPointerException
- if attrName is nullCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void remove(ShaderAttribute attr)
removeAttribute(String)
.attr
- the shader attribute to be removedNullPointerException
- if attr is nullCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void clear()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic ShaderAttribute[] getAll()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic int size()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphCopyright © 2016–2022 SciJava. All rights reserved.