de.jreality.shader
Interface DefaultPolygonShader
- All Superinterfaces:
- AttributeCollection, AttributeEntity, PolygonShader
- All Known Subinterfaces:
- ImplodePolygonShader
public interface DefaultPolygonShader
- extends PolygonShader
This interface represents the default polygon shader used in jReality.
This interface can be used in conjunction with the AttributeEntity
class to set the actual Appearance
attributes which the various
backends use when rendering the scene. This avoids having to use the keys for these attributes
(see CommonAttributes
). Backend writers can
use a similar strategy to get the attributes, too.
This shader implements a standard plastic-like surface shader where the
shaded color at a point P on the surface with normal vector N, eye vector
I, and light vector L
is given by:
Cs = Ka*ambient + Kd*(N.L)*diffuse + Ks*pow((L.R),Kexp)*specular
where R is the reflected eye vector. Here, ambient, diffuse, and specular are
colors which are set using the methods setAmbientColor(Color)
), etc. --
but see below for exceptions related to the diffuse term.
The transparency value determines how much light the surface lets through. A value of 0
is opaque. (See RenderingHintsShader.getTransparencyEnabled()
).
There is also a flag to determine whether facets are smooth-shaded or not (setSmoothShading(Boolean)
).
If true
, then the shader uses vertex colors and vertex normals (assuming they are present)
as the diffuse
color and the N
vector in the above formula;
if false
, then the shader uses face colors and face normals instead (assuming they are present).
See IndexedFaceSet
for how to set these vertex and face attributes.
This means that the diffuse
color can be gotten from the current diffuse color in the shader,
from the vertex colors attached to the geometry, or from the face colors.
- Author:
- Charles Gunn
- See Also:
de.jreality.jogl.shader.DefaultGeometryShader
AMBIENT_COEFFICIENT_DEFAULT
static final double AMBIENT_COEFFICIENT_DEFAULT
- See Also:
- Constant Field Values
AMBIENT_COLOR_DEFAULT
static final java.awt.Color AMBIENT_COLOR_DEFAULT
DIFFUSE_COEFFICIENT_DEFAULT
static final double DIFFUSE_COEFFICIENT_DEFAULT
- See Also:
- Constant Field Values
DIFFUSE_COLOR_DEFAULT
static final java.awt.Color DIFFUSE_COLOR_DEFAULT
SMOOTH_SHADING_DEFAULT
static final boolean SMOOTH_SHADING_DEFAULT
- See Also:
- Constant Field Values
SPECULAR_COEFFICIENT_DEFAULT
static final double SPECULAR_COEFFICIENT_DEFAULT
- See Also:
- Constant Field Values
SPECULAR_COLOR_DEFAULT
static final java.awt.Color SPECULAR_COLOR_DEFAULT
SPECULAR_EXPONENT_DEFAULT
static final double SPECULAR_EXPONENT_DEFAULT
- See Also:
- Constant Field Values
TRANSPARENCY_DEFAULT
static final double TRANSPARENCY_DEFAULT
- See Also:
- Constant Field Values
CREATE_DEFAULT
static final java.lang.Object CREATE_DEFAULT
createTextShader
TextShader createTextShader(java.lang.String name)
createTexture2d
Texture2D createTexture2d()
createReflectionMap
CubeMap createReflectionMap()
getAmbientCoefficient
java.lang.Double getAmbientCoefficient()
getAmbientColor
java.awt.Color getAmbientColor()
getDiffuseCoefficient
java.lang.Double getDiffuseCoefficient()
getDiffuseColor
java.awt.Color getDiffuseColor()
getSmoothShading
java.lang.Boolean getSmoothShading()
getSpecularCoefficient
java.lang.Double getSpecularCoefficient()
getSpecularColor
java.awt.Color getSpecularColor()
getSpecularExponent
java.lang.Double getSpecularExponent()
getTextShader
TextShader getTextShader()
getTexture2d
Texture2D getTexture2d()
getReflectionMap
CubeMap getReflectionMap()
getTransparency
java.lang.Double getTransparency()
setAmbientCoefficient
void setAmbientCoefficient(java.lang.Double d)
setAmbientColor
void setAmbientColor(java.awt.Color c)
setDiffuseCoefficient
void setDiffuseCoefficient(java.lang.Double d)
setDiffuseColor
void setDiffuseColor(java.awt.Color c)
setSmoothShading
void setSmoothShading(java.lang.Boolean b)
setSpecularCoefficient
void setSpecularCoefficient(java.lang.Double d)
setSpecularColor
void setSpecularColor(java.awt.Color c)
setSpecularExponent
void setSpecularExponent(java.lang.Double d)
setTransparency
void setTransparency(java.lang.Double d)