public interface Renderer
Modifier and Type | Interface and Description |
---|---|
static class |
Renderer.AxisDrawStyle
Specifies how coordinate axes should be drawn.
|
static class |
Renderer.ColorInterpolation
Indicates the space in which color interpolation is performed
by this Renderer.
|
static class |
Renderer.ColorMixing
Specifies how vertex coloring or textures are combined with material
coloring
|
static class |
Renderer.DrawMode
Defines various vertex-based primitives
|
static class |
Renderer.FaceStyle
When rendering triangles, specifies which sides are drawn, where
front and back correspond to the sides associated with
counter-clockwise and clockwise vertex ordering, respectively.
|
static class |
Renderer.HighlightStyle
Specifies how highlighting is performed by this renderer.
|
static class |
Renderer.LineStyle
For some drawing primitives, specifies the rendering style for line
segments.
|
static class |
Renderer.PointStyle
For some drawing primitives, specifies the rendering style for points.
|
static class |
Renderer.Shading
Specifies the current shading style.
|
Modifier and Type | Field and Description |
---|---|
static int |
HIGHLIGHT
Flag requesting that an object be rendered with highlighting.
|
static int |
SORT_FACES
Flag requesting that faces of a mesh be sorted before rendering
|
Modifier and Type | Method and Description |
---|---|
void |
addVertex(double px,
double py,
double pz)
Adds a vertex to a primitive being drawn while in draw mode.
|
void |
addVertex(float[] pnt)
Adds a vertex to a primitive being drawn while in draw mode.
|
void |
addVertex(float px,
float py,
float pz)
Adds a vertex to a primitive being drawn while in draw mode.
|
void |
addVertex(Vector3d pnt)
Adds a vertex to a primitive being drawn while in draw mode.
|
boolean |
begin2DRendering()
Puts this Renderer into 2D rendering mode, or returns
false
if 2D rendering is not supported. |
boolean |
begin2DRendering(double w,
double h)
Puts this Renderer into 2D rendering mode, or returns
false
if 2D rendering is not supported. |
void |
beginDraw(Renderer.DrawMode mode)
Begins draw mode.
|
void |
beginSelectionQuery(int qid)
Begins a selection query with the {\it query identifier}
qid . |
void |
beginSubSelection(IsSelectable s,
int qid)
Begins selection for a
IsSelectable
s that
manages its own selection; this call should
be used in place of beginSelectionQuery(int) for such objects. |
double |
centerDistancePerPixel()
Returns the displacement distance of the center point, in a plane
parallel to the view plane, that corresponds to a screen displacement of
one pixel.
|
double |
distancePerPixel(Vector3d p)
Returns the displacement distance of a point
p , in a plane
parallel to the view plane, that corresponds to a screen displacement
of one pixel. |
void |
draw(RenderObject robj)
Draws all the primitives in the first point, line and triangles groups.
|
void |
drawArrow(float[] pnt0,
float[] pnt1,
double rad,
boolean capped)
Draws a solid arrow between two points in model coordinates,
using the current shading and material.
|
void |
drawArrow(RenderProps props,
float[] pnt0,
float[] pnt1,
boolean capped,
boolean highlight)
Draws an arrow between two points in model coordinates,
using the radius, line color, and shading specified by the
render properties argument
props . |
void |
drawArrow(Vector3d pnt0,
Vector3d pnt1,
double rad,
boolean capped)
Draws a solid arrow between two points in model coordinates,
using the current shading and material.
|
void |
drawArrow(Vector3d pnt,
Vector3d dir,
double scale,
double rad,
boolean capped)
Draws a solid arrow in model coordinates, starting at
pnt and
extending along dir , with a length given by the length of dir times scale , using the current shading and material. |
void |
drawAxes(RigidTransform3d X,
double[] lens,
int width,
boolean highlight)
Draws a set of coordinate axes representing a rigid coordinate frame
X . |
void |
drawAxes(RigidTransform3d X,
double len,
int width,
boolean highlight)
Draws a set of coordinate axes representing a rigid coordinate frame
X . |
void |
drawAxes(RigidTransform3d X,
Renderer.AxisDrawStyle style,
double[] lens,
int width,
double rad,
boolean highlight)
Draws a solid set of coordinate axes representing a rigid coordinate
frame
X . |
void |
drawAxes(RigidTransform3d X,
Renderer.AxisDrawStyle style,
double len,
int width,
double rad,
boolean highlight)
Draws a solid set of coordinate axes representing a rigid coordinate
frame
X . |
void |
drawBox(float[] pnt,
double wx,
double wy,
double wz)
Draws an axis-aligned box in model coordinates, using the current
shading and material.
|
void |
drawBox(RigidTransform3d TBM,
Vector3d widths)
Draws a box centered on the specified transform in model coordinates,
using the current shading and material.
|
void |
drawBox(Vector3d pnt,
Vector3d widths)
Draws an axis-aligned box in model coordinates, using the current
shading and material.
|
void |
drawCone(float[] pnt0,
float[] pnt1,
double rad0,
double rad1,
boolean capped)
Draws a cone between two points in model coordinates,
using the current shading and material.
|
void |
drawCone(Vector3d pnt0,
Vector3d pnt1,
double rad0,
double rad1,
boolean capped)
Draws a cone between two points in model coordinates,
using the current shading and material.
|
void |
drawCube(float[] pnt,
double w)
Draws an axis-aligned cube with a specified width centered at a point
in model coordinates, using the current shading and material.
|
void |
drawCube(Vector3d pnt,
double w)
Draws an axis-aligned cube with a specified width centered at a point
in model coordinates, using the current shading and material.
|
void |
drawCylinder(float[] pnt0,
float[] pnt1,
double rad,
boolean capped)
Draws a cylinder between two points in model coordinates,
using the current shading and material.
|
void |
drawCylinder(Vector3d pnt0,
Vector3d pnt1,
double rad,
boolean capped)
Draws a cylinder between two points in model coordinates,
using the current shading and material.
|
void |
drawLine(double px0,
double py0,
double pz0,
double px1,
double py1,
double pz1)
Draws a single line between two points in model coordinates,
using the current line width, material, and shading.
|
void |
drawLine(float[] pnt0,
float[] pnt1)
Draws a single line between two points in model coordinates,
using the current line width, material, and shading.
|
void |
drawLine(RenderProps props,
float[] pnt0,
float[] pnt1,
boolean highlight)
Draws a single line between two points in model coordinates, using the
line style, radius, line color, and shading specified by the render
properties argument
props . |
void |
drawLine(RenderProps props,
float[] pnt0,
float[] pnt1,
boolean capped,
boolean highlight)
Draws a single line between two points in model coordinates, using the
line style, radius, line color, and shading specified by the render
properties argument
props . |
void |
drawLine(RenderProps props,
float[] pnt0,
float[] pnt1,
float[] color,
boolean capped,
boolean highlight)
Draws a single line between two points in model coordinates, using the
line style, radius, line color, and shading specified by the render
properties argument
props . |
void |
drawLine(RenderProps props,
Vector3d pnt0,
Vector3d pnt1,
boolean highlight)
Draws a single line between two points in model coordinates,
using the line style, radius, line color, and shading specified by the
render properties argument
props . |
void |
drawLine(Vector3d pnt0,
Vector3d pnt1)
Draws a single line between two points in model coordinates,
using the current line width, material, and shading.
|
void |
drawLines(RenderObject robj)
Draws all the lines in the first line group of the
specified render object, using the current material and shading.
|
void |
drawLines(RenderObject robj,
int gidx)
Draws all the lines in the specified line group of the
render object, using the current material and shading.
|
void |
drawLines(RenderObject robj,
int gidx,
int offset,
int count,
Renderer.LineStyle style,
double rad)
Draws a selection of lines in the specified line group of the supplied
render object, using the current material and shading.
|
void |
drawLines(RenderObject robj,
int gidx,
Renderer.LineStyle style,
double rad)
Draws all the lines in the specified line group of the supplied
render object, using the current material and shading.
|
void |
drawLines(RenderObject robj,
int gidx,
RenderInstances rinst)
Draws the specified group of lines, repeated for each instance
in rinst.
|
void |
drawLines(RenderObject robj,
Renderer.LineStyle style,
double rad)
Draws all the lines in the first line group of the specified
render object, using the current material and shading.
|
void |
drawLineStrip(RenderProps props,
java.lang.Iterable<float[]> pnts,
Renderer.LineStyle style,
boolean highlight)
Draws a line strip between a series of points in model coordinates,
using the radius, line color, and shading specified by the
render properties argument
props , and the line
style specified by style . |
void |
drawPoint(double px,
double py,
double pz)
Draws a single point located at
px , py and
pz in model coordinates, using the current point size,
material, and shading. |
void |
drawPoint(float[] pnt)
Draws a single point located at
pnt in model coordinates,
using the current point size, material, and shading. |
void |
drawPoint(RenderProps props,
float[] pnt,
boolean highlight)
Draws a single point located at
pnt in model coordinates,
using the point style, size, point color, and shading specified by the
render properties argument props . |
void |
drawPoint(RenderProps props,
Vector3d pnt,
boolean highlight)
Draws a single point located at
pnt in model coordinates,
using the point style, size, point color, and shading specified by the
render properties argument props . |
void |
drawPoint(Vector3d pnt)
Draws a single point located at
pnt in model coordinates,
using the current point size, material, and shading. |
void |
drawPoints(RenderObject robj)
Draws all the points in the first point group of the
specified render object, using the current material and shading.
|
void |
drawPoints(RenderObject robj,
int gidx)
Draws all the points in the specified point group of the
supplied render object, using the current material and shading.
|
void |
drawPoints(RenderObject robj,
int gidx,
int offset,
int count,
Renderer.PointStyle style,
double rad)
Draws a selection of points in the specified point group of the supplied
render object, using the current material and shading.
|
void |
drawPoints(RenderObject robj,
int gidx,
Renderer.PointStyle style,
double rad)
Draws all the points in the specified point group of the supplied
render object, using the current material and shading.
|
void |
drawPoints(RenderObject robj,
int gidx,
RenderInstances rinst)
Draws the specified group of points, repeated for each instance
in rinst.
|
void |
drawPoints(RenderObject robj,
Renderer.PointStyle style,
double rad)
Draws all the points in the first point group of the specified
render object, using the current material and shading.
|
void |
drawRay(RenderProps props,
Vector3d pnt,
Vector3d dir,
double scale,
boolean highlight)
Draws a ray from an origin point along a specified direction, in model
coordinates, using the line style, radius, line color, and shading
specified by the render properties argument
props . |
void |
drawSolidAxes(RigidTransform3d X,
double[] lens,
double rad,
boolean highlight)
Draws a solid set of coordinate axes representing a rigid coordinate
frame
X . |
void |
drawSolidAxes(RigidTransform3d X,
double len,
double rad,
boolean highlight)
Draws a solid set of coordinate axes representing a rigid coordinate
frame
X . |
void |
drawSphere(float[] pnt,
double rad)
Draws a sphere with a specified radius centered at a point
in model coordinates, using the current shading and material.
|
void |
drawSphere(Vector3d pnt,
double rad)
Draws a sphere with a specified radius centered at a point
in model coordinates, using the current shading and material.
|
void |
drawSpindle(float[] pnt0,
float[] pnt1,
double rad)
Draws a spindle between two points in model coordinates,
using the current shading and material.
|
void |
drawSpindle(Vector3d pnt0,
Vector3d pnt1,
double rad)
Draws a spindle between two points in model coordinates,
using the current shading and material.
|
double |
drawText(java.awt.Font font,
java.lang.String str,
float[] pos,
double emSize)
Draws text in the x-y plane in model coordinates.
|
double |
drawText(java.awt.Font font,
java.lang.String str,
Vector3d pos,
double emSize)
Draws text in the x-y plane in model coordinates.
|
double |
drawText(java.lang.String str,
float[] pos,
double emSize)
Draws text in the x-y plane in model coordinates.
|
double |
drawText(java.lang.String str,
Vector3d pos,
double emSize)
Draws text in the x-y plane in model coordinates.
|
void |
drawTriangle(float[] pnt0,
float[] pnt1,
float[] pnt2)
Draws a single triangular face specified by three points, using the
current shading, lighting and material.
|
void |
drawTriangle(Vector3d pnt0,
Vector3d pnt1,
Vector3d pnt2)
Draws a single triangular face specified by three points, using the
current shading, lighting and material.
|
void |
drawTriangles(RenderObject robj)
Draws all the triangles in the first triangle group of the
specified render object, using the current material and shading.
|
void |
drawTriangles(RenderObject robj,
int gidx)
Draws all the triangles in the specified triangle group of the
render object, using the current material and shading.
|
void |
drawTriangles(RenderObject robj,
int gidx,
int offset,
int count)
Draws a selection of triangles in the specified triangle group of the
render object, using the current material and shading.
|
void |
drawTriangles(RenderObject robj,
int gidx,
RenderInstances rinst)
Draws the specified group of triangles, repeated for each instance
in rinst.
|
void |
drawVertices(RenderObject robj,
Renderer.DrawMode mode)
Draws all the vertices associated with the specified RenderObject,
using a specified drawing mode and the current material and shading.
|
void |
drawVertices(RenderObject robj,
VertexIndexArray idxs,
int offset,
int count,
Renderer.DrawMode mode)
Draws a selection of vertices associated with the specified RenderObject,
using a specified drawing mode and the current material and shading.
|
void |
drawVertices(RenderObject robj,
VertexIndexArray idxs,
Renderer.DrawMode mode)
Draws a selection of vertices associated with the specified RenderObject,
using a specified drawing mode and the current material and shading.
|
void |
end2DRendering()
Take this Renderer out of 2D rendering mode, by reenabling the depth
buffer and restoring the model and projection matrices to the values they
had when 2D rendering mode was first entered.
|
void |
endDraw()
Ends draw mode.
|
void |
endSelectionQuery()
Ends a selection query that was initiated with a call to
beginSelectionQuery(int) . |
void |
endSubSelection()
Ends object sub-selection that was initiated with a call
to
beginSubSelection(maspack.render.IsSelectable, int) . |
double |
getAxisRadiusRatio()
Returns the axis radius ratio.
|
float[] |
getBackColor(float[] rgba)
Returns the RGB or RGBA values for the back color as a float array,
or
null if no back color is set. |
BumpMapProps |
getBumpMap()
Returns the most recently set bump mapping properties, or
null if no bump mapping has been set or bump mapping
is not supported. |
Point3d |
getCenter()
Returns the current center point
|
Renderer.ColorInterpolation |
getColorInterpolation()
Returns the color interpolation currently being used by this Renderer.
|
ColorMapProps |
getColorMap()
Returns the properties for the most recently set color map, or
null if no color map is currently set or color mapping
is not supported. |
java.awt.Font |
getDefaultFont()
Retrieves the default font.
|
int |
getDepthOffset()
The current depth offset level.
|
float[] |
getEmission(float[] rgb)
Returns the RGB values for the emission color as a float array.
|
Vector3d |
getEyeZDirection()
Gives the direction, in world coordinates, of a vector that
is perpendicular to the screen and points towards the viewer.
|
Renderer.FaceStyle |
getFaceStyle()
Returns the current mode for rendering faces.
|
double |
getFarPlaneDistance()
Returns the distance, in model coordinates, from the eye to the far clip
plane.
|
float[] |
getFrontColor(float[] rgba)
Returns the RGB or RGBA values for the front color as a float array.
|
void |
getHighlightColor(float[] rgba)
Returns the color that is used to highlight objects when
the highlighting method is
Renderer.HighlightStyle.COLOR . |
boolean |
getHighlighting()
Queries whether or not highlighting is enabled.
|
Renderer.HighlightStyle |
getHighlightStyle()
Returns the highlight style used by this renderer.
|
float |
getLineWidth()
Returns the current width for rendering lines, in pixels.
|
AffineTransform3dBase |
getModelMatrix()
Gets the current model matrix.
|
void |
getModelMatrix(AffineTransform3d X)
Gets the current model matrix.
|
NormalMapProps |
getNormalMap()
Returns the most recently set normal mapping properties, or
null if no normal mapping has been set or normal mapping
is not supported. |
float |
getPointSize()
Returns the current size for rendering points, in pixels.
|
int |
getScreenHeight()
Returns the screen height, in pixels
|
int |
getScreenWidth()
Returns the screen width, in pixels
|
Renderer.Shading |
getShading()
Returns the current shading model used by this renderer.
|
float |
getShininess()
Returns the current shininess parameter.
|
float[] |
getSpecular(float[] rgb)
Returns the RGB values for the specular color as a float array.
|
int |
getSurfaceResolution()
Returns the resolution used for creating mesh representations
of curved solids.
|
java.awt.geom.Rectangle2D |
getTextBounds(java.awt.Font font,
java.lang.String str,
double emSize)
Computes and returns the logical bounding box of the supplied
text.
|
AffineTransform2dBase |
getTextureMatrix()
Gets the current texture matrix.
|
void |
getTextureMatrix(AffineTransform2d X)
Gets the current texture matrix.
|
Renderer.ColorMixing |
getVertexColorMixing()
Returns the method used for combining vertex coloring and material
coloring.
|
RigidTransform3d |
getViewMatrix()
Gets the current view matrix.
|
void |
getViewMatrix(RigidTransform3d TWE)
Gets the current view matrix.
|
double |
getViewPlaneDistance()
Returns the distance, in model coordinates, from the eye to view plane
(which corresponds to the far clip plane).
|
double |
getViewPlaneHeight()
Returns the height of the view plane, in model coordinates.
|
double |
getViewPlaneWidth()
Returns the width of the view plane, in model coordinates.
|
boolean |
has2DRendering()
Returns
true if this Renderer supports 2D rendering mode. |
boolean |
hasBumpMapping()
Queries whether or not this renderer supports bump mapping.
|
boolean |
hasColorMapMixing(Renderer.ColorMixing cmix)
Queries whether or not a specified method for combining color
map and material coloring is supported by this Renderer.
|
boolean |
hasColorMapping()
Queries whether or not this renderer supports color mapping.
|
boolean |
hasNormalMapping()
Queries whether or not this renderer supports normal mapping.
|
boolean |
hasSelection()
Queries whether or not this Renderer supports selection.
|
boolean |
hasTextRendering()
Queries whether or not this renderer supports text rendering.
|
boolean |
hasVertexColorMixing(Renderer.ColorMixing cmix)
Queries whether or not a specified method for combining vertex coloring
and material coloring is supported by this Renderer.
|
boolean |
is2DRendering()
Check whether the Renderer is currently in 2D rendering mode.
|
boolean |
isOrthogonal()
Returns
true if this renderer is currently configured for
orthogonal projection. |
boolean |
isSelectable(IsSelectable s)
Returns true if
s is selectable in the current selection
context. |
boolean |
isSelecting()
Returns true if the renderer is currently performing a selection
render.
|
void |
mulModelMatrix(AffineTransform3dBase X)
Post-multiplies the model matrix by the specified transform X,
which may be either a
RigidTransform3d or an
AffineTransform3d . |
boolean |
popModelMatrix()
Restores the model matrix by popping it off the model matrix stack
|
void |
pushModelMatrix()
Saves the model matrix by pushing it onto the model matrix stack.
|
void |
restoreDefaultState(boolean strictChecking)
Restores the renderer to its default state.
|
void |
rotateModelMatrix(double zdeg,
double ydeg,
double xdeg)
Rotates the model frame.
|
void |
scaleModelMatrix(double s)
Scales the current model matrix.
|
void |
setAxisRadiusRatio(double ratio)
Sets a ratio which can be used to determine the radius for an axis when
the radius is not explicitly specified.
|
void |
setBackColor(float[] rgba)
Optionally sets the diffuse and ambient colors used for the subsequent
rendering of the back faces of triangles.
|
BumpMapProps |
setBumpMap(BumpMapProps props)
If bump mapping is supported, sets up bump mapping according
to the properties specified by
props , or removes
bump mapping if props is null . |
void |
setColor(java.awt.Color color)
Sets the diffuse and ambient colors to be used for subsequent rendering
of primitives.
|
void |
setColor(float[] rgba)
Sets the diffuse and ambient colors to the value specified by
rgba . |
void |
setColor(float[] rgba,
boolean highlight)
Sets the diffuse and ambient colors to the value specified by
rgba , and enables or disables highlighting
according to the value of highlight . |
void |
setColor(float r,
float g,
float b)
Sets the diffuse and ambient colors to be used for subsequent rendering
of primitives.
|
void |
setColor(float r,
float g,
float b,
float a)
Sets the diffuse and ambient colors to be used for subsequent rendering
of primitives.
|
Renderer.ColorInterpolation |
setColorInterpolation(Renderer.ColorInterpolation interp)
Sets the color interpolation to be used by this renderer.
|
ColorMapProps |
setColorMap(ColorMapProps props)
If color mapping is supported, sets up a color map according
to the properties specified by
props , or removes
any color map if props is null . |
void |
setDefaultFont(java.awt.Font font)
Sets default font for text rendering
|
void |
setDepthOffset(int offset)
Set a depth offset for the projection matrix.
|
void |
setEdgeColoring(RenderProps props,
boolean highlight)
Sets the diffuse and ambient colors to the edge color in
props , and enables or disables highlighting
according to the value of highlight . |
void |
setEmission(float[] rgb)
Sets the emission color to be used for subsequent rendering
of primitives.
|
void |
setFaceColoring(RenderProps props,
boolean highlight)
Sets the diffuse and ambient colors to the face color in
props , and enables or disables highlighting
according to the value of highlight . |
void |
setFaceColoring(RenderProps props,
float[] rgba,
boolean highlight)
Sets the diffuse and ambient colors to
rgba , and enables or
disables highlighting according to the value of
highlight . |
Renderer.FaceStyle |
setFaceStyle(Renderer.FaceStyle style)
Sets the style for rendering faces.
|
void |
setFrontAlpha(float a)
Sets the alpha value for the front material.
|
void |
setFrontColor(float[] rgba)
Sets the diffuse and ambient colors to be used for subsequent rendering
of primitives.
|
boolean |
setHighlighting(boolean enable)
Enables or disables highlighting.
|
void |
setLineColoring(RenderProps props,
boolean highlight)
Sets the diffuse and ambient colors to the line color in
props , and enables or disables highlighting
according to the value of highlight . |
Renderer.Shading |
setLineShading(RenderProps props)
Sets the shading appropriate to the line style specified in
props . |
void |
setLineWidth(float width)
Sets the width for rendering lines, in pixels.
|
void |
setModelMatrix(AffineTransform3dBase X)
Sets the model matrix to the specified transform.
|
void |
setModelMatrix2d(double left,
double right,
double bottom,
double top)
Sets the model matrix to perform scaling and translation in the
x-y plane so that the model coordinates (left,bottom) and
(right,top) map onto (-1,1) and (1,1) in world coordinates.
|
void |
setNormal(double nx,
double ny,
double nz)
Sets the normal to be associated with the next vertex to be
added while in draw mode.
|
void |
setNormal(float nx,
float ny,
float nz)
Sets the normal to be associated with the next vertex to be
added while in draw mode.
|
void |
setNormal(Vector3d nrm)
Sets the normal to be associated with the next vertex to be
added while in draw mode.
|
NormalMapProps |
setNormalMap(NormalMapProps props)
If normal mapping is supported, sets up a normal map according
to the properties specified by
props , or removes
normal mapping if props is null . |
void |
setPointColoring(RenderProps props,
boolean highlight)
Sets the diffuse and ambient colors to the point color in
props , and enables or disables highlighting
according to the value of highlight . |
Renderer.Shading |
setPointShading(RenderProps props)
Sets the shading appropriate to the point style specified in
props . |
void |
setPointSize(float size)
Sets the size for rendering points, in pixels.
|
void |
setPropsColoring(RenderProps props,
float[] rgba,
boolean highlight)
Sets the diffuse and ambient colors to
rgba , and enables or
disables highlighting according to the value of
highlight . |
Renderer.Shading |
setPropsShading(RenderProps props)
Sets the shading to that shading specified by
props.getShading() . |
Renderer.Shading |
setShading(Renderer.Shading shading)
Sets the shading model used by this renderer.
|
void |
setShininess(float s)
Sets the shininess parameter to be used for subsequent rendering
of primitives (see
getShininess() . |
void |
setSpecular(float[] rgb)
Sets the specular color to be used for subsequent rendering
of primitives.
|
int |
setSurfaceResolution(int nsegs)
Sets the resolution used for creating mesh representations
of curved solids.
|
void |
setTextureCoord(double tx,
double ty)
Sets the texture coordinate to be associated with the next vertex to be
added while in draw mode.
|
void |
setTextureCoord(float tx,
float ty)
Sets the texture coordinate to be associated with the next vertex to be
added while in draw mode.
|
void |
setTextureCoord(Vector2d tex)
Sets the texture coordinate to be associated with the next vertex to be
added while in draw mode.
|
void |
setTextureMatrix(AffineTransform2dBase T)
Sets the texture coordinate transformation matrix to the specified
transform.
|
Renderer.ColorMixing |
setVertexColorMixing(Renderer.ColorMixing cmix)
Sets the method used for combining vertex coloring and material coloring.
|
void |
translateModelMatrix(double tx,
double ty,
double tz)
Translates the model frame.
|
static final int HIGHLIGHT
static final int SORT_FACES
int getScreenHeight()
int getScreenWidth()
double getViewPlaneHeight()
double getViewPlaneWidth()
double centerDistancePerPixel()
Point3d getCenter()
double distancePerPixel(Vector3d p)
p
, in a plane
parallel to the view plane, that corresponds to a screen displacement
of one pixel. Both p
and the displacement are given with
respect to model coordinates.p
- point undergoing the displacementboolean isOrthogonal()
true
if this renderer is currently configured for
orthogonal projection.true
if projection is orthogonaldouble getViewPlaneDistance()
getFarPlaneDistance()
double getFarPlaneDistance()
getViewPlaneDistance()
float getPointSize()
setPointSize(float)
void setPointSize(float size)
size
- new point size (in pixels).getPointSize()
float getLineWidth()
setLineWidth(float)
void setLineWidth(float width)
width
- new line width (in pixels).getLineWidth()
Renderer.FaceStyle getFaceStyle()
setFaceStyle(maspack.render.Renderer.FaceStyle)
Renderer.FaceStyle setFaceStyle(Renderer.FaceStyle style)
Renderer.FaceStyle.FRONT
.style
- new face stylegetFaceStyle()
Renderer.ColorInterpolation getColorInterpolation()
Renderer.ColorInterpolation setColorInterpolation(Renderer.ColorInterpolation interp)
Renderer.ColorInterpolation.RGB
, but
Renderer.ColorInterpolation.HSV
is often more appropriate for
displaying information that is purely color-based.interp
- new color interpolation modeboolean hasVertexColorMixing(Renderer.ColorMixing cmix)
true
if the color mixing method is supportedRenderer.ColorMixing getVertexColorMixing()
Renderer.ColorMixing setVertexColorMixing(Renderer.ColorMixing cmix)
hasVertexColorMixing(maspack.render.Renderer.ColorMixing)
to test whether a method is suuported.cmix
- new color mixing methodRenderer.Shading getShading()
Renderer.Shading.NONE
turns off lighting and causes primitives to be
rendered in solid colors, using the current diffuse color.Renderer.Shading setShading(Renderer.Shading shading)
Renderer.Shading.FLAT
, in which one normal is used per primitive. A shading
model of Renderer.Shading.NONE
turns off lighting and causes primitives to
be rendered in solid colors, using the current diffuse color.shading
- new shading model to be useddouble getAxisRadiusRatio()
setAxisRadiusRatio(double)
for
more information.void setAxisRadiusRatio(double ratio)
ratio
- new axis render ratiovoid drawPoint(Vector3d pnt)
pnt
in model coordinates,
using the current point size, material, and shading. Since no normal is
specified, this method should generally be called with either lighting
disabled or with shading set to Renderer.Shading.NONE
.pnt
- location of the pointvoid drawPoint(double px, double py, double pz)
px
, py
and
pz
in model coordinates, using the current point size,
material, and shading. This method is functionally equivalent to
drawPoint(Vector3d)
.px
- x coordinate of the pointpy
- y coordinate of the pointpz
- z coordinate of the pointvoid drawPoint(float[] pnt)
pnt
in model coordinates,
using the current point size, material, and shading. This method
is functionally equivalent to drawPoint(Vector3d)
.pnt
- array (of length 3) giving the point to drawvoid drawLine(Vector3d pnt0, Vector3d pnt1)
Renderer.Shading.NONE
.pnt0
- first pointpnt1
- second pointvoid drawLine(double px0, double py0, double pz0, double px1, double py1, double pz1)
drawLine(Vector3d,Vector3d)
.px0
- x coordinate of first pointpy0
- y coordinate of first pointpz0
- z coordinate of first pointpx1
- x coordinate of second pointpy1
- y coordinate of second pointpz1
- z coordinate of second pointvoid drawLine(float[] pnt0, float[] pnt1)
drawLine(Vector3d,Vector3d)
.pnt0
- array (of length 3) giving the first pointpnt1
- array (of length 3) giving the second pointvoid drawTriangle(Vector3d pnt0, Vector3d pnt1, Vector3d pnt2)
Renderer.Shading.NONE
, the shading will be effectively flat.pnt0
- first pointpnt1
- second pointpnt2
- third pointvoid drawTriangle(float[] pnt0, float[] pnt1, float[] pnt2)
drawTriangle(Vector3d,Vector3d,Vector3d)
.pnt0
- first pointpnt1
- second pointpnt2
- third pointint getSurfaceResolution()
setSurfaceResolution(int)
int setSurfaceResolution(int nsegs)
nsegs
- resolution for curved surfacesvoid drawSphere(Vector3d pnt, double rad)
getSurfaceResolution()
.pnt
- center of the sphererad
- radius of the spherevoid drawSphere(float[] pnt, double rad)
drawSphere(Vector3d,double)
.pnt
- center of the sphererad
- radius of the spherevoid drawCube(Vector3d pnt, double w)
pnt
- center of the cubew
- width of the cubevoid drawCube(float[] pnt, double w)
pnt
- center of the cubew
- width of the cubevoid drawBox(float[] pnt, double wx, double wy, double wz)
pnt
- center of the boxwx
- width in xwy
- width in ywz
- width in zvoid drawBox(Vector3d pnt, Vector3d widths)
pnt
- center of the boxwidths
- x,y,z widths of the boxvoid drawBox(RigidTransform3d TBM, Vector3d widths)
TBM
- transform from box to model coordinates on which
the box is centeredwidths
- x,y,z widths of the boxvoid drawSpindle(Vector3d pnt0, Vector3d pnt1, double rad)
getSurfaceResolution()
.pnt0
- first end pointpnt1
- second end pointrad
- radius of the spindlevoid drawSpindle(float[] pnt0, float[] pnt1, double rad)
getSurfaceResolution()
.pnt0
- first end pointpnt1
- second end pointrad
- radius of the spindlevoid drawCylinder(Vector3d pnt0, Vector3d pnt1, double rad, boolean capped)
getSurfaceResolution()
.pnt0
- first end pointpnt1
- second end pointrad
- radius of the cylindercapped
- if true
, indicates that the cylinder
should have a solid cap on each endvoid drawCylinder(float[] pnt0, float[] pnt1, double rad, boolean capped)
getSurfaceResolution()
.pnt0
- first end pointpnt1
- second end pointrad
- radius of the cylindercapped
- if true
, indicates that the cylinder
should have a solid cap on each endvoid drawCone(Vector3d pnt0, Vector3d pnt1, double rad0, double rad1, boolean capped)
getSurfaceResolution()
.pnt0
- first end pointpnt1
- second end pointrad0
- radius at first end pointrad1
- radius at second end pointcapped
- if true
, indicates that the cone
should have a solid cap on each endvoid drawCone(float[] pnt0, float[] pnt1, double rad0, double rad1, boolean capped)
getSurfaceResolution()
.pnt0
- first end pointpnt1
- second end pointrad0
- radius at first end pointrad1
- radius at second end pointcapped
- if true
, indicates that the cone
should have a solid cap on each endvoid drawArrow(Vector3d pnt0, Vector3d pnt1, double rad, boolean capped)
rad
, topped with a conical arrow
head pointing towards the second end point. The arrow head has
a base radius of 3*rad
and length given by
min (6*rad, len/2)
wherelen
is the distance between the two end points.
The resolution is specified by getSurfaceResolution()
.pnt0
- first end pointpnt1
- second end pointrad
- radius of the cylindercapped
- if true
, indicates that the arrow
should have a solid cap on the bottomvoid drawArrow(Vector3d pnt, Vector3d dir, double scale, double rad, boolean capped)
pnt
and
extending along dir
, with a length given by the length of dir
times scale
, using the current shading and material. The
arrow is rendered as described for drawArrow(Vector3d,Vector3d,double,boolean)
.pnt
- starting pointdir
- directionscale
- scale factor for dir
rad
- radius of the cylindercapped
- if true
, indicates that the arrow
should have a solid cap on the bottomvoid drawArrow(float[] pnt0, float[] pnt1, double rad, boolean capped)
drawArrow(Vector3d,Vector3d,double,boolean)
except that the points are specified using float[]
.pnt0
- first end pointpnt1
- second end pointrad
- radius of the cylindercapped
- if true
, indicates that the arrow
should have a solid cap on the bottomvoid drawAxes(RigidTransform3d X, Renderer.AxisDrawStyle style, double len, int width, double rad, boolean highlight)
X
. The origin point for the axes is X.p
,
and the directions for each axis are given by the three columns of
X.R
. The manner in which the axes are rendered is specified
by style
, which is an instance of Renderer.AxisDrawStyle
. By
default, the x, y, and z axes are drawn using the colors red, green, and
blue, unless highlight
is true
and the
highlight style is Renderer.HighlightStyle.COLOR
, in which case all axes
are drawn using the renderer's highlight color.X
- coordinate frame defining the axesstyle
- manner in which the axes should be rendered (e.g.,
pixel-based lines or solid arrows)len
- length of the axeswidth
- for pixel-based rendering, specifies the line width in
pixelsrad
- if >
0, specifies the radius of each axis when using
solid rendering. Otherwise, the radius is determined by multiplying the
axis length by the ratio returned by getAxisRadiusRatio()
.highlight
- if true
, indicates that the axes should be
highlighted.void drawAxes(RigidTransform3d X, Renderer.AxisDrawStyle style, double[] lens, int width, double rad, boolean highlight)
X
. This method is identical to
drawAxes(RigidTransform3d,AxisDrawStyle,double,int,double,boolean)
,
except that the length of each axis can be specified separately.X
- coordinate frame defining the axesstyle
- manner in which the axes should be rendered (e.g.,
pixel-based lines or solid arrows)lens
- lengths of each axiswidth
- for pixel-based rendering, specifies the line width in
pixelsrad
- if >
0, specifies the radius of each axis when using
solid rendering. Otherwise, the radius is determined by multiplying the
maximum axis length by the ratio returned by getAxisRadiusRatio()
.highlight
- if true
, indicates that the axes should be
highlighted.void drawAxes(RigidTransform3d X, double len, int width, boolean highlight)
X
. The origin point for the axes is X.p
, and
the directions for each axis are given by the three columns of
X.R
. Each axis is drawn as a pixel-based line with a length
len
and a width width
. By default, the x, y,
and z axes are drawn using the colors red, green, and blue, unless
highlight
is true
and the highlight style is
Renderer.HighlightStyle.COLOR
, in which case all axes are drawn using the
renderer's highlight color.X
- coordinate frame defining the axeslen
- axis lengthwidth
- width of each axis (in pixels)highlight
- if true
, indicates that the axes should be
highlighted.void drawAxes(RigidTransform3d X, double[] lens, int width, boolean highlight)
X
. This method is functionally equivalent to drawAxes(RigidTransform3d,double,int,boolean)
, except that the
lengths for each axis are individually specified. Axes with a
a specified length of 0 will not be drawn.X
- coordinate frame defining the axeslens
- lengths for each axiswidth
- width of each axis (in pixels)highlight
- if true
, indicates that the axes should be
highlighted.void drawSolidAxes(RigidTransform3d X, double len, double rad, boolean highlight)
X
. The origin point for the axes is X.p
,
and the directions for each axis are given by the three columns of
X.R
. Each axis is drawn an arrow-tipped cylinder with a
length len
and cylinder radius rad
. By default,
the x, y, and z axes are drawn using the colors red, green, and blue,
unless highlight
is true
and the highlight
style is Renderer.HighlightStyle.COLOR
, in which case all axes are drawn
using the renderer's highlight color.X
- coordinate frame defining the axeslen
- axis lengthrad
- axis cylinder radius. If , the radius is determined
automatically using the value returned by getAxisRadiusRatio()
.highlight
- if true
, indicates that the axes should be
highlighted.void drawSolidAxes(RigidTransform3d X, double[] lens, double rad, boolean highlight)
X
. This method is functionally equivalent to drawSolidAxes(RigidTransform3d,double,double,boolean)
, except that the
lengths for each axis are individually specified. Axes with a
a specified length of 0 will not be drawn.X
- coordinate frame defining the axeslens
- lengths for each axisrad
- axis cylinder radius. If , the radius is determined
automatically using the value returned by getAxisRadiusRatio()
.highlight
- if true
, indicates that the axes should be
highlighted.void drawPoint(RenderProps props, Vector3d pnt, boolean highlight)
pnt
in model coordinates,
using the point style, size, point color, and shading specified by the
render properties argument props
.
If props.getPointStyle()
specifies a point style of Renderer.PointStyle.POINT
, then the
point is drawn as a pixel-based point with a size given by
props.getPointSize()
. Otherwise, if the point style
is Renderer.PointStyle.CUBE
or Renderer.PointStyle.SPHERE
, then the
point is drawn as a solid with a radius given by
props.getPointRadius()
. If highlight
is true
and the highlight style is
Renderer.HighlightStyle.COLOR
, then the point will
be drawn using the highlight color rather than the point color
specified in props
.
props
- render properties used for drawing the pointpnt
- location of the pointhighlight
- if true
, indicates that highlighting, if
enabled, should be applied to the pointvoid drawPoint(RenderProps props, float[] pnt, boolean highlight)
pnt
in model coordinates,
using the point style, size, point color, and shading specified by the
render properties argument props
. This method is
functionally equivalent to drawPoint(RenderProps,Vector3d,boolean)
except that the point is
specified using float[]
.props
- render properties used for drawing the pointpnt
- location of the pointhighlight
- if true
, indicates that highlighting, if
enabled, should be applied to the pointvoid drawLine(RenderProps props, Vector3d pnt0, Vector3d pnt1, boolean highlight)
props
.
If props.getLineStyle()
specifies a line style of Renderer.LineStyle.LINE
, then the
line is drawn as a pixel-based line with a width given by
props.getLineWidth()
. For other line styles,
the line is drawn as a solid with a nominal radius given by
props.getLineRadius()
. If highlight
is true
and the highlight style is
Renderer.HighlightStyle.COLOR
, then the line will
be drawn using the highlight color rather than the line color
specified in props
.
props
- render properties used for drawing the linepnt0
- first pointpnt1
- second pointhighlight
- if true
, indicates that highlighting, if
enabled, should be applied to the linevoid drawLine(RenderProps props, float[] pnt0, float[] pnt1, boolean highlight)
props
. This method is functionally
equivalent to drawLine(RenderProps,Vector3d,Vector3d,boolean)
except that the points are specified using float[]
.props
- render properties used for drawing the linepnt0
- first pointpnt1
- second pointhighlight
- if true
, indicates that highlighting, if
enabled, should be applied to the linevoid drawLine(RenderProps props, float[] pnt0, float[] pnt1, float[] color, boolean capped, boolean highlight)
props
. This method is functionally
equivalent to drawLine(RenderProps,float[],float[],boolean)
,
except for the additional control provided by the arguments
color
and capped
.props
- render properties used for drawing the linepnt0
- first pointpnt1
- second pointcolor
- if not null
, specifies an alternate
color that should be used in place of the line color specified
in props
capped
- if true
, specifies that the line
should have a solid cap on its ends for
styles such as Renderer.LineStyle.CYLINDER
and @link LineStyle#ARROW}highlight
- if true
, indicates that highlighting, if
enabled, should be applied to the linevoid drawLine(RenderProps props, float[] pnt0, float[] pnt1, boolean capped, boolean highlight)
props
. This method is functionally
equivalent to drawLine(RenderProps,float[],float[],boolean)
,
except for the additional control provided by the argument
capped
.props
- render properties used for drawing the linepnt0
- first pointpnt1
- second pointcapped
- if true
, specifies that the line
should have a solid cap on its ends for
styles such as Renderer.LineStyle.CYLINDER
and @link LineStyle#ARROW}highlight
- if true
, indicates that highlighting, if
enabled, should be applied to the linevoid drawRay(RenderProps props, Vector3d pnt, Vector3d dir, double scale, boolean highlight)
props
. The
length of the ray is given by the length of dir
, scaled by
scale
.
If props.getLineStyle()
specifies a line style of Renderer.LineStyle.LINE
, then the ray is drawn as a pixel-based line with a width
given by props.getLineWidth()
. For other line styles, the
ray is drawn as a solid with a nominal radius given by
props.getLineRadius()
. If highlight
is
true
and the highlight style is Renderer.HighlightStyle.COLOR
, then the ray will be drawn using the highlight
color rather than the line color specified in props
.
props
- render properties used for drawing the raypnt
- origin of the raydir
- direction of the rayscale
- second pointhighlight
- if true
, indicates that highlighting, if
enabled, should be applied to the rayvoid drawArrow(RenderProps props, float[] pnt0, float[] pnt1, boolean capped, boolean highlight)
props
. The method
behaves similarly to
drawArrow(float[],float[],double,boolean)
,
with the cylinder radius determine instead by
props.getLineRadius()
.props
- render properties used for drawing the arrowpnt0
- first pointpnt1
- second pointcapped
- if true
, specifies that the arrow
should have a solid cap on the bottomhighlight
- if true
, indicates that highlighting, if
enabled, should be applied to the arrowvoid drawLineStrip(RenderProps props, java.lang.Iterable<float[]> pnts, Renderer.LineStyle style, boolean highlight)
props
, and the line
style specified by style
.
If the line style is Renderer.LineStyle.LINE
, then the
strip is drawn using pixel-based lines with a width given by
props.getLineWidth()
. For other line styles,
the strip is drawn as solids with a nominal radius given by
props.getLineRadius()
. If highlight
is true
and the highlight style is
Renderer.HighlightStyle.COLOR
, then the strip will
be drawn using the highlight color rather than the line color
specified in props
.
props
- render properties used for drawing the strippnts
- list of points used for drawing the stripstyle
- line style to be used for the striphighlight
- if true
, indicates that highlighting, if
enabled, should be applied to the stripjava.awt.geom.Rectangle2D getTextBounds(java.awt.Font font, java.lang.String str, double emSize)
font
- font to use for sizingstr
- String of which to compute the bounding boxemSize
- size of the 'em' unitvoid setDefaultFont(java.awt.Font font)
font
- default font. The font size largely impacts
the resolution of the renderer characters. A value of at least
32pt is recommended.java.awt.Font getDefaultFont()
boolean hasTextRendering()
true
if text rendering is supported.double drawText(java.lang.String str, float[] pos, double emSize)
str
- string to renderpos
- position of the lower left of the text box (model coordinates)emSize
- size of an `em' unit in model coordinatesdouble drawText(java.awt.Font font, java.lang.String str, float[] pos, double emSize)
font
- the font to use. The font size largely impacts
the resolution of the renderer characters. A value of at least
32pt is recommended.str
- string to renderpos
- position of the lower left of the text box (model coordinates)emSize
- size of an `em' unit in model coordinatesdouble drawText(java.lang.String str, Vector3d pos, double emSize)
str
- string to renderpos
- position of the lower left of the text box (model coordinates)emSize
- size of an `em' unit in model coordinatesdouble drawText(java.awt.Font font, java.lang.String str, Vector3d pos, double emSize)
font
- the font to use. The font size largely impacts
the resolution of the renderer characters. A value of at least
32pt is recommended.str
- string to renderpos
- position of the lower left of the text box (model coordinates)emSize
- size of an `em' unit in model coordinatesVector3d getEyeZDirection()
boolean begin2DRendering()
false
if 2D rendering is not supported. This method behaves identically
to begin2DRendering(double,double)
, only with the existing
screen width and height used for w
and h
.true
if 2D rendering is supportedjava.lang.IllegalStateException
- if this Renderer is currently in 2D
rendering mode.getScreenWidth()
,
getScreenHeight()
,
has2DRendering()
boolean begin2DRendering(double w, double h)
false
if 2D rendering is not supported. If 2D rendering is supported, then the
depth buffer is disabled, the model and view matrices are set to the
identity, and the projection matrix is redefined to provide an
orthographic projection with the world frame located at the bottom
left corner of the screen with the x axis horizontal and
pointing to the right, and the y axis vertical. The scaling is
set so that the width and height of the screen map to
the ranges (0, w) and (0, h), respectively. If 2D rendering is not
supported, then no changes are made to any of the matrices and this
method will have no effect.w
- width of the screen coordinatesh
- height of the screen coordinatestrue
if 2D rendering is supportedjava.lang.IllegalStateException
- if this Renderer is currently in 2D
rendering mode.has2DRendering()
boolean has2DRendering()
true
if this Renderer supports 2D rendering mode.true
if 2D rendering is supportedis2DRendering()
void end2DRendering()
java.lang.IllegalStateException
- if this Renderer is not currently in 2D
rendering mode.boolean is2DRendering()
true
if in 2D rendering mode.void setColor(float[] rgba, boolean highlight)
rgba
, and enables or disables highlighting
according to the value of highlight
.
If highlighting is requested and the highlight style is
Renderer.HighlightStyle.COLOR
, the highlight color will override
the diffuse/ambient color settings. This method also clears any
back color that may be present. It is therefore equivalent to calling
setFrontColor (rgba); setBackColor (null); setHighlighting (highlight);
rgba
- array of length 3 or 4 specifying RGB or RGBA values in
the range [0,1]. Alpha is only applied to the diffuse color
and is assumed to be 1.0 if not specified.highlight
- if true
, enables highlighting
rgba
void setColor(float[] rgba)
rgba
. This method also clears any back color that may be
present, and is therefore equivalent to calling
setFrontColor (rgba); setBackColor (null);
rgba
- array of length 3 or 4 specifying RGB or RGBA values in
the range [0,1]. Alpha is only applied to the diffuse color
and is assumed to be 1.0 if not specified.void setColor(java.awt.Color color)
setColor(float[])
, with the RGBA values being obtained
from the color components of color
.color
- specifies RGBA color values.void setColor(float r, float g, float b)
setColor(float[])
, only with alpha assumed to be 1.r
- red valueg
- green valueb
- blue valuevoid setColor(float r, float g, float b, float a)
setColor(float[])
.r
- red valueg
- green valueb
- blue valuea
- alpha valuevoid setFrontColor(float[] rgba)
Renderer.Shading.NONE
. By default, this color is used for both the
front and back faces of triangles, but an alternative color
can be specified for back faces using setBackColor(float[])
.rgba
- array of length 3 or 4 specifying RGB or RGBA values in
the range [0,1]. Alpha is only applied to the diffuse color
and is assumed to be 1.0 if not specified.float[] getFrontColor(float[] rgba)
rgba
. Otherwise, Otherwise, if rgba
is
null
, an array of length 4 will be allocated for returning
the RGBA values. The default RGBA values for the front color are
(1, 1, 1, 1)
.rgba
- optional storage of length 3 or 4 for returning either
the RGB or RGBA values.void setBackColor(float[] rgba)
rgba
is set to
null
, then the back color is cleared and back faces
will be rendered using the front color. By default, the back color is
null
.rgba
- null
to clear back coloring, or
an array of length 3 or 4 specifying RGB or RGBA values in
the range [0,1]. Alpha is only applied to the diffuse color
and is assumed to be 1.0 if not specified.float[] getBackColor(float[] rgba)
null
if no back color is set.
The application may supply the array via the argument rgba
. Otherwise,
Otherwise, if rgba
is null
and the back color is set,
an array of length 4 will be allocated for returning the RGBA values.rgba
- optional storage of length 3 or 4 for returning either
the RGB or RGBA values.null
if no back color is set.void setEmission(float[] rgb)
(0, 0, 0)
.rgb
- array of length 3 specifying RGB values in
the range [0,1].float[] getEmission(float[] rgb)
rgb
.
Otherwise, if rgb
is null
,
an array will be allocated for returning the RGB values.rgb
- optional storage for returning the RGB values.void setSpecular(float[] rgb)
(0.1, 0.1, 0.1)
.rgb
- array of length 3 specifying RGB values in
the range [0,1].float[] getSpecular(float[] rgb)
rgb
.
Otherwise, if rgb
is null
,
an array will be allocated for returning the RGB values.rgb
- optional storage for returning the RGB values.void setShininess(float s)
getShininess()
. This should be in the
range [0,128], and the default value is 32.s
- shininess parameterfloat getShininess()
void setFrontAlpha(float a)
a
- alpha value, in the range [0,1].void setPointColoring(RenderProps props, boolean highlight)
props
, and enables or disables highlighting
according to the value of highlight
. The back color is set
to null
, and the emission, shininess, and specular values
are set either from props
or from default values.
The resulting behavior is equivalent to setPropsColoring(maspack.render.RenderProps, float[], boolean)
with
props.getPointColor()
supplying the rgba
value.
If highlighting is requested and the highlight method equals
Renderer.HighlightStyle.COLOR
, the highlight color will override the
diffuse/ambient color settings.
props
- supplies the shininess and point color valueshighlight
- if true
, enables highlightingvoid setLineColoring(RenderProps props, boolean highlight)
props
, and enables or disables highlighting
according to the value of highlight
. The back color is set
to null
, and the emission, shininess, and specular values
are set either from props
or from default values.
The resulting behavior is equivalent to setPropsColoring(maspack.render.RenderProps, float[], boolean)
with
props.getLineColor()
supplying the rgba
value.
If highlighting is requested and the highlight method equals
Renderer.HighlightStyle.COLOR
, the highlight color will override the
diffuse/ambient color settings.
props
- supplies the shininess and line color valueshighlight
- if true
, enables highlightingvoid setEdgeColoring(RenderProps props, boolean highlight)
props
, and enables or disables highlighting
according to the value of highlight
. If the edge color is
null
then the line color in props
is used
instead. The back color is set to null
, and the emission,
shininess, and specular values are set either from props
or
from default values.
The resulting behavior is equivalent to setPropsColoring(maspack.render.RenderProps, float[], boolean)
with
props.getEdgeColor()
or props.getLineColor()
supplying the rgba
value. If highlighting is
requested and the highlight method equals Renderer.HighlightStyle.COLOR
,
the highlight color will override the diffuse/ambient color settings.
props
- supplies the shininess and edge (or line) color valueshighlight
- if true
, enables highlightingvoid setFaceColoring(RenderProps props, boolean highlight)
props
, and enables or disables highlighting
according to the value of highlight
. The back color will also
be set to the (possibly null
) value of the back color in
props
. If the back color is not null
, then this
will be used to provide the coloring for back faces when they are
visible. The emission, shininess, and specular values are set either from
props
or from default values.
The resulting behavior is equivalent to setPropsColoring(maspack.render.RenderProps, float[], boolean)
with
props.getFaceColor()
supplying the rgba
value,
except that the back color is set from props.getBackColor()
instead of being set to null
. If highlighting is
requested and the highlight method equals Renderer.HighlightStyle.COLOR
,
the highlight color will override the diffuse/ambient color settings.
props
- supplies the shininess and front and back color valueshighlight
- if true
, enables highlightingvoid setFaceColoring(RenderProps props, float[] rgba, boolean highlight)
rgba
, and enables or
disables highlighting according to the value of
highlight
. The back color will also be set to the (possibly
null
) value of the back color in props
. If the
back color is not null
, then this will be used to provide
the coloring for back faces when they are visible. The emission,
shininess, and specular values are set either from props
or
from default values.
The resulting behavior is equivalent to setPropsColoring(maspack.render.RenderProps, float[], boolean)
,
except that the back color is set from props.getBackColor()
instead of being set to null
. If highlighting is
requested and the highlight method equals Renderer.HighlightStyle.COLOR
,
the highlight color will override the diffuse/ambient color settings.
props
- supplies the shininess and back color valuesrgba
- an array of length 3 or 4 specifying RGB or RGBA values
for the color the range [0,1]. Alpha is only applied to the diffuse
color and is set to props.getAlpha()
if not specified.highlight
- if true
, enables highlightingvoid setPropsColoring(RenderProps props, float[] rgba, boolean highlight)
rgba
, and enables or
disables highlighting according to the value of
highlight
. If rgba
only has a length of 3 then
the front alpha value is supplied by props.getAlpha()
. The
shininess is set to props.getShininess()
, while the back
color is set to null
, the emission color is set to its
default value, and the specular color is set to either
props.getSpecular()
, or to its default value if the former
is null
. This behavior is equivalent to the following:
setFrontColor (rgba); if (rgba.length == 3) { setFrontAlpha (props.getAlpha()); } setBackColor (null); setShininess (props.getShininess()); setEmission (DEFAULT_EMISSION_VALUE); specular = props.getSpecular(); setSpecular (specular != null ? specular : DEFAULT_SPECULAR_VALUE); setHighlighting (highlight)If highlighting is requested and the highlight method equals
Renderer.HighlightStyle.COLOR
, the highlight
color will override the diffuse/ambient color settings.props
- supplies the shininess valuergba
- an array of length 3 or 4 specifying RGB or RGBA values for
the color the range [0,1]. Alpha is only applied to the diffuse color and
is set to props.getAlpha()
if not specified.highlight
- if true
, enables highlightingRenderer.Shading setPointShading(RenderProps props)
props
. If props.getPointStyle()
is Renderer.PointStyle.POINT
, then shading is set to Renderer.Shading.NONE
;
otherwise, it is set to props.getShading()
.props
- properties giving the shading and point styleRenderer.Shading setLineShading(RenderProps props)
props
. If props.getLineStyle()
is Renderer.LineStyle.LINE
, then shading is set to Renderer.Shading.NONE
;
otherwise, it is set to props.getShading()
.props
- properties giving the shading and line styleRenderer.Shading setPropsShading(RenderProps props)
props.getShading()
.props
- properties giving the shadingboolean hasColorMapping()
true
if color mapping is supported.boolean hasColorMapMixing(Renderer.ColorMixing cmix)
true
if the color mixing method is supportedColorMapProps setColorMap(ColorMapProps props)
props
, or removes
any color map if props
is null
.
Once a color map is set, it will be applied to any subsequent
draw operation for which the vertices contain texture coordinates.props
- properties for the color map, or null
to disableColorMapProps getColorMap()
null
if no color map is currently set or color mapping
is not supported.setColorMap(maspack.render.ColorMapProps)
boolean hasNormalMapping()
true
if normal mapping is supported.NormalMapProps setNormalMap(NormalMapProps props)
props
, or removes
normal mapping if props
is null
.
Once normal mapping is set, it will be applied to any subsequent
draw operation for which the vertices contain texture coordinates.
At present, texture coordinates can only be specified for draw
operations involving a RenderObject
.
For normal mapping to work, shading must not be set to Renderer.Shading.NONE
or Renderer.Shading.FLAT
.
props
- properties for the normal mapping, or null
to disableNormalMapProps getNormalMap()
null
if no normal mapping has been set or normal mapping
is not supported.setNormalMap(maspack.render.NormalMapProps)
boolean hasBumpMapping()
true
if bump mapping is supported.BumpMapProps setBumpMap(BumpMapProps props)
props
, or removes
bump mapping if props
is null
.
Once bump mapping is set, it will be applied to any subsequent
draw operation for which the vertices contain texture coordinates.
At present, texture coordinates can only be specified for draw
operations involving a RenderObject
.
For bump mapping to work, shading must not be set to Renderer.Shading.NONE
or Renderer.Shading.FLAT
.
props
- properties for the bump mapping, or null
to disableBumpMapProps getBumpMap()
null
if no bump mapping has been set or bump mapping
is not supported.setBumpMap(maspack.render.BumpMapProps)
void drawTriangles(RenderObject robj)
robj
- render objectvoid drawTriangles(RenderObject robj, int gidx)
robj
- render objectgidx
- triangle group indexvoid drawTriangles(RenderObject robj, int gidx, int offset, int count)
robj
- render objectgidx
- triangle group indexoffset
- triangle offset at which to start renderingcount
- number of triangles to drawvoid drawLines(RenderObject robj)
robj
- render objectvoid drawLines(RenderObject robj, int gidx)
robj
- render objectgidx
- line group indexvoid drawLines(RenderObject robj, Renderer.LineStyle style, double rad)
Renderer.LineStyle.LINE
, the argument rad
gives the line width,
whereas for solid primitives (Renderer.LineStyle.CYLINDER
, Renderer.LineStyle.SOLID_ARROW
, Renderer.LineStyle.SPINDLE
), it gives
the nominal radius.robj
- render objectstyle
- line style to use for drawingrad
- radius for solid lines or width for pixel-based linesvoid drawLines(RenderObject robj, int gidx, Renderer.LineStyle style, double rad)
Renderer.LineStyle.LINE
, the argument rad
gives the line width,
whereas for solid primitives (Renderer.LineStyle.CYLINDER
, Renderer.LineStyle.SOLID_ARROW
, Renderer.LineStyle.SPINDLE
), it gives
the nominal radius.robj
- render objectgidx
- line group indexstyle
- line style to use for drawingrad
- radius for solid lines or width for pixel-based linesvoid drawLines(RenderObject robj, int gidx, int offset, int count, Renderer.LineStyle style, double rad)
Renderer.LineStyle.LINE
, the argument rad
gives the line width,
whereas for solid primitives (Renderer.LineStyle.CYLINDER
, Renderer.LineStyle.SOLID_ARROW
, Renderer.LineStyle.SPINDLE
), it gives
the nominal radius.robj
- render objectgidx
- line group indexoffset
- line offset at which to begin drawingcount
- number of lines to drawstyle
- line style to use for drawingrad
- radius for solid lines or width for pixel-based linesvoid drawPoints(RenderObject robj)
robj
- render objectvoid drawPoints(RenderObject robj, int gidx)
robj
- render objectgidx
- point group indexvoid drawPoints(RenderObject robj, Renderer.PointStyle style, double rad)
Renderer.PointStyle.POINT
, the argument rad
gives the point size,
whereas for Renderer.PointStyle.CUBE
it gives the cube half-width,
and for Renderer.PointStyle.SPHERE
it gives the sphere radius.robj
- render objectstyle
- point style to use for drawingrad
- radius for spheres or width for pixel-based pointsvoid drawPoints(RenderObject robj, int gidx, Renderer.PointStyle style, double rad)
Renderer.PointStyle.POINT
, the argument rad
gives the point size,
whereas for Renderer.PointStyle.CUBE
it gives the cube half-width, and for
Renderer.PointStyle.SPHERE
it gives the sphere radius.robj
- render objectgidx
- point group indexstyle
- point style to use for drawingrad
- radius for spheres or width for pixel-based pointsvoid drawPoints(RenderObject robj, int gidx, int offset, int count, Renderer.PointStyle style, double rad)
Renderer.PointStyle.POINT
, the argument rad
gives the point size,
whereas for Renderer.PointStyle.CUBE
it gives the cube half-width, and for
Renderer.PointStyle.SPHERE
it gives the sphere radius.robj
- render objectgidx
- point group indexoffset
- point offset at which to begin within the point groupcount
- number of points to drawstyle
- point style to use for drawingrad
- radius for spheres or width for pixel-based pointsvoid drawVertices(RenderObject robj, Renderer.DrawMode mode)
robj
- render objectmode
- drawing mode to be used for drawing the verticesvoid drawVertices(RenderObject robj, VertexIndexArray idxs, Renderer.DrawMode mode)
VertexIndexArray
can detect whether or not it has been modified,
which allows for caching.robj
- render objectidxs
- vertex indicesmode
- drawing mode to be used for drawing the verticesvoid drawVertices(RenderObject robj, VertexIndexArray idxs, int offset, int count, Renderer.DrawMode mode)
VertexIndexArray
can detect whether or not it has been modified,
which allows for caching. Additionally, this method allows specification of
an offset and vertex count.robj
- render objectidxs
- vertex indicesoffset
- index offsetcount
- index countmode
- drawing mode to be used for drawing the verticesvoid draw(RenderObject robj)
robj
- render objectvoid drawTriangles(RenderObject robj, int gidx, RenderInstances rinst)
robj
- object to drawgidx
- triangle group to drawrinst
- instance to drawvoid drawLines(RenderObject robj, int gidx, RenderInstances rinst)
Renderer.LineStyle.LINE
and use the
current line-width, as determined by getLineWidth()
.robj
- object to drawgidx
- line group to drawrinst
- instance to drawvoid drawPoints(RenderObject robj, int gidx, RenderInstances rinst)
Renderer.PointStyle.POINT
and use the
current point-size, as determined by getPointSize()
.robj
- object to drawgidx
- point group to drawrinst
- instance to drawvoid pushModelMatrix()
AffineTransform3dBase getModelMatrix()
RigidTransform3d
;
otherwise, it is a more general AffineTransform3d
.void getModelMatrix(AffineTransform3d X)
X
- returns the current model matrix valuevoid translateModelMatrix(double tx, double ty, double tz)
[ M p ] [ ] [ 0 1 ]where
M
is a 3 X 3 matrix and p
is a 3 X 1
translation vector, and if t
is the translation vector,
then this method sets the model matrix to
[ M M t + p ] [ ] [ 0 1 ]
tx
- translation along xty
- translation along ytz
- translation along zvoid rotateModelMatrix(double zdeg, double ydeg, double xdeg)
zdeg
degrees about the z
axis, followed by a rotation of ydeg
degrees about the
new y axis, and finally a rotation of xdeg
degrees about
the new x axis. If the model matrix is described by the affine transform
[ M p ] [ ] [ 0 1 ]where
M
is a 3 X 3 matrix and p
is a 3 X 1
translation vector, and if R
is the rotation matrix,
then this method sets the model matrix to
[ M R p ] [ ] [ 0 1 ]
zdeg
- rotation about z axis (degrees)ydeg
- rotation about new y axis (degrees)xdeg
- rotation about new x axis (degrees)void scaleModelMatrix(double s)
[ M p ] [ ] [ 0 1 ]where
M
is a 3 X 3 matrix and p
is a 3 X 1
translation vector, and s
is the scale factor, then
this method sets the model matrix to
[ s M p ] [ ] [ 0 1 ]
s
- scale factorvoid mulModelMatrix(AffineTransform3dBase X)
RigidTransform3d
or an
AffineTransform3d
. If the model matrix is described
by the affine transform
[ M p ] [ ] [ 0 1 ]where
M
is a 3 X 3 matrix and p
is a 3 X 1
translation vector, and the transform X is described by
[ A b ] [ ] [ 0 1 ]then this method sets the model matrix to
[ M A M b + p ] [ ] [ 0 1 ]
X
- transform to multiply the model matrix byvoid setModelMatrix(AffineTransform3dBase X)
X
- new model matrix valuevoid setModelMatrix2d(double left, double right, double bottom, double top)
left
- x value corresponding to -1 in world coordinatesright
- x value corresponding to 1 in world coordinatesbottom
- y value corresponding to -1 in world coordinatestop
- y value corresponding to 1 in world coordinatesis2DRendering()
boolean popModelMatrix()
false
if the model matrix stack is emptyRigidTransform3d getViewMatrix()
void getViewMatrix(RigidTransform3d TWE)
TWE
- returns the current transform from world to eye coordinatesvoid setDepthOffset(int offset)
Depth offsets are used to help resolve z-fighting, in which overlapping primitives drawn in the same plane compete for visibility. If the plane has a considerable tilt with respect to the viewer, then an offset larger than one may be needed to resolve the issue.
offset
- new depth offset valueint getDepthOffset()
setDepthOffset(int)
for
a description. The default value is 0.void setTextureMatrix(AffineTransform2dBase T)
T
- new texture transform matrixAffineTransform2dBase getTextureMatrix()
RigidTransform2d
;
otherwise, it is a more general AffineTransform2d
.void getTextureMatrix(AffineTransform2d X)
X
- returns the current texture matrix valuesetTextureMatrix(AffineTransform2dBase)
boolean hasSelection()
true
if selection is supported.boolean isSelecting()
Renderer.HighlightStyle getHighlightStyle()
Renderer.HighlightStyle.NONE
indicates that
highlighting is deactivated.void getHighlightColor(float[] rgba)
Renderer.HighlightStyle.COLOR
.rgba
- array of length 3 or 4 in which the RGB or RGBA components
of the highlight color are returned.boolean setHighlighting(boolean enable)
Renderer.HighlightStyle
. If the
style is Renderer.HighlightStyle.COLOR
, highlighting is
done by setting the effective color to the highlight color.enable
- if true
, enable highlighting.getHighlightColor(float[])
boolean getHighlighting()
true
if highlighting is enabledvoid beginSelectionQuery(int qid)
qid
. If the rendering that occurs between this call and the
subsequent call to endSelectionQuery()
results in anything being
rendered within the selection window, a {\it selection hit} will be
generated for qid
.
If called within the render
method for a IsSelectable
, then qid
must lie in the
range 0 to numq
-1, where numq
is the value
returned by
IsSelectable.numSelectionQueriesNeeded()
. Selection queries cannot be
nested. If a query identifier is used more than once, it is assumed
as part of the same query.qid
- identifier for the selection queryendSelectionQuery()
void endSelectionQuery()
beginSelectionQuery(int)
.beginSelectionQuery(int)
void beginSubSelection(IsSelectable s, int qid)
IsSelectable
s
that
manages its own selection; this call should
be used in place of beginSelectionQuery(int)
for such objects.
Selectables that manage their own selection are identified by
having a value numq >= 0
, where numq
is the value returned by
IsSelectable.numSelectionQueriesNeeded()
IsSelectable#numSelectionQueriesNeeded{}}.
The argument qid
is the current selection query identifier,
which after the call should be increased by numq
.s
- Selectable that is managing its own sub-selectionqid
- current selection query identifiervoid endSubSelection()
beginSubSelection(maspack.render.IsSelectable, int)
.endSubSelection()
boolean isSelectable(IsSelectable s)
s
is selectable in the current selection
context. This will be the case if s.isSelectable()
returns
true
, and s
also passes whatever selection
filter might currently be set in the renderer.void beginDraw(Renderer.DrawMode mode)
glBegin()
in the
old GL specification. Once in draw mode, the application can specify
the vertices (and if necessary, normals) that are used to draw the
primitive that is specified by the mode parameter.mode
- specifies the primitive to be built while in draw mode.java.lang.IllegalStateException
- if the renderer is currently in draw modevoid addVertex(float px, float py, float pz)
px
- vertex x coordinatepy
- vertex y coordinatepz
- vertex z coordinatejava.lang.IllegalStateException
- if the renderer is not in draw modebeginDraw(maspack.render.Renderer.DrawMode)
void addVertex(double px, double py, double pz)
px
- vertex x coordinatepy
- vertex y coordinatepz
- vertex z coordinatejava.lang.IllegalStateException
- if the renderer is not in draw modebeginDraw(maspack.render.Renderer.DrawMode)
void addVertex(Vector3d pnt)
pnt
- coordinates for the vertexjava.lang.IllegalStateException
- if the renderer is not in draw modebeginDraw(maspack.render.Renderer.DrawMode)
void addVertex(float[] pnt)
pnt
- coordinates for the vertexjava.lang.IllegalStateException
- if the renderer is not in draw modebeginDraw(maspack.render.Renderer.DrawMode)
void setNormal(float nx, float ny, float nz)
setNormal
call. The normal does not
need to be normalized.nx
- normal x coordinateny
- normal y coordinatenz
- normal z coordinatejava.lang.IllegalStateException
- if the renderer is not in draw modebeginDraw(maspack.render.Renderer.DrawMode)
void setNormal(double nx, double ny, double nz)
setNormal(float,float,float)
.nx
- normal x coordinateny
- normal y coordinatenz
- normal z coordinatejava.lang.IllegalStateException
- if the renderer is not in draw modebeginDraw(maspack.render.Renderer.DrawMode)
void setNormal(Vector3d nrm)
setNormal(float,float,float)
.nrm
- normal coordinatesjava.lang.IllegalStateException
- if the renderer is not in draw modebeginDraw(maspack.render.Renderer.DrawMode)
void setTextureCoord(float tx, float ty)
setTexcoord
call. The coordinate should
be within the range [0, 1]tx
- texture x coordinatety
- texture y coordinatejava.lang.IllegalStateException
- if the renderer is not in draw modebeginDraw(maspack.render.Renderer.DrawMode)
void setTextureCoord(double tx, double ty)
setTextureCoord(float,float)
.tx
- texture x coordinatety
- texture y coordinatejava.lang.IllegalStateException
- if the renderer is not in draw modebeginDraw(maspack.render.Renderer.DrawMode)
void setTextureCoord(Vector2d tex)
setTextureCoord(float,float)
.tex
- texture coordinatesjava.lang.IllegalStateException
- if the renderer is not in draw modebeginDraw(maspack.render.Renderer.DrawMode)
void endDraw()
glEnd()
in the old
GL specification.java.lang.IllegalStateException
- if the renderer is not in draw modevoid restoreDefaultState(boolean strictChecking)
strictChecking
- if true
, enables strict
checking.java.lang.IllegalStateException
- if strict checking is enabled and fails.