de.jreality.shader
Interface DefaultLineShader

All Superinterfaces:
AttributeCollection, AttributeEntity, LineShader

public interface DefaultLineShader
extends LineShader

This is the default line shader used in jReality.

There is an option to draw tubes around the edges, for improved visibility and "3D readability". The radius of the tubes can be specified using setTubeRadius(Double). These tubes (which are of course surfaces) will be shaded using with the current polygon shader. In this way you can control the surface qualities of the tubes.

If tubes are not requested, then the shader draws a more primitive version of the edges, perhaps using a Bresenham algorithm. Here the parameters include the line width (in pixel coordinates, default = 1), and some options for drawing dashed lines (setLineStipplePattern(Integer)). The color of the lines is set via setDiffuseColor(Color).

Different backends implement different versions of this shader. For example, the software renderer (@link de.jreality.soft.Viewer} always draws tubes; the specification of the tube radius is in world coordinates. On the other hand, the JOGL backend de.jreality.jogl.JOGLViewer can draw traditional Bresenham edges. In this case, lighting is disabled so no shading effects are present. If tubes are enabled, then lighting is enabled, --- and the tube radius is in object coordinates.

When tubes are NOT drawn: If the underlying geometry has vertex colors and/or edge colors attached to it, then the diffuse color is determined as follows: if getVertexColors() returns true then vertex colors are used and are interpolated; if not, then edge colors, if present are used, and are constant per edge; otherwise the value of getDiffuseColor() is used.

Note: the above explanation of coloring is not extended to the tubes, if they are requested. Here the vertex colors are ignored and the edge colors if present are used; otherwise as above.

Note: the different backends implement this shader somewhat differently.

Author:
Charles Gunn
See Also:
for general remarks on these shader interfaces.

Field Summary
static java.lang.Object CREATE_DEFAULT
           
static double[][] CROSS_SECTION_DEFAULT
           
static java.awt.Color DIFFUSE_COLOR_DEFAULT
           
static boolean LIGHTING_ENABLED_DEFAULT
           
static int LINE_FACTOR_DEFAULT
           
static boolean LINE_STIPPLE_DEFAULT
           
static int LINE_STIPPLE_PATTERN_DEFAULT
           
static double LINE_WIDTH_DEFAULT
           
static boolean RADII_WORLD_COORDINATES_DEFAULT
           
static boolean SMOOTH_LINE_SHADING_DEFAULT
           
static boolean TUBE_DRAW_DEFAULT
           
static double TUBE_RADIUS_DEFAULT
           
static FrameFieldType TUBE_STYLE_DEFAULT
           
static boolean VERTEX_COLORS_DEFAULT
           
 
Fields inherited from interface de.jreality.shader.LineShader
DEFAULT_ENTITY
 
Method Summary
 PolygonShader createPolygonShader(java.lang.String shaderName)
           
 TextShader createTextShader(java.lang.String name)
           
 double[][] getCrossSection()
           
 java.awt.Color getDiffuseColor()
           
 java.lang.Integer getLineFactor()
           
 java.lang.Boolean getLineLighting(java.lang.Boolean b)
           
 java.lang.Boolean getLineStipple()
           
 java.lang.Integer getLineStipplePattern()
           
 java.lang.Double getLineWidth()
           
 PolygonShader getPolygonShader()
           
 java.lang.Boolean getRadiiWorldCoordinates()
           
 TextShader getTextShader()
           
 java.lang.Boolean getTubeDraw()
           
 java.lang.Double getTubeRadius()
           
 FrameFieldType getTubeStyle()
           
 java.lang.Boolean getVertexColors()
           
 void setCrossSection(double[][] crossSection)
           
 void setDiffuseColor(java.awt.Color c)
           
 void setLineFactor(java.lang.Integer i)
           
 void setLineLighting(java.lang.Boolean b)
           
 void setLineStipple(java.lang.Boolean b)
           
 void setLineStipplePattern(java.lang.Integer i)
           
 void setLineWidth(java.lang.Double d)
           
 void setRadiiWorldCoordinates(java.lang.Boolean b)
           
 void setTubeDraw(java.lang.Boolean b)
           
 void setTubeRadius(java.lang.Double d)
           
 void setTubeStyle(FrameFieldType i)
           
 void setVertexColors(java.lang.Boolean b)
           
 

Field Detail

CREATE_DEFAULT

static final java.lang.Object CREATE_DEFAULT

TUBE_DRAW_DEFAULT

static final boolean TUBE_DRAW_DEFAULT
See Also:
Constant Field Values

TUBE_RADIUS_DEFAULT

static final double TUBE_RADIUS_DEFAULT
See Also:
Constant Field Values

TUBE_STYLE_DEFAULT

static final FrameFieldType TUBE_STYLE_DEFAULT

SMOOTH_LINE_SHADING_DEFAULT

static final boolean SMOOTH_LINE_SHADING_DEFAULT
See Also:
Constant Field Values

LINE_WIDTH_DEFAULT

static final double LINE_WIDTH_DEFAULT
See Also:
Constant Field Values

LINE_STIPPLE_DEFAULT

static final boolean LINE_STIPPLE_DEFAULT
See Also:
Constant Field Values

VERTEX_COLORS_DEFAULT

static final boolean VERTEX_COLORS_DEFAULT
See Also:
Constant Field Values

LINE_STIPPLE_PATTERN_DEFAULT

static final int LINE_STIPPLE_PATTERN_DEFAULT
See Also:
Constant Field Values

LINE_FACTOR_DEFAULT

static final int LINE_FACTOR_DEFAULT
See Also:
Constant Field Values

DIFFUSE_COLOR_DEFAULT

static final java.awt.Color DIFFUSE_COLOR_DEFAULT

CROSS_SECTION_DEFAULT

static final double[][] CROSS_SECTION_DEFAULT

LIGHTING_ENABLED_DEFAULT

static final boolean LIGHTING_ENABLED_DEFAULT
See Also:
Constant Field Values

RADII_WORLD_COORDINATES_DEFAULT

static final boolean RADII_WORLD_COORDINATES_DEFAULT
See Also:
Constant Field Values
Method Detail

getDiffuseColor

java.awt.Color getDiffuseColor()

setDiffuseColor

void setDiffuseColor(java.awt.Color c)

getTubeDraw

java.lang.Boolean getTubeDraw()

setTubeDraw

void setTubeDraw(java.lang.Boolean b)

getTubeRadius

java.lang.Double getTubeRadius()

setTubeRadius

void setTubeRadius(java.lang.Double d)

getTubeStyle

FrameFieldType getTubeStyle()

setTubeStyle

void setTubeStyle(FrameFieldType i)

getCrossSection

double[][] getCrossSection()

setCrossSection

void setCrossSection(double[][] crossSection)

setRadiiWorldCoordinates

void setRadiiWorldCoordinates(java.lang.Boolean b)

getRadiiWorldCoordinates

java.lang.Boolean getRadiiWorldCoordinates()

getLineWidth

java.lang.Double getLineWidth()

setLineWidth

void setLineWidth(java.lang.Double d)

getLineStipple

java.lang.Boolean getLineStipple()

setLineStipple

void setLineStipple(java.lang.Boolean b)

getLineStipplePattern

java.lang.Integer getLineStipplePattern()

setLineStipplePattern

void setLineStipplePattern(java.lang.Integer i)

getLineFactor

java.lang.Integer getLineFactor()

setLineFactor

void setLineFactor(java.lang.Integer i)

getVertexColors

java.lang.Boolean getVertexColors()

setVertexColors

void setVertexColors(java.lang.Boolean b)

getLineLighting

java.lang.Boolean getLineLighting(java.lang.Boolean b)

setLineLighting

void setLineLighting(java.lang.Boolean b)

getPolygonShader

PolygonShader getPolygonShader()

createPolygonShader

PolygonShader createPolygonShader(java.lang.String shaderName)

getTextShader

TextShader getTextShader()

createTextShader

TextShader createTextShader(java.lang.String name)