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 (setLineLineStipplePattern(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} always draws tubes; the specification of the tube radius is in world coordinates. On the other hand, the JOGL backend de.jreality.jogl 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.

If the underlying geometry has vertex colors and/or edge colors attached to it, then the diffuse color is determined as follows: if isSmoothLineShading() 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 Object CREATE_DEFAULT
           
static Color DIFFUSE_COLOR_DEFAULT
           
static int LINE_FACTOR_DEFAULT
           
static boolean LINE_STIPPLE_DEFAULT
           
static int LINE_STIPPLE_PATTERN_DEFAULT
           
static double LINE_WIDTH_DEFAULT
           
static boolean SMOOTH_LINE_SHADING_DEFAULT
           
static boolean TUBE_DRAW_DEFAULT
           
static double TUBE_RADIUS_DEFAULT
           
static FrameFieldType TUBE_STYLE_DEFAULT
           
 
Fields inherited from interface de.jreality.shader.LineShader
DEFAULT_ENTITY
 
Method Summary
 PolygonShader createPolygonShader(String shaderName)
           
 TextShader createTextShader(String name)
           
 Color getDiffuseColor()
           
 Integer getLineFactor()
           
 Boolean getLineStipple()
           
 Integer getLineStipplePattern()
           
 Double getLineWidth()
           
 PolygonShader getPolygonShader()
           
 TextShader getTextShader()
           
 Boolean getTubeDraw()
           
 Double getTubeRadius()
           
 FrameFieldType getTubeStyle()
           
 Boolean isSmoothLineShading()
           
 void setDiffuseColor(Color c)
           
 void setLineLineFactor(Integer i)
           
 void setLineLineStipple(Boolean b)
           
 void setLineLineStipplePattern(Integer i)
           
 void setLineWidth(Double d)
           
 void setSmoothLineShading(Boolean d)
           
 void setTubeDraw(Boolean b)
           
 void setTubeRadius(Double d)
           
 void setTubeStyle(FrameFieldType i)
           
 

Field Detail

CREATE_DEFAULT

static final 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

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 Color DIFFUSE_COLOR_DEFAULT
Method Detail

getTubeDraw

Boolean getTubeDraw()

setTubeDraw

void setTubeDraw(Boolean b)

getTubeRadius

Double getTubeRadius()

setTubeRadius

void setTubeRadius(Double d)

getTubeStyle

FrameFieldType getTubeStyle()

setTubeStyle

void setTubeStyle(FrameFieldType i)

getLineWidth

Double getLineWidth()

setLineWidth

void setLineWidth(Double d)

getLineStipple

Boolean getLineStipple()

setLineLineStipple

void setLineLineStipple(Boolean b)

getLineStipplePattern

Integer getLineStipplePattern()

setLineLineStipplePattern

void setLineLineStipplePattern(Integer i)

getLineFactor

Integer getLineFactor()

setLineLineFactor

void setLineLineFactor(Integer i)

isSmoothLineShading

Boolean isSmoothLineShading()

setSmoothLineShading

void setSmoothLineShading(Boolean d)

getDiffuseColor

Color getDiffuseColor()

setDiffuseColor

void setDiffuseColor(Color c)

getPolygonShader

PolygonShader getPolygonShader()

createPolygonShader

PolygonShader createPolygonShader(String shaderName)

getTextShader

TextShader getTextShader()

createTextShader

TextShader createTextShader(String name)