public interface DefaultPolygonShader extends PolygonShader
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.
de.jreality.jogl.shader.DefaultGeometryShader
Modifier and Type | Field and Description |
---|---|
static double |
AMBIENT_COEFFICIENT_DEFAULT |
static Color |
AMBIENT_COLOR_DEFAULT |
static Object |
CREATE_DEFAULT |
static double |
DIFFUSE_COEFFICIENT_DEFAULT |
static Color |
DIFFUSE_COLOR_DEFAULT |
static boolean |
SMOOTH_SHADING_DEFAULT |
static double |
SPECULAR_COEFFICIENT_DEFAULT |
static Color |
SPECULAR_COLOR_DEFAULT |
static double |
SPECULAR_EXPONENT_DEFAULT |
static double |
TRANSPARENCY_DEFAULT |
DEFAULT_ENTITY
Modifier and Type | Method and Description |
---|---|
CubeMap |
createReflectionMap() |
TextShader |
createTextShader(String name) |
Texture2D |
createTexture2d() |
Double |
getAmbientCoefficient() |
Color |
getAmbientColor() |
Double |
getDiffuseCoefficient() |
Color |
getDiffuseColor() |
CubeMap |
getReflectionMap() |
Boolean |
getSmoothShading() |
Double |
getSpecularCoefficient() |
Color |
getSpecularColor() |
Double |
getSpecularExponent() |
TextShader |
getTextShader() |
Texture2D |
getTexture2d() |
Double |
getTransparency() |
void |
setAmbientCoefficient(Double d) |
void |
setAmbientColor(Color c) |
void |
setDiffuseCoefficient(Double d) |
void |
setDiffuseColor(Color c) |
void |
setSmoothShading(Boolean b) |
void |
setSpecularCoefficient(Double d) |
void |
setSpecularColor(Color c) |
void |
setSpecularExponent(Double d) |
void |
setTransparency(Double d) |
static final double AMBIENT_COEFFICIENT_DEFAULT
static final Color AMBIENT_COLOR_DEFAULT
static final double DIFFUSE_COEFFICIENT_DEFAULT
static final Color DIFFUSE_COLOR_DEFAULT
static final boolean SMOOTH_SHADING_DEFAULT
static final double SPECULAR_COEFFICIENT_DEFAULT
static final Color SPECULAR_COLOR_DEFAULT
static final double SPECULAR_EXPONENT_DEFAULT
static final double TRANSPARENCY_DEFAULT
static final Object CREATE_DEFAULT
TextShader createTextShader(String name)
Texture2D createTexture2d()
CubeMap createReflectionMap()
Double getAmbientCoefficient()
Color getAmbientColor()
Double getDiffuseCoefficient()
Color getDiffuseColor()
Boolean getSmoothShading()
Double getSpecularCoefficient()
Color getSpecularColor()
Double getSpecularExponent()
TextShader getTextShader()
Texture2D getTexture2d()
CubeMap getReflectionMap()
Double getTransparency()
void setAmbientCoefficient(Double d)
void setAmbientColor(Color c)
void setDiffuseCoefficient(Double d)
void setDiffuseColor(Color c)
void setSmoothShading(Boolean b)
void setSpecularCoefficient(Double d)
void setSpecularColor(Color c)
void setSpecularExponent(Double d)
void setTransparency(Double d)