de.jreality.shader
Interface DefaultPolygonShader

All Superinterfaces:
AttributeCollection, AttributeEntity, PolygonShader

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 {@link de.jreality.shader.RenderingHintsShader#getTransparencyEnabled()).\

There is also a flag to determine whether facets are smooth-shaded or not ({@link #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 {@link 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

Field Summary
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
           
 
Fields inherited from interface de.jreality.shader.PolygonShader
DEFAULT_ENTITY
 
Method Summary
 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)
           
 

Field Detail

AMBIENT_COEFFICIENT_DEFAULT

static final double AMBIENT_COEFFICIENT_DEFAULT
See Also:
Constant Field Values

AMBIENT_COLOR_DEFAULT

static final Color AMBIENT_COLOR_DEFAULT

DIFFUSE_COEFFICIENT_DEFAULT

static final double DIFFUSE_COEFFICIENT_DEFAULT
See Also:
Constant Field Values

DIFFUSE_COLOR_DEFAULT

static final 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 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 Object CREATE_DEFAULT
Method Detail

createTextShader

TextShader createTextShader(String name)

createTexture2d

Texture2D createTexture2d()

createReflectionMap

CubeMap createReflectionMap()

getAmbientCoefficient

Double getAmbientCoefficient()

getAmbientColor

Color getAmbientColor()

getDiffuseCoefficient

Double getDiffuseCoefficient()

getDiffuseColor

Color getDiffuseColor()

getSmoothShading

Boolean getSmoothShading()

getSpecularCoefficient

Double getSpecularCoefficient()

getSpecularColor

Color getSpecularColor()

getSpecularExponent

Double getSpecularExponent()

getTextShader

TextShader getTextShader()

getTexture2d

Texture2D getTexture2d()

getReflectionMap

CubeMap getReflectionMap()

getTransparency

Double getTransparency()

setAmbientCoefficient

void setAmbientCoefficient(Double d)

setAmbientColor

void setAmbientColor(Color c)

setDiffuseCoefficient

void setDiffuseCoefficient(Double d)

setDiffuseColor

void setDiffuseColor(Color c)

setSmoothShading

void setSmoothShading(Boolean b)

setSpecularCoefficient

void setSpecularCoefficient(Double d)

setSpecularColor

void setSpecularColor(Color c)

setSpecularExponent

void setSpecularExponent(Double d)

setTransparency

void setTransparency(Double d)