public abstract class GLViewer extends java.lang.Object implements com.jogamp.opengl.GLEventListener, GLRenderer, HasProperties, Viewer
| Modifier and Type | Class and Description |
|---|---|
static class |
GLViewer.BlendFactor |
static class |
GLViewer.GLVersion |
static class |
GLViewer.RotationMode |
Renderer.ColorInterpolation, Renderer.ColorMixing, Renderer.DrawMode, Renderer.FaceStyle, Renderer.HighlightStyle, Renderer.LineStyle, Renderer.PointStyle, Renderer.Shading| Modifier and Type | Field and Description |
|---|---|
static double |
AUTO_FIT |
static GLViewer.BlendFactor |
DEFAULT_DST_BLENDING |
static boolean |
DEFAULT_ELLIPTIC_CURSOR_ACTIVE |
static Vector2d |
DEFAULT_ELLIPTIC_CURSOR_SIZE |
static GLViewer.RotationMode |
DEFAULT_ROTATION_MODE |
static GLViewer.BlendFactor |
DEFAULT_SRC_BLENDING |
static PropertyList |
myProps |
static boolean |
useGLJPanel
Whether to use a GLJPanel or GLCanvas
|
HIGHLIGHT, SORT_FACES| Constructor and Description |
|---|
GLViewer() |
| Modifier and Type | Method and Description |
|---|---|
GLClipPlane |
addClipPlane() |
boolean |
addClipPlane(GLClipPlane clipPlane) |
GLClipPlane |
addClipPlane(RigidTransform3d X,
double size) |
void |
addDragger(Dragger3d d) |
void |
addKeyListener(java.awt.event.KeyListener l) |
Light |
addLight(float[] position,
float[] ambient,
float[] diffuse,
float[] specular) |
int |
addLight(Light light)
Adds a specified light to this viewer and enables it.
|
void |
addMouseInputListener(javax.swing.event.MouseInputListener l) |
void |
addMouseWheelListener(java.awt.event.MouseWheelListener l) |
void |
addRenderable(IsRenderable d)
Adds a renderable to this viewer.
|
void |
addRenderListener(RenderListener l)
Adds a render listener to this viewer.
|
void |
addSelectionListener(ViewerSelectionListener l)
Adds a selection listener to this viewer that will fire whenever objects
are selected.
|
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.
|
void |
autoFit()
Calls either
Viewer.autoFitOrtho() or Viewer.autoFitPerspective(),
depending on whether the current view is orthogonal or perspective. |
void |
autoFitOrtho()
Auto computes the eye and center positions and an orthogonal viewing
frustum to fit the current scence.
|
void |
autoFitPerspective()
Auto computes the eye and center positions and an perpective viewing
frustum to fit the current scence.
|
abstract void |
awaitScreenShotCompletion() |
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 |
begin2DRendering(double left,
double right,
double bottom,
double top) |
void |
beginDraw(Renderer.DrawMode mode)
Begins draw mode.
|
com.jogamp.opengl.GL |
beginGL()
Begin application-defined GL rendering, using GL primitives based
on handles returned by
getGL(), etc. |
void |
beginSelectionQuery(int idx)
Begins a selection query with the {\it query identifier}
qid. |
void |
beginSubSelection(IsSelectable s,
int idx)
Begins selection for a
IsSelectable
sthat
manages its own selection; this call should
be used in place of Renderer.beginSelectionQuery(int) for such objects. |
double |
centerDistancePerPixel()
Computes the distance per pixel at the viewpoint center.
|
abstract void |
cleanupScreenShots() |
void |
clearClipPlanes() |
void |
clearDraggers() |
void |
clearPickMatrix() |
void |
clearRenderables()
Removes all renderables from this viewer.
|
void |
display(com.jogamp.opengl.GLAutoDrawable drawable) |
abstract void |
display(com.jogamp.opengl.GLAutoDrawable drawable,
int flags) |
void |
dispose()
MUST BE CALLED by whatever frame when it is going down, will notify any
shared resources that they can be cleared.
|
void |
dispose(com.jogamp.opengl.GLAutoDrawable drawable)
Called any time GL context is switched! e.g.
|
double |
distancePerPixel(Vector3d pnt)
Computes the distance per pixel for a point specified with respect to
world coordinates.
|
void |
draw(RenderObject robj)
Draws all the primitives in the first point, line and triangles groups.
|
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 |
drawAxes(RigidTransform3d X,
double len,
int width,
boolean highlight)
Draws a set of coordinate axes representing a rigid coordinate frame
X. |
void |
drawBox(Vector3d pnt,
Vector3d widths)
Draws an axis-aligned box 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(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(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(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(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,
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,
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 |
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(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,
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,
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 |
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(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(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,
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(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 |
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 |
endGL()
Ends application-defined GL rendering.
|
void |
endSelectionQuery()
Ends a selection query that was initiated with a call to
Renderer.beginSelectionQuery(int). |
void |
endSubSelection()
Ends object sub-selection that was initiated with a call
to
Renderer.beginSubSelection(maspack.render.IsSelectable, int). |
double |
estimateRadiusAndCenter(Point3d center)
Size is the diameter of the bounding box.
|
void |
finish2DRendering() |
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
boolean |
getAutoSwapBufferMode()
Check whether or not the GL canvas is set to auto swap buffers
|
AxisAlignedRotation |
getAxialView()
Returns the current axis-aligned view.
|
double |
getAxisLength() |
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. |
java.awt.Color |
getBackgroundColor()
Returns the background color for this viewer.
|
float[] |
getBackgroundColor(float[] rgba)
Returns the background color for this viewer.
|
GLViewer.BlendFactor |
getBlendDestFactor() |
GLViewer.BlendFactor |
getBlendSourceFactor() |
boolean |
getBounds(Point3d pmin,
Point3d pmax) |
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. |
GLDrawableComponent |
getCanvas() |
int |
getCellDivisions() |
double |
getCellSize() |
Point3d |
getCenter()
Returns the current center point
|
RigidTransform3d |
getCenterToWorld()
Returns a transform from world coordinates to center coordinates, with the
axes aligned to match the current eyeToWorld transform.
|
GLClipPlane |
getClipPlane(int idx) |
GLClipPlane[] |
getClipPlanes() |
float[] |
getColor(float[] rgba)
Gets a copy of the current diffuse "color"
|
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. |
com.jogamp.opengl.GLContext |
getContext()
Gets the "currently active" context.
|
AxisAlignedRotation |
getDefaultAxialView() |
java.awt.Font |
getDefaultFont()
Retrieves the default font.
|
int |
getDepthOffset()
The current depth offset level.
|
java.util.LinkedList<Dragger3d> |
getDraggers() |
boolean |
getEllipticCursorActive() |
Vector2d |
getEllipticCursorSize() |
boolean |
getEllipticSelection() |
float[] |
getEmission(float[] rgb)
Returns the RGB values for the emission color as a float array.
|
RenderList |
getExternalRenderList()
Returns the external render list for this viewer, or
null
if the viewer does not have an external render list. |
Point3d |
getEye()
Returns the eye position.
|
void |
getEyeToWorld(RigidTransform3d X)
Gets the eye-to-world transform for this viewer.
|
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 |
getFrustum(double[] bounds)
Returns the bounds for the current frustum.
|
com.jogamp.opengl.GL |
getGL() |
GLGridPlane |
getGrid() |
boolean |
getGridVisible() |
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.
|
int |
getIndexOfLight(Light light)
Get the index of a specified light in this viewer.
|
java.awt.event.KeyListener[] |
getKeyListeners() |
Light |
getLight(int i)
Get a specified light by index in this viewer.
|
float |
getLineWidth()
Returns the current width for rendering lines, in pixels.
|
int |
getMaxGLClipPlanes() |
AffineTransform3dBase |
getModelMatrix()
Gets the current model matrix.
|
void |
getModelMatrix(AffineTransform3d m)
Gets the current model matrix.
|
void |
getModelMatrix(Matrix4d X) |
GLMouseListener |
getMouseHandler() |
javax.swing.event.MouseInputListener[] |
getMouseInputListeners() |
java.awt.event.MouseWheelListener[] |
getMouseWheelListeners() |
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. |
int |
getNumClipPlanes() |
float |
getPointSize()
Returns the current size for rendering points, in pixels.
|
boolean |
getProfiling() |
Matrix4d |
getProjectionMatrix() |
void |
getProjectionMatrix(Matrix4d X) |
Property |
getProperty(java.lang.String name)
Returns a property associated with a specified path name.
|
int |
getRenderFlags() |
RenderListener[] |
getRenderListeners()
Returns an array of all render listeners held by this viewer.
|
GLViewer.RotationMode |
getRotationMode() |
boolean |
getRoundedPoints() |
int |
getScreenHeight()
Returns the screen height, in pixels
|
int |
getScreenWidth()
Returns the screen width, in pixels
|
int |
getScreenX() |
int |
getScreenY() |
void |
getSelectingColor(float[] rgba) |
ViewerSelectionEvent |
getSelectionEvent() |
ViewerSelectionFilter |
getSelectionFilter()
Returns the current selection filter for the viewer, if any.
|
ViewerSelectionListener[] |
getSelectionListeners()
Returns a list of all the selection listener in this viewer.
|
boolean |
getSelectOnPress() |
Renderer.Shading |
getShading()
Returns the current shading model used by this renderer.
|
float |
getShininess()
Returns the current shininess parameter.
|
boolean |
getSolidAxes() |
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.
|
abstract GLTextRenderer |
getTextRenderer() |
AffineTransform2dBase |
getTextureMatrix()
Gets the current texture matrix.
|
void |
getTextureMatrix(AffineTransform2d X)
Gets the current texture matrix.
|
boolean |
getTransparencyFaceCulling() |
Vector3d |
getUpVector()
Returns the ``up'' vector which this viewer uses in some instances to
determine the direction of the y axis of the eye coordinate system.
|
Renderer.ColorMixing |
getVertexColorMixing()
Returns the method used for combining vertex coloring and material
coloring.
|
double |
getVerticalFieldOfView()
Returns the default vertical field of view in degrees.
|
RigidTransform3d |
getViewMatrix()
Gets the current view matrix.
|
void |
getViewMatrix(Matrix4d X) |
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.
|
abstract boolean |
grabPending() |
boolean |
has2DRendering()
Returns
true if this Renderer supports 2D rendering mode. |
abstract 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 |
hasHighlightStyle(Renderer.HighlightStyle style)
Returns
true if this viewer supports the indicated
highlighting style. |
boolean |
hasSelection()
Queries whether or not this Renderer supports selection.
|
boolean |
hasTextRendering()
Queries whether or not this renderer supports text rendering.
|
boolean |
hasVertexColoring() |
abstract boolean |
hasVertexColorMixing(Renderer.ColorMixing cmix)
Queries whether or not a specified method for combining vertex coloring
and material coloring is supported by this Renderer.
|
void |
init(com.jogamp.opengl.GLAutoDrawable drawable)
Called any time GL context is switched! e.g.
|
boolean |
is2DRendering()
Check whether the Renderer is currently in 2D rendering mode.
|
boolean |
isAutoResizeEnabled() |
boolean |
isAutoViewportEnabled() |
boolean |
isBlendingEnabled() |
boolean |
isDepthEnabled() |
boolean |
isDepthWriteEnabled() |
boolean |
isLightingEnabled() |
boolean |
isMultiSampleEnabled() |
boolean |
isOrthogonal()
Returns true if the current viewing projection is orthogonal.
|
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.
|
boolean |
isSelectionEnabled()
Returns
true if viewer-based selection is enabled. |
boolean |
isSpecialRenderFlagsSet()
Used to see if rendering with special flags has been performed yet.
|
boolean |
isTextureMappingEnabled() |
boolean |
isTransparencyEnabled() |
boolean |
isVertexColoringEnabled() |
abstract void |
maybeUpdateMaterials() |
void |
mulModelMatrix(AffineTransform3dBase trans)
Post-multiplies the model matrix by the specified transform X,
which may be either a
RigidTransform3d or an
AffineTransform3d. |
int |
numFreeClipPlanes() |
int |
numLights()
Returns the number of lights in this viewer.
|
int |
numMultiSamples() |
int |
numSelectionQueriesNeeded() |
void |
paint() |
boolean |
popModelMatrix()
Restores the model matrix by popping it off the model matrix stack
|
boolean |
popProjectionMatrix() |
boolean |
popTextureMatrix() |
boolean |
popViewMatrix() |
void |
pushModelMatrix()
Saves the model matrix by pushing it onto the model matrix stack.
|
void |
pushProjectionMatrix() |
void |
pushTextureMatrix() |
void |
pushViewMatrix() |
boolean |
removeClipPlane(GLClipPlane clipPlane) |
void |
removeDragger(Dragger3d d) |
void |
removeKeyListener(java.awt.event.KeyListener l) |
void |
removeLight(int i)
Removes the light with the specified index from this viewer.
|
boolean |
removeLight(Light light)
Removes the indicated light from this viewer.
|
void |
removeMouseInputListener(javax.swing.event.MouseInputListener l) |
void |
removeMouseWheelListener(java.awt.event.MouseWheelListener l) |
boolean |
removeRenderable(IsRenderable d)
Removes a renderable from this viewer.
|
boolean |
removeRenderListener(RenderListener l)
Removes a render listener from this viewer.
|
boolean |
removeSelectionListener(ViewerSelectionListener l)
Removes a selection listener from this viewer.
|
void |
repaint()
Request a repaint operation for this viewer.
|
void |
rerender()
Convenience methods that calls
Viewer.rerender(int) with
flags = 0. |
void |
rerender(int flags)
Request a render with special flags that will be used
only for the duration of that render.
|
void |
resetEllipticCursorSize() |
void |
reshape(com.jogamp.opengl.GLAutoDrawable drawable,
int x,
int y,
int w,
int h) |
void |
restoreDefaultState(boolean strictChecking)
Restores the renderer to its default state.
|
void |
rotate(double xang,
double yang)
Rotate the eye coordinate frame about the center point
|
void |
rotateModelMatrix(double zdeg,
double ydeg,
double xdeg)
Rotates the model frame.
|
void |
scaleModelMatrix(double s)
Scales the current model matrix.
|
void |
scaleModelMatrix(double sx,
double sy,
double sz) |
boolean |
setAutoResizeEnabled(boolean enabled)
Allows you to explicitly enable or disable resizing of viewer
(may want to disable while recording video or while selecting)
|
void |
setAutoSwapBufferMode(boolean enable)
Enable or disable the GL Canvas auto-swap mode
|
boolean |
setAutoViewportEnabled(boolean enabled)
Allows you to explicitly enable or disable automatic viewport
adjustment based on screen width/height
(may want to disable while recording video or while selecting)
|
void |
setAxialView(AxisAlignedRotation REW)
Sets an axial (or axis-aligned) view.
|
void |
setAxisLength(double len) |
void |
setBackColor(float[] rgba)
Optionally sets the diffuse and ambient colors used for the subsequent
rendering of the back faces of triangles.
|
void |
setBackgroundColor(java.awt.Color color)
Sets the background color for this viewer.
|
void |
setBackgroundColor(float[] rgba)
Sets the background color for this viewer.
|
void |
setBackgroundColor(float r,
float g,
float b) |
void |
setBlendDestFactor(GLViewer.BlendFactor factor) |
void |
setBlendingEnabled(boolean set) |
void |
setBlendSourceFactor(GLViewer.BlendFactor factor) |
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 |
setCenter(Point3d c)
Sets the center point for the viewer, and adjusts the eye coordinates so
that the eye's -z axis is directed at the center point.
|
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 method to be used
|
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 |
setDefaultAxialView(AxisAlignedRotation view) |
void |
setDefaultFont(java.awt.Font font)
Sets default font for text rendering
|
void |
setDefaultLights() |
boolean |
setDepthEnabled(boolean set) |
void |
setDepthOffset(int offset)
Set a depth offset for the projection matrix.
|
boolean |
setDepthWriteEnabled(boolean set) |
void |
setDrawTool(Dragger3d d) |
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 |
setEllipticCursorActive(boolean active) |
void |
setEllipticCursorSize(Vector2d size) |
void |
setEllipticSelection(boolean enable) |
void |
setEmission(float[] rgb)
Sets the emission color to be used for subsequent rendering
of primitives.
|
void |
setExternalRenderList(RenderList list)
Sets the external render list for this viewer.
|
void |
setEye(Point3d eye)
Moves the eye coordinates to a specifed location in world coordinates, and
adjusts the orientation so that the eye's -z axis is directed at the
center point.
|
void |
setEyeToWorld(Point3d eye,
Point3d center,
Vector3d up)
Sets the eyeToWorld transform for this viewer, using the canonical
parameters used by the GL
lookat method. |
void |
setEyeToWorld(RigidTransform3d X)
Directly sets the eye coordinate frame.
|
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.
|
void |
setGlobalRenderFlags(int flags) |
void |
setGridVisible(boolean visible) |
void |
setHighlightColor(java.awt.Color color) |
boolean |
setHighlighting(boolean enable)
Enables or disables highlighting.
|
boolean |
setHighlightStyle(Renderer.HighlightStyle style)
Sets the highlighting style for this viewer.
|
boolean |
setLightingEnabled(boolean enable) |
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 w)
Sets the width for rendering lines, in pixels.
|
void |
setMaterial(float[] frontRgba,
float[] backRgba,
float shininess,
boolean selected) |
void |
setModelMatrix(AffineTransform3dBase m)
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 |
setMouseHandler(GLMouseListener handler) |
void |
setMultiSampleEnabled(boolean set) |
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 |
setOrthogonal(double fieldHeight,
double near,
double far)
Sets the viewing frustum to an orthogonal projection centered about the -z
axis.
|
void |
setOrthogonal(double left,
double right,
double bottom,
double top,
double near,
double far)
Sets the viewing frustum to a general orthogonal projection.
|
void |
setOrthographicView(boolean enable) |
void |
setPerspective(double fieldOfView,
double near,
double far)
Sets the viewing frustum to a perspective projection centered about the -z
axis.
|
void |
setPerspective(double left,
double right,
double bottom,
double top,
double near,
double far)
Sets the viewing frustum to a general perspective projection.
|
void |
setPerspective(double left,
double right,
double bottom,
double top,
double near,
double far,
boolean setExplicit) |
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 s)
Sets the size for rendering points, in pixels.
|
void |
setProfiling(boolean enable) |
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(). |
void |
setRotationMode(GLViewer.RotationMode mode) |
boolean |
setRoundedPoints(boolean enable) |
void |
setSelectingColor(java.awt.Color color)
Special color used for selection (primarily for color-based selection,
although since the renderbuffers are typically not drawn, can be
used for any selection method).
|
void |
setSelectingColor(float r,
float g,
float b,
float a)
The material color to use if the renderer is currently performing a
selection render.
|
void |
setSelectionEnabled(boolean selection)
Enables or disables viewer-based selection.
|
void |
setSelectionFilter(ViewerSelectionFilter filter)
Sets a selection filter for the viewer.
|
void |
setSelectOnPress(boolean enable) |
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
Renderer.getShininess(). |
void |
setSolidAxes(boolean enable) |
void |
setSpecular(float[] rgb)
Sets the specular color to be used for subsequent rendering
of primitives.
|
int |
setSurfaceResolution(int nres)
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 x,
float y)
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.
|
boolean |
setTextureMappingEnabled(boolean enable) |
void |
setTextureMatrix(AffineTransform2dBase T)
Sets the texture coordinate transformation matrix to the specified
transform.
|
void |
setTransparencyEnabled(boolean enable) |
boolean |
setTransparencyFaceCulling(boolean enable) |
abstract void |
setupScreenShot(int w,
int h,
java.io.File file,
java.lang.String format) |
abstract void |
setupScreenShot(int w,
int h,
int samples,
java.io.File file,
java.lang.String format)
Setup for a screenshot during the next render cycle
|
void |
setUpVector(Vector3d upVector)
Sets the ``up'' vector for this viewer to a specified value, and adjusts
the eye-to-world transform to account for this new vertical direction,
while the eye's -z axis is directed at the
center point.
|
boolean |
setVertexColoringEnabled(boolean enable) |
Renderer.ColorMixing |
setVertexColorMixing(Renderer.ColorMixing cmix)
Sets the method used for combining vertex coloring and material coloring.
|
void |
setVerticalFieldOfView(double fov)
Sets the default vertical field of view in degrees.
|
void |
setViewMatrix(RigidTransform3d v)
Sets the view matrix for this viewer.
|
void |
setViewport(com.jogamp.opengl.GL gl,
int x,
int y,
int width,
int height)
Sets the viewer's viewport.
|
void |
setViewVolume(double near,
double far) |
void |
translateModelMatrix(double tx,
double ty,
double tz)
Translates the model frame.
|
void |
translateModelMatrix(Vector3d t) |
void |
zoom(double s)
Zoom in or out by a specified scale factor.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdrawArrow, drawArrow, drawAxes, drawBox, drawBox, drawCone, drawCube, drawCylinder, drawLine, drawLine, drawLines, drawLines, drawLines, drawLineStrip, drawPoint, drawPoint, drawPoints, drawPoints, drawPoints, drawSphere, drawSpindle, drawText, drawTriangle, drawTriangles, drawTriangles, drawVertices, drawVertices, hasBumpMapping, hasColorMapping, hasNormalMappingpublic static boolean useGLJPanel
public static GLViewer.BlendFactor DEFAULT_SRC_BLENDING
public static GLViewer.BlendFactor DEFAULT_DST_BLENDING
public static final double AUTO_FIT
public static GLViewer.RotationMode DEFAULT_ROTATION_MODE
public static Vector2d DEFAULT_ELLIPTIC_CURSOR_SIZE
public static boolean DEFAULT_ELLIPTIC_CURSOR_ACTIVE
public static PropertyList myProps
public PropertyList getAllPropertyInfo()
HasPropertiesgetAllPropertyInfo in interface HasPropertiespublic Property getProperty(java.lang.String name)
.' characters. A sub-property
exists if the value of a property is itself an object which exports
properties. It is only possible to obtain a sub-property handle if each of
its ancestor properties exports their values by reference.getProperty in interface HasPropertiesname - name of the desired property or sub-propertypublic void setProfiling(boolean enable)
public boolean getProfiling()
public Vector2d getEllipticCursorSize()
public void setEllipticCursorSize(Vector2d size)
public void resetEllipticCursorSize()
public boolean getEllipticCursorActive()
public void setEllipticCursorActive(boolean active)
public int getSurfaceResolution()
RenderergetSurfaceResolution in interface RendererRenderer.setSurfaceResolution(int)public int setSurfaceResolution(int nres)
RenderersetSurfaceResolution in interface Renderernres - resolution for curved surfacespublic void setAxisLength(double len)
public double getAxisLength()
public void setSolidAxes(boolean enable)
public boolean getSolidAxes()
public void setGridVisible(boolean visible)
public boolean getGridVisible()
public java.awt.event.KeyListener[] getKeyListeners()
public void addKeyListener(java.awt.event.KeyListener l)
public void removeKeyListener(java.awt.event.KeyListener l)
public java.util.LinkedList<Dragger3d> getDraggers()
public void addSelectionListener(ViewerSelectionListener l)
VieweraddSelectionListener in interface Viewerl - selection listener to addViewer.removeSelectionListener(maspack.render.ViewerSelectionListener)public boolean removeSelectionListener(ViewerSelectionListener l)
ViewerremoveSelectionListener in interface Viewerl - selection listener to removeViewer.addSelectionListener(maspack.render.ViewerSelectionListener)public ViewerSelectionListener[] getSelectionListeners()
ViewergetSelectionListeners in interface ViewerViewer.addSelectionListener(maspack.render.ViewerSelectionListener),
Viewer.removeSelectionListener(maspack.render.ViewerSelectionListener)public ViewerSelectionEvent getSelectionEvent()
public void addRenderListener(RenderListener l)
VieweraddRenderListener in interface Viewerl - render listener to add.public boolean removeRenderListener(RenderListener l)
ViewerremoveRenderListener in interface Viewerl - render listener to removetrue if l was present and removed.public RenderListener[] getRenderListeners()
ViewergetRenderListeners in interface Viewerpublic void addRenderable(IsRenderable d)
VieweraddRenderable in interface Viewerd - renderable to addpublic void addDragger(Dragger3d d)
public void setDrawTool(Dragger3d d)
public boolean removeRenderable(IsRenderable d)
ViewerremoveRenderable in interface Viewerd - renderable to removetrue if r was present and removedpublic void removeDragger(Dragger3d d)
public void clearDraggers()
public void clearRenderables()
ViewerclearRenderables in interface Viewerpublic double getViewPlaneDistance()
RenderergetViewPlaneDistance in interface RendererRenderer.getFarPlaneDistance()public double getFarPlaneDistance()
RenderergetFarPlaneDistance in interface RendererRenderer.getViewPlaneDistance()public double getVerticalFieldOfView()
autoFitOrtho.getVerticalFieldOfView in interface Viewerpublic void setVerticalFieldOfView(double fov)
autoFitOrtho.setVerticalFieldOfView in interface Viewerfov - vertical field of view (degrees).public void repaint()
Viewerpublic void paint()
public void setExternalRenderList(RenderList list)
ViewerViewer.addRenderable(maspack.render.IsRenderable), Viewer.removeRenderable(maspack.render.IsRenderable), etc.
Generally, if an application specifies an external render list, it
should rebuild that list prior to each invocation of this viewer's Viewer.rerender(int) method. This is typically dones as follows:
RenderList extList;
...
extList.clear();
for (every external renderable r) {
extList.addIfVisible (r);
}
The call to addIfVisible()
will place r onto the render list (if it is visible)
and also call its prerender() method.
Note in particular that prerender() will not be
called by the viewer.
External render lists are designed for situations where a set of
renderables is being rendered simultaneously by multiple viewers, and
consequently we don't want prerender() to be called multiple
times by different viewers.
setExternalRenderList in interface Viewerlist - new external render list, or null to clear
the external listpublic RenderList getExternalRenderList()
Viewernull
if the viewer does not have an external render list.getExternalRenderList in interface Viewerpublic void rerender(int flags)
public boolean isSpecialRenderFlagsSet()
public void rerender()
ViewerViewer.rerender(int) with
flags = 0.public void getFrustum(double[] bounds)
bounds - returns the values of left, right, bottom, top, near and far (in that
order)public void setPerspective(double left,
double right,
double bottom,
double top,
double near,
double far)
setPerspective in interface Viewerleft - left edge position of the near clipping planeright - right edge position of the near clipping planebottom - bottom edge position of the near clipping planetop - top position of the near clipping planenear - near clipping plane position (along the -z axis; must be a positive
number)far - far clipping plane position (along the -z axis; must be a positive number)public void setPerspective(double left,
double right,
double bottom,
double top,
double near,
double far,
boolean setExplicit)
public void setPerspective(double fieldOfView,
double near,
double far)
getVerticalFieldOfView.setPerspective in interface ViewerfieldOfView - vertial field of view (in degrees)near - near clipping plane position (along the -z axis; must be a positive
number)far - far clipping plane position (along the -z axis; must be a positive number)public void setOrthogonal(double fieldHeight,
double near,
double far)
setOrthogonal in interface ViewerfieldHeight - vertical height of the field of viewnear - near clipping plane position (along the -z axis; must be a positive
number)far - far clipping plane position (along the -z axis; must be a positive number)public void setOrthogonal(double left,
double right,
double bottom,
double top,
double near,
double far)
ViewersetOrthogonal in interface Viewerleft - left edge position of the near clipping planeright - right edge position of the near clipping planebottom - bottom edge position of the near clipping planetop - top position of the near clipping planenear - near clipping plane position (along the -z axis; must be a positive
number)far - far clipping plane position (along the -z axis; must be a positive number)public boolean isOrthogonal()
isOrthogonal in interface Rendererpublic void setOrthographicView(boolean enable)
public double estimateRadiusAndCenter(Point3d center)
public void autoFit()
ViewerViewer.autoFitOrtho() or Viewer.autoFitPerspective(),
depending on whether the current view is orthogonal or perspective.public void autoFitPerspective()
IsRenderable.updateBounds(maspack.matrix.Vector3d, maspack.matrix.Vector3d) method of all the renderables to estimate
the scene center and an approximate radius r. It then computes a distance
d from the center to the eye using r = d tan(fov/2), where fov is the
field of view returned by Viewer.getVerticalFieldOfView() and
converted to radians. This field of view also used to used to compute the
perspective frustum. The eye frame orientation is adjusted so that
its $y$ axis is parallel to the current value of the ``up'' vector.autoFitPerspective in interface ViewerViewer.setUpVector(maspack.matrix.Vector3d),
Viewer.getUpVector()public void autoFitOrtho()
ViewerIsRenderable.updateBounds(maspack.matrix.Vector3d, maspack.matrix.Vector3d) method of all the renderables to estimate
the scene center and an approximate radius r. It then computes a distance
d from the center to the eye using r = d tan(fov/2), where fov is the
field of view returned by Viewer.getVerticalFieldOfView() and
converted to radians. The eye frame orientation is adjusted so that
its $y$ axis is parallel to the current value of the ``up'' vector.autoFitOrtho in interface ViewerViewer.setUpVector(maspack.matrix.Vector3d),
Viewer.getUpVector()public int getScreenWidth()
RenderergetScreenWidth in interface Rendererpublic int getScreenHeight()
RenderergetScreenHeight in interface Rendererpublic int getScreenX()
public int getScreenY()
public com.jogamp.opengl.GL getGL()
getGL in interface GLRendererpublic void setAutoSwapBufferMode(boolean enable)
public boolean getAutoSwapBufferMode()
public com.jogamp.opengl.GLContext getContext()
public void rotate(double xang,
double yang)
xang - amount of horizontal rotation (in radians)yang - amount of vertical rotation (in radians)public void zoom(double s)
s - scale factorpublic double distancePerPixel(Vector3d pnt)
distancePerPixel in interface Rendererpnt - point undergoing the displacementpublic double centerDistancePerPixel()
centerDistancePerPixel in interface Rendererpublic void setDefaultAxialView(AxisAlignedRotation view)
public AxisAlignedRotation getDefaultAxialView()
public void setAxialView(AxisAlignedRotation REW)
REW, and then moving the eye position so that
the center position lies along the new -z axis of the eye frame,
while maintaining the current distance between the eye and the center.
The method also sets this viewer's `up'' vector to the y axis of
REW, and saves REW itself as the current
axis-aligned view, which can be retrieved using getAxialView().
The viewer's grid is also adjusted to align with the nearest set
of aligned axes.
setAxialView in interface ViewerREW - axis-aligned rotational component for
the eye-to-world transformgetAxialView(),
setUpVector(maspack.matrix.Vector3d),
getUpVector()public AxisAlignedRotation getAxialView()
Viewer.setAxialView(maspack.matrix.AxisAlignedRotation).getAxialView in interface ViewerViewer.setAxialView(maspack.matrix.AxisAlignedRotation)public GLDrawableComponent getCanvas()
public void init(com.jogamp.opengl.GLAutoDrawable drawable)
init in interface com.jogamp.opengl.GLEventListenerpublic boolean isMultiSampleEnabled()
public int numMultiSamples()
public void setMultiSampleEnabled(boolean set)
public void dispose(com.jogamp.opengl.GLAutoDrawable drawable)
dispose in interface com.jogamp.opengl.GLEventListenerpublic void addMouseInputListener(javax.swing.event.MouseInputListener l)
public void removeMouseInputListener(javax.swing.event.MouseInputListener l)
public javax.swing.event.MouseInputListener[] getMouseInputListeners()
public void addMouseWheelListener(java.awt.event.MouseWheelListener l)
public void removeMouseWheelListener(java.awt.event.MouseWheelListener l)
public java.awt.event.MouseWheelListener[] getMouseWheelListeners()
public void reshape(com.jogamp.opengl.GLAutoDrawable drawable,
int x,
int y,
int w,
int h)
reshape in interface com.jogamp.opengl.GLEventListenerpublic double getViewPlaneHeight()
RenderergetViewPlaneHeight in interface Rendererpublic double getViewPlaneWidth()
RenderergetViewPlaneWidth in interface Rendererpublic void setPointSize(float s)
RenderersetPointSize in interface Renderers - new point size (in pixels).Renderer.getPointSize()public float getPointSize()
RenderergetPointSize in interface RendererRenderer.setPointSize(float)public void setLineWidth(float w)
RenderersetLineWidth in interface Rendererw - new line width (in pixels).Renderer.getLineWidth()public float getLineWidth()
RenderergetLineWidth in interface RendererRenderer.setLineWidth(float)public void setViewport(com.jogamp.opengl.GL gl,
int x,
int y,
int width,
int height)
public void setViewVolume(double near,
double far)
public void getViewMatrix(RigidTransform3d TWE)
RenderergetViewMatrix in interface RendererTWE - returns the current transform from world to eye coordinatespublic RigidTransform3d getViewMatrix()
RenderergetViewMatrix in interface Rendererpublic void getEyeToWorld(RigidTransform3d X)
ViewergetEyeToWorld in interface ViewerX - returns the eye-to-world transformpublic void setEyeToWorld(RigidTransform3d X)
setEyeToWorld in interface ViewerX - new EyeToWorld transformationpublic void setEyeToWorld(Point3d eye, Point3d center, Vector3d up)
lookat method.setEyeToWorld in interface Viewereye - position of the eye, in world coordinatescenter - point that the eye is looking at, in world coordinatesup - up direction, in world coordinatespublic void setModelMatrix2d(double left,
double right,
double bottom,
double top)
setModelMatrix2d in interface Rendererleft - 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 coordinatesRenderer.is2DRendering()public void 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.
setDepthOffset in interface Rendereroffset - new depth offset valuepublic int getDepthOffset()
Renderer.setDepthOffset(int) for
a description. The default value is 0.getDepthOffset in interface Rendererpublic void display(com.jogamp.opengl.GLAutoDrawable drawable)
display in interface com.jogamp.opengl.GLEventListenerpublic abstract void display(com.jogamp.opengl.GLAutoDrawable drawable,
int flags)
public void setBackgroundColor(float r,
float g,
float b)
public void setBackgroundColor(float[] rgba)
ViewersetBackgroundColor in interface Viewerrgba - RGB (if length 3) or RGBA values (if length 4) for the
background colorpublic void setBackgroundColor(java.awt.Color color)
ViewersetBackgroundColor in interface Viewercolor - new background colorpublic java.awt.Color getBackgroundColor()
ViewergetBackgroundColor in interface Viewerpublic float[] getBackgroundColor(float[] rgba)
Viewerrgba.
Otherwise, if this argument is null, an array is allocated
internally.getBackgroundColor in interface Viewerrgba - optional array for returning the valuespublic void setDefaultLights()
public boolean setLightingEnabled(boolean enable)
public boolean isLightingEnabled()
public boolean setVertexColoringEnabled(boolean enable)
public boolean isVertexColoringEnabled()
public boolean hasVertexColoring()
public Renderer.ColorInterpolation getColorInterpolation()
RenderergetColorInterpolation in interface Rendererpublic Renderer.ColorInterpolation setColorInterpolation(Renderer.ColorInterpolation interp)
setColorInterpolation in interface Rendererinterp - new color interpolationpublic boolean setTextureMappingEnabled(boolean enable)
public boolean isTextureMappingEnabled()
public abstract boolean hasVertexColorMixing(Renderer.ColorMixing cmix)
RendererhasVertexColorMixing in interface Renderertrue if the color mixing method is supportedpublic Renderer.ColorMixing setVertexColorMixing(Renderer.ColorMixing cmix)
RendererRenderer.hasVertexColorMixing(maspack.render.Renderer.ColorMixing) to test whether a method is suuported.setVertexColorMixing in interface Renderercmix - new color mixing methodpublic Renderer.ColorMixing getVertexColorMixing()
RenderergetVertexColorMixing in interface Rendererpublic abstract boolean hasColorMapMixing(Renderer.ColorMixing cmix)
RendererhasColorMapMixing in interface Renderertrue if the color mixing method is supportedpublic ColorMapProps setColorMap(ColorMapProps props)
Rendererprops, 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.setColorMap in interface Rendererprops - properties for the color map, or null
to disablepublic ColorMapProps getColorMap()
Renderernull if no color map is currently set or color mapping
is not supported.getColorMap in interface RendererRenderer.setColorMap(maspack.render.ColorMapProps)public NormalMapProps setNormalMap(NormalMapProps props)
Rendererprops, 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.
setNormalMap in interface Rendererprops - properties for the normal mapping, or null
to disablepublic NormalMapProps getNormalMap()
Renderernull if no normal mapping has been set or normal mapping
is not supported.getNormalMap in interface RendererRenderer.setNormalMap(maspack.render.NormalMapProps)public BumpMapProps setBumpMap(BumpMapProps props)
Rendererprops, 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.
setBumpMap in interface Rendererprops - properties for the bump mapping, or null
to disablepublic BumpMapProps getBumpMap()
Renderernull if no bump mapping has been set or bump mapping
is not supported.getBumpMap in interface RendererRenderer.setBumpMap(maspack.render.BumpMapProps)public boolean setDepthEnabled(boolean set)
public boolean isDepthEnabled()
public boolean setDepthWriteEnabled(boolean set)
public boolean isDepthWriteEnabled()
public Renderer.Shading setShading(Renderer.Shading shading)
RendererRenderer.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.setShading in interface Renderershading - new shading model to be usedpublic Renderer.Shading getShading()
RendererRenderer.Shading.NONE turns off lighting and causes primitives to be
rendered in solid colors, using the current diffuse color.getShading in interface Rendererpublic boolean setRoundedPoints(boolean enable)
public boolean getRoundedPoints()
public boolean isTransparencyEnabled()
public void setTransparencyEnabled(boolean enable)
public boolean isBlendingEnabled()
public void setBlendingEnabled(boolean set)
public GLViewer.BlendFactor getBlendSourceFactor()
public void setBlendSourceFactor(GLViewer.BlendFactor factor)
public GLViewer.BlendFactor getBlendDestFactor()
public void setBlendDestFactor(GLViewer.BlendFactor factor)
public void setUpVector(Vector3d upVector)
ViewersetEyeToWorld (getEye(), getCenter(), up);
setUpVector in interface ViewerupVector - new up vector, in world coordinatesViewer.getEye(),
Renderer.getCenter()public Vector3d getUpVector()
ViewergetUpVector in interface ViewerViewer.setUpVector(maspack.matrix.Vector3d),
Viewer.setCenter(maspack.matrix.Point3d),
Viewer.setEye(maspack.matrix.Point3d)public boolean hasSelection()
hasSelection in interface Renderertrue if selection is supported.public boolean isSelecting()
isSelecting in interface Rendererpublic boolean setHighlightStyle(Renderer.HighlightStyle style)
ViewerRenderer.HighlightStyle.NONE,
then highlighting is deactivated.
Not all highlighting styles may be supported; if the specified
style is not supported this method does nothing and returns
false.setHighlightStyle in interface Viewerstyle - highlighting style to be settrue if the highlighting style is supported.Viewer.hasHighlightStyle(maspack.render.Renderer.HighlightStyle)public boolean hasHighlightStyle(Renderer.HighlightStyle style)
Viewertrue if this viewer supports the indicated
highlighting style.hasHighlightStyle in interface Viewertrue if style is supportedpublic Renderer.HighlightStyle getHighlightStyle()
RendererRenderer.HighlightStyle.NONE indicates that
highlighting is deactivated.getHighlightStyle in interface Rendererpublic void setHighlightColor(java.awt.Color color)
public void getHighlightColor(float[] rgba)
RendererRenderer.HighlightStyle.COLOR.getHighlightColor in interface Rendererrgba - array of length 3 or 4 in which the RGB or RGBA components
of the highlight color are returned.public void setSelectingColor(java.awt.Color color)
public void setSelectingColor(float r,
float g,
float b,
float a)
r - redg - greenb - bluea - alphapublic void getSelectingColor(float[] rgba)
public Renderer.FaceStyle setFaceStyle(Renderer.FaceStyle style)
RendererRenderer.FaceStyle.FRONT.setFaceStyle in interface Rendererstyle - new face styleRenderer.getFaceStyle()public Renderer.FaceStyle getFaceStyle()
RenderergetFaceStyle in interface RendererRenderer.setFaceStyle(maspack.render.Renderer.FaceStyle)public void setSelectionEnabled(boolean selection)
ViewerRenderer.hasSelection() returns
false, then this method does nothing.setSelectionEnabled in interface Viewerselection - if true, enables selectionpublic boolean isSelectionEnabled()
Viewertrue if viewer-based selection is enabled.isSelectionEnabled in interface Viewerfalse if selection is disabled or not supported.public void setSelectOnPress(boolean enable)
public boolean getSelectOnPress()
public void setEllipticSelection(boolean enable)
public boolean getEllipticSelection()
public Point3d getCenter()
Rendererpublic void setCenter(Point3d c)
setCenter in interface Viewerc - new center location, in world coordinatesgetUpVector()public Point3d getEye()
Viewerpublic void setEye(Point3d eye)
setEye in interface Viewereye - new eye location, in world coordinatesgetCenter(),
getUpVector()public RigidTransform3d getCenterToWorld()
public int getCellDivisions()
public double getCellSize()
public GLGridPlane getGrid()
public Light addLight(float[] position, float[] ambient, float[] diffuse, float[] specular)
public int addLight(Light light)
ViewerChanges to the lighting caused by adding or removing lights, or by changing the properties of existing lights, will take effect at the beginning of the next repaint step.
public void removeLight(int i)
ViewerChanges to the lighting caused by adding or removing lights, or by changing the properties of existing lights, will take effect at the beginning of the next repaint step.
removeLight in interface Vieweri - index of the light to be removedpublic boolean removeLight(Light light)
ViewerChanges to the lighting caused by adding or removing lights, or by changing the properties of existing lights, will take effect at the beginning of the next repaint step.
removeLight in interface Viewerlight - light to be removedtrue if the viewer contained the light
and it was removedpublic Light getLight(int i)
Viewerpublic int getIndexOfLight(Light light)
ViewergetIndexOfLight in interface Viewerlight - light for which an index is soughtpublic int numLights()
Viewerpublic abstract void setupScreenShot(int w,
int h,
int samples,
java.io.File file,
java.lang.String format)
w - width of shoth - height of shotsamples - number of samples to use for the
multisample FBO (does antialiasing)file - file to which the screen shot should be writtenformat - format stringpublic abstract void awaitScreenShotCompletion()
public boolean setAutoResizeEnabled(boolean enabled)
public boolean isAutoResizeEnabled()
public boolean setAutoViewportEnabled(boolean enabled)
public boolean isAutoViewportEnabled()
public abstract void setupScreenShot(int w,
int h,
java.io.File file,
java.lang.String format)
public abstract boolean grabPending()
public void setRotationMode(GLViewer.RotationMode mode)
public GLViewer.RotationMode getRotationMode()
public boolean setTransparencyFaceCulling(boolean enable)
public boolean getTransparencyFaceCulling()
public Vector3d getEyeZDirection()
RenderergetEyeZDirection in interface Rendererpublic void setGlobalRenderFlags(int flags)
public int getRenderFlags()
public boolean begin2DRendering()
Rendererfalse
if 2D rendering is not supported. This method behaves identically
to Renderer.begin2DRendering(double,double), only with the existing
screen width and height used for w and h.begin2DRendering in interface Renderertrue if 2D rendering is supportedRenderer.getScreenWidth(),
Renderer.getScreenHeight(),
Renderer.has2DRendering()public boolean has2DRendering()
Renderertrue if this Renderer supports 2D rendering mode.has2DRendering in interface Renderertrue if 2D rendering is supportedRenderer.is2DRendering()public void begin2DRendering(double left,
double right,
double bottom,
double top)
public void finish2DRendering()
public boolean begin2DRendering(double w,
double h)
Rendererfalse
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.begin2DRendering in interface Rendererw - width of the screen coordinatesh - height of the screen coordinatestrue if 2D rendering is supportedRenderer.has2DRendering()public void end2DRendering()
Rendererend2DRendering in interface Rendererpublic boolean is2DRendering()
Rendereris2DRendering in interface Renderertrue if in 2D rendering mode.public int numSelectionQueriesNeeded()
public void beginSelectionQuery(int idx)
Rendererqid. If the rendering that occurs between this call and the
subsequent call to Renderer.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.beginSelectionQuery in interface Rendereridx - identifier for the selection queryRenderer.endSelectionQuery()public void endSelectionQuery()
RendererRenderer.beginSelectionQuery(int).endSelectionQuery in interface RendererRenderer.beginSelectionQuery(int)public void beginSubSelection(IsSelectable s, int idx)
RendererIsSelectable
sthat
manages its own selection; this call should
be used in place of Renderer.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.beginSubSelection in interface Renderers - Selectable that is managing its own sub-selectionidx - current selection query identifierpublic void endSubSelection()
RendererRenderer.beginSubSelection(maspack.render.IsSelectable, int).endSubSelection in interface RendererRenderer.endSubSelection()public void setSelectionFilter(ViewerSelectionFilter filter)
ViewersetSelectionFilter in interface Viewerfilter - Selection filter to be appliedpublic ViewerSelectionFilter getSelectionFilter()
ViewergetSelectionFilter in interface Viewernull if there is none.public boolean isSelectable(IsSelectable s)
Renderers 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.isSelectable in interface Rendererpublic GLMouseListener getMouseHandler()
public void setMouseHandler(GLMouseListener handler)
public abstract void cleanupScreenShots()
public void clearPickMatrix()
public void setModelMatrix(AffineTransform3dBase m)
RenderersetModelMatrix in interface Rendererm - new model matrix valuepublic void setViewMatrix(RigidTransform3d v)
ViewersetViewMatrix in interface Viewerv - transform from world to eye coordinates.public void getModelMatrix(AffineTransform3d m)
RenderergetModelMatrix in interface Rendererm - returns the current model matrix valuepublic AffineTransform3dBase getModelMatrix()
RendererRigidTransform3d;
otherwise, it is a more general AffineTransform3d.getModelMatrix in interface Rendererpublic void translateModelMatrix(Vector3d t)
public void translateModelMatrix(double tx,
double ty,
double tz)
Renderer[ 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 ]
translateModelMatrix in interface Renderertx - translation along xty - translation along ytz - translation along zpublic void rotateModelMatrix(double zdeg,
double ydeg,
double xdeg)
Rendererzdeg 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 ]
rotateModelMatrix in interface Rendererzdeg - rotation about z axis (degrees)ydeg - rotation about new y axis (degrees)xdeg - rotation about new x axis (degrees)public void scaleModelMatrix(double s)
Renderer[ 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 ]
scaleModelMatrix in interface Renderers - scale factorpublic void scaleModelMatrix(double sx,
double sy,
double sz)
public void mulModelMatrix(AffineTransform3dBase trans)
RendererRigidTransform3d 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 ]
mulModelMatrix in interface Renderertrans - transform to multiply the model matrix bypublic void getModelMatrix(Matrix4d X)
public void getViewMatrix(Matrix4d X)
public void getProjectionMatrix(Matrix4d X)
public Matrix4d getProjectionMatrix()
public void setTextureMatrix(AffineTransform2dBase T)
RenderersetTextureMatrix in interface RendererT - new texture transform matrixpublic AffineTransform2dBase getTextureMatrix()
RendererRigidTransform2d;
otherwise, it is a more general AffineTransform2d.getTextureMatrix in interface Rendererpublic void getTextureMatrix(AffineTransform2d X)
RenderergetTextureMatrix in interface RendererX - returns the current texture matrix valueRenderer.setTextureMatrix(AffineTransform2dBase)public void pushViewMatrix()
public boolean popViewMatrix()
public void pushModelMatrix()
RendererpushModelMatrix in interface Rendererpublic boolean popModelMatrix()
RendererpopModelMatrix in interface Rendererfalse if the model matrix stack is emptypublic void pushProjectionMatrix()
public boolean popProjectionMatrix()
public void pushTextureMatrix()
public boolean popTextureMatrix()
public int numFreeClipPlanes()
public int getMaxGLClipPlanes()
public GLClipPlane addClipPlane()
public GLClipPlane addClipPlane(RigidTransform3d X, double size)
public boolean addClipPlane(GLClipPlane clipPlane)
public GLClipPlane getClipPlane(int idx)
public int getNumClipPlanes()
public GLClipPlane[] getClipPlanes()
public boolean removeClipPlane(GLClipPlane clipPlane)
public void clearClipPlanes()
public void drawSphere(Vector3d pnt, double rad)
RendererRenderer.getSurfaceResolution().drawSphere in interface Rendererpnt - center of the sphererad - radius of the spherepublic void drawCube(Vector3d pnt, double w)
Rendererpublic void drawBox(Vector3d pnt, Vector3d widths)
Rendererpublic void drawCylinder(Vector3d pnt0, Vector3d pnt1, double rad, boolean capped)
RendererRenderer.getSurfaceResolution().drawCylinder in interface Rendererpnt0 - first end pointpnt1 - second end pointrad - radius of the cylindercapped - if true, indicates that the cylinder
should have a solid cap on each endpublic void drawSpindle(Vector3d pnt0, Vector3d pnt1, double rad)
RendererRenderer.getSurfaceResolution().drawSpindle in interface Rendererpnt0 - first end pointpnt1 - second end pointrad - radius of the spindlepublic void drawCone(Vector3d pnt0, Vector3d pnt1, double rad0, double rad1, boolean capped)
RendererRenderer.getSurfaceResolution().public void drawArrow(Vector3d pnt0, Vector3d pnt1, double rad, boolean capped)
Rendererrad, 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 Renderer.getSurfaceResolution().public void drawLine(RenderProps props, float[] pnt0, float[] pnt1, boolean highlight)
Rendererprops.
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.
public void drawLine(RenderProps props, float[] pnt0, float[] pnt1, boolean capped, boolean highlight)
Rendererprops. This method is functionally
equivalent to Renderer.drawLine(RenderProps,float[],float[],boolean),
except for the additional control provided by the argument
capped.drawLine in interface Rendererprops - 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 linepublic void drawPoint(Vector3d pnt)
Rendererpnt 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.public void drawPoint(double px,
double py,
double pz)
Rendererpx, py and
pz in model coordinates, using the current point size,
material, and shading. This method is functionally equivalent to
Renderer.drawPoint(Vector3d).public void drawLine(Vector3d pnt0, Vector3d pnt1)
RendererRenderer.Shading.NONE.public void drawLine(double px0,
double py0,
double pz0,
double px1,
double py1,
double pz1)
RendererRenderer.drawLine(Vector3d,Vector3d).public void drawTriangle(Vector3d pnt0, Vector3d pnt1, Vector3d pnt2)
RendererRenderer.Shading.NONE, the shading will be effectively flat.drawTriangle in interface Rendererpnt0 - first pointpnt1 - second pointpnt2 - third pointpublic void drawAxes(RigidTransform3d X, double len, int width, boolean highlight)
RendererX. 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.public void drawSolidAxes(RigidTransform3d X, double[] lens, double rad, boolean highlight)
RendererX. This method is functionally equivalent to Renderer.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.drawSolidAxes in interface RendererX - coordinate frame defining the axeslens - lengths for each axisrad - axis cylinder radiushighlight - if true, indicates that the axes should be
highlighted.public void drawSolidAxes(RigidTransform3d X, double len, double rad, boolean highlight)
RendererX. 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.drawSolidAxes in interface RendererX - coordinate frame defining the axeslen - axis lengthrad - axis cylinder radiushighlight - if true, indicates that the axes should be
highlighted.public abstract GLTextRenderer getTextRenderer()
public void setDefaultFont(java.awt.Font font)
RenderersetDefaultFont in interface Rendererfont - default font. The font size largely impacts
the resolution of the renderer characters. A value of at least
32pt is recommended.public java.awt.Font getDefaultFont()
RenderergetDefaultFont in interface Rendererpublic boolean hasTextRendering()
RendererhasTextRendering in interface Renderertrue if text rendering is supported.public java.awt.geom.Rectangle2D getTextBounds(java.awt.Font font,
java.lang.String str,
double emSize)
RenderergetTextBounds in interface Rendererfont - font to use for sizingstr - String of which to compute the bounding boxemSize - size of the 'em' unitpublic double drawText(java.lang.String str,
float[] pos,
double emSize)
Rendererpublic double drawText(java.awt.Font font,
java.lang.String str,
Vector3d pos,
double emSize)
RendererdrawText in interface Rendererfont - 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 coordinatespublic double drawText(java.lang.String str,
Vector3d pos,
double emSize)
Rendererpublic void dispose()
public 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.setHighlighting in interface Rendererenable - if true, enable highlighting.Renderer.getHighlightColor(float[])public boolean getHighlighting()
RenderergetHighlighting in interface Renderertrue if highlighting is enabledpublic void setFrontColor(float[] rgba)
RendererRenderer.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 Renderer.setBackColor(float[]).setFrontColor in interface Rendererrgba - 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.public float[] getColor(float[] rgba)
rgba - array to fill, or null to create new arraypublic float[] getFrontColor(float[] rgba)
Rendererrgba. 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).getFrontColor in interface Rendererrgba - optional storage of length 3 or 4 for returning either
the RGB or RGBA values.public void setBackColor(float[] rgba)
Rendererrgba 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.setBackColor in interface Rendererrgba - 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.public float[] getBackColor(float[] rgba)
Renderernull 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.getBackColor in interface Rendererrgba - optional storage of length 3 or 4 for returning either
the RGB or RGBA values.null
if no back color is set.public void setEmission(float[] rgb)
Renderer(0, 0, 0).setEmission in interface Rendererrgb - array of length 3 specifying RGB values in
the range [0,1].public float[] getEmission(float[] rgb)
Rendererrgb.
Otherwise, if rgb is null,
an array will be allocated for returning the RGB values.getEmission in interface Rendererrgb - optional storage for returning the RGB values.public void setSpecular(float[] rgb)
Renderer(0.1, 0.1, 0.1).setSpecular in interface Rendererrgb - array of length 3 specifying RGB values in
the range [0,1].public float[] getSpecular(float[] rgb)
Rendererrgb.
Otherwise, if rgb is null,
an array will be allocated for returning the RGB values.getSpecular in interface Rendererrgb - optional storage for returning the RGB values.public void setShininess(float s)
RendererRenderer.getShininess(). This should be in the
range [0,128], and the default value is 32.setShininess in interface Renderers - shininess parameterpublic float getShininess()
RenderergetShininess in interface Rendererpublic void setFrontAlpha(float a)
RenderersetFrontAlpha in interface Renderera - alpha value, in the range [0,1].public void setColor(float[] rgba,
boolean highlight)
Rendererrgba, 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);
public void setColor(float[] rgba)
Rendererrgba. This method also clears any back color that may be
present, and is therefore equivalent to calling
setFrontColor (rgba);
setBackColor (null);
public void setColor(float r,
float g,
float b)
RendererRenderer.setColor(float[]), only with alpha assumed to be 1.public void setColor(float r,
float g,
float b,
float a)
RendererRenderer.setColor(float[]).public void setColor(java.awt.Color color)
RendererRenderer.setColor(float[]), with the RGBA values being obtained
from the color components of color.public void setMaterial(float[] frontRgba,
float[] backRgba,
float shininess,
boolean selected)
public void setPropsColoring(RenderProps props, float[] rgba, boolean highlight)
Rendererrgba, 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.setPropsColoring in interface Rendererprops - 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 highlightingpublic void setLineColoring(RenderProps props, boolean highlight)
Rendererprops, 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 Renderer.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.
setLineColoring in interface Rendererprops - supplies the shininess and line color valueshighlight - if true, enables highlightingpublic void setPointColoring(RenderProps props, boolean highlight)
Rendererprops, 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 Renderer.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.
setPointColoring in interface Rendererprops - supplies the shininess and point color valueshighlight - if true, enables highlightingpublic void setEdgeColoring(RenderProps props, boolean highlight)
Rendererprops, 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 Renderer.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.
setEdgeColoring in interface Rendererprops - supplies the shininess and edge (or line) color valueshighlight - if true, enables highlightingpublic void setFaceColoring(RenderProps props, boolean highlight)
Rendererprops, 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 Renderer.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.
setFaceColoring in interface Rendererprops - supplies the shininess and front and back color valueshighlight - if true, enables highlightingpublic void setFaceColoring(RenderProps props, float[] rgba, boolean highlight)
Rendererrgba, 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 Renderer.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.
setFaceColoring in interface Rendererprops - 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 highlightingpublic Renderer.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().setPointShading in interface Rendererprops - properties giving the shading and point stylepublic Renderer.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().setLineShading in interface Rendererprops - properties giving the shading and line stylepublic Renderer.Shading setPropsShading(RenderProps props)
props.getShading().setPropsShading in interface Rendererprops - properties giving the shadingpublic void drawPoints(RenderObject robj)
RendererdrawPoints in interface Rendererrobj - render objectpublic void drawPoints(RenderObject robj, Renderer.PointStyle style, double rad)
RendererRenderer.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.drawPoints in interface Rendererrobj - render objectstyle - point style to use for drawingrad - radius for spheres or width for pixel-based pointspublic void drawPoints(RenderObject robj, int gidx, Renderer.PointStyle style, double rad)
RendererRenderer.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.drawPoints in interface Rendererrobj - render objectgidx - point group indexstyle - point style to use for drawingrad - radius for spheres or width for pixel-based pointspublic void drawLines(RenderObject robj)
Rendererpublic void drawLines(RenderObject robj, Renderer.LineStyle style, double rad)
RendererRenderer.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.public void drawLines(RenderObject robj, int gidx, Renderer.LineStyle style, double rad)
RendererRenderer.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.public void drawTriangles(RenderObject robj)
RendererdrawTriangles in interface Rendererrobj - render objectpublic void drawTriangles(RenderObject robj, int gidx)
RendererdrawTriangles in interface Rendererrobj - render objectgidx - triangle group indexpublic void draw(RenderObject robj)
Rendererpublic void drawVertices(RenderObject robj, VertexIndexArray idxs, Renderer.DrawMode mode)
RendererVertexIndexArray can detect whether or not it has been modified,
which allows for caching.drawVertices in interface Rendererrobj - render objectidxs - vertex indicesmode - drawing mode to be used for drawing the verticespublic void beginDraw(Renderer.DrawMode mode)
RendererglBegin() 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.public void addVertex(float px,
float py,
float pz)
RendereraddVertex in interface Rendererpx - vertex x coordinatepy - vertex y coordinatepz - vertex z coordinateRenderer.beginDraw(maspack.render.Renderer.DrawMode)public void setNormal(float nx,
float ny,
float nz)
RenderersetNormal call. The normal does not
need to be normalized.setNormal in interface Renderernx - normal x coordinateny - normal y coordinatenz - normal z coordinateRenderer.beginDraw(maspack.render.Renderer.DrawMode)public void setTextureCoord(float x,
float y)
RenderersetTexcoord call. The coordinate should
be within the range [0, 1]setTextureCoord in interface Rendererx - texture x coordinatey - texture y coordinateRenderer.beginDraw(maspack.render.Renderer.DrawMode)public void addVertex(double px,
double py,
double pz)
RendereraddVertex in interface Rendererpx - vertex x coordinatepy - vertex y coordinatepz - vertex z coordinateRenderer.beginDraw(maspack.render.Renderer.DrawMode)public void addVertex(Vector3d pnt)
RendereraddVertex in interface Rendererpnt - coordinates for the vertexRenderer.beginDraw(maspack.render.Renderer.DrawMode)public void addVertex(float[] pnt)
RendereraddVertex in interface Rendererpnt - coordinates for the vertexRenderer.beginDraw(maspack.render.Renderer.DrawMode)public void setNormal(double nx,
double ny,
double nz)
RendererRenderer.setNormal(float,float,float).setNormal in interface Renderernx - normal x coordinateny - normal y coordinatenz - normal z coordinateRenderer.beginDraw(maspack.render.Renderer.DrawMode)public void setNormal(Vector3d nrm)
RendererRenderer.setNormal(float,float,float).setNormal in interface Renderernrm - normal coordinatesRenderer.beginDraw(maspack.render.Renderer.DrawMode)public void setTextureCoord(double tx,
double ty)
RendererRenderer.setTextureCoord(float,float).setTextureCoord in interface Renderertx - texture x coordinatety - texture y coordinateRenderer.beginDraw(maspack.render.Renderer.DrawMode)public void setTextureCoord(Vector2d tex)
RendererRenderer.setTextureCoord(float,float).setTextureCoord in interface Renderertex - texture coordinatesRenderer.beginDraw(maspack.render.Renderer.DrawMode)public void endDraw()
RendererglEnd() in the old
GL specification.public abstract void maybeUpdateMaterials()
public void restoreDefaultState(boolean strictChecking)
RendererrestoreDefaultState in interface RendererstrictChecking - if true, enables strict
checking.public com.jogamp.opengl.GL beginGL()
getGL(), etc. Save the current
graphics state.public void endGL()
beginGL() was called.