public interface DefaultLineShader extends LineShader
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.
for general remarks on these shader interfaces.
Modifier and Type | Field and Description |
---|---|
static Object |
CREATE_DEFAULT |
static double[][] |
CROSS_SECTION_DEFAULT |
static 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 |
DEFAULT_ENTITY
Modifier and Type | Method and Description |
---|---|
PolygonShader |
createPolygonShader(String shaderName) |
TextShader |
createTextShader(String name) |
double[][] |
getCrossSection() |
Color |
getDiffuseColor() |
Integer |
getLineFactor() |
Boolean |
getLineLighting(Boolean b) |
Boolean |
getLineStipple() |
Integer |
getLineStipplePattern() |
Double |
getLineWidth() |
PolygonShader |
getPolygonShader() |
Boolean |
getRadiiWorldCoordinates() |
TextShader |
getTextShader() |
Boolean |
getTubeDraw() |
Double |
getTubeRadius() |
FrameFieldType |
getTubeStyle() |
Boolean |
getVertexColors() |
void |
setCrossSection(double[][] crossSection) |
void |
setDiffuseColor(Color c) |
void |
setLineFactor(Integer i) |
void |
setLineLighting(Boolean b) |
void |
setLineStipple(Boolean b) |
void |
setLineStipplePattern(Integer i) |
void |
setLineWidth(Double d) |
void |
setRadiiWorldCoordinates(Boolean b) |
void |
setTubeDraw(Boolean b) |
void |
setTubeRadius(Double d) |
void |
setTubeStyle(FrameFieldType i) |
void |
setVertexColors(Boolean b) |
static final Object CREATE_DEFAULT
static final boolean TUBE_DRAW_DEFAULT
static final double TUBE_RADIUS_DEFAULT
static final FrameFieldType TUBE_STYLE_DEFAULT
static final boolean SMOOTH_LINE_SHADING_DEFAULT
static final double LINE_WIDTH_DEFAULT
static final boolean LINE_STIPPLE_DEFAULT
static final boolean VERTEX_COLORS_DEFAULT
static final int LINE_STIPPLE_PATTERN_DEFAULT
static final int LINE_FACTOR_DEFAULT
static final Color DIFFUSE_COLOR_DEFAULT
static final double[][] CROSS_SECTION_DEFAULT
static final boolean LIGHTING_ENABLED_DEFAULT
static final boolean RADII_WORLD_COORDINATES_DEFAULT
Color getDiffuseColor()
void setDiffuseColor(Color c)
Boolean getTubeDraw()
void setTubeDraw(Boolean b)
Double getTubeRadius()
void setTubeRadius(Double d)
FrameFieldType getTubeStyle()
void setTubeStyle(FrameFieldType i)
double[][] getCrossSection()
void setCrossSection(double[][] crossSection)
void setRadiiWorldCoordinates(Boolean b)
Boolean getRadiiWorldCoordinates()
Double getLineWidth()
void setLineWidth(Double d)
Boolean getLineStipple()
void setLineStipple(Boolean b)
Integer getLineStipplePattern()
void setLineStipplePattern(Integer i)
Integer getLineFactor()
void setLineFactor(Integer i)
Boolean getVertexColors()
void setVertexColors(Boolean b)
void setLineLighting(Boolean b)
PolygonShader getPolygonShader()
PolygonShader createPolygonShader(String shaderName)
TextShader getTextShader()
TextShader createTextShader(String name)