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 |
Viewer.RotationMode, Viewer.ViewControlMask
Renderer.AxisDrawStyle, 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 double |
DEFAULT_AXIS_RADIUS_RATIO |
static GLViewer.BlendFactor |
DEFAULT_DST_BLENDING |
static boolean |
DEFAULT_ELLIPTIC_CURSOR_ACTIVE |
static Vector2d |
DEFAULT_ELLIPTIC_CURSOR_SIZE |
static Viewer.RotationMode |
DEFAULT_ROTATION_MODE |
static GLViewer.BlendFactor |
DEFAULT_SRC_BLENDING |
static Viewer.ViewControlMask |
DEFAULT_VIEW_CONTROL_MASK |
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()
Creates and add a clip plane to this viewer.
|
void |
addClipPlane(GLClipPlane clipPlane)
Adds a clip plane to this viewer.
|
GLClipPlane |
addClipPlane(RigidTransform3d X,
double size)
Creates and add a clip plane to this viewer.
|
void |
addDragger(Dragger3d d)
Adds an application-defined dragger fixture to this viewer.
|
void |
addKeyListener(java.awt.event.KeyListener l)
Adds a key listener to this viewer.
|
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)
Adds a mouse input listener to this viewer.
|
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
s that
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()
Removes all clip planes from this viewer.
|
void |
clearDraggers()
Removes all application-defined dragger fixtures from this viewer.
|
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 |
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 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(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(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,
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(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,
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 |
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(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() |
java.util.List<Dragger3d> |
getAllDraggers()
Returns a list of all draggers currently active for this viewer,
including those that are application-defined as well as those those that
are created internally.
|
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.
|
Renderer.AxisDrawStyle |
getAxisDrawStyle() |
double |
getAxisLength()
Queries the length used for rendering coordinate axes in this viewer.
|
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. |
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.
|
void |
getCenterToWorld(RigidTransform3d TCW)
Returns a transform from world coordinates to center coordinates, with the
axes aligned to match the current eyeToWorld transform.
|
GLClipPlane |
getClipPlane(int idx)
Returns the
idx -th clip plane held by this viewer. |
GLClipPlane[] |
getClipPlanes()
Returns all the clip planes currently held by this viewer.
|
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. |
java.awt.Component |
getComponent()
Queries the AWT component associated with this viewer.
|
com.jogamp.opengl.GLContext |
getContext()
Gets the "currently active" context.
|
java.awt.Font |
getDefaultFont()
Retrieves the default font.
|
int |
getDepthOffset()
The current depth offset level.
|
java.awt.Rectangle |
getDragBox()
Queries information about any drag box currently being displayed.
|
java.util.LinkedList<Dragger3d> |
getDraggers()
Returns a list of all application-defined draggers currently added to
this viewer.
|
Dragger3d |
getDrawTool()
Queries the draw tool, if any, for this viewer.
|
boolean |
getEllipticCursorActive()
Queries whether an elliptic cursor is active for this viewer.
|
Vector2d |
getEllipticCursorSize()
Queries the elliptic cursor size for this viewer.
|
boolean |
getEllipticSelection()
Queries whether elliptic selection is enabled for this viewer.
|
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() |
GridPlane |
getGrid()
Returns this viewer's grid.
|
boolean |
getGridVisible()
Queries whether the viewer grid is visible.
|
java.awt.Color |
getHighlightColor()
Queries the highlight color used by this viewer.
|
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()
Returns the key listeners currently added to this viewer.
|
Light |
getLight(int i)
Get a specified light by index in this viewer.
|
float |
getLineWidth()
Returns the current width for rendering lines, in pixels.
|
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()
Returns the mouse input listeners currently added to this viewer.
|
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()
Queries the number of clip planes currently held by this viewer.
|
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.
|
Viewer.RotationMode |
getRotationMode()
Queries the rotation mode that controls how the viewer responds to
interactive rotation requests.
|
boolean |
getRoundedPoints() |
java.awt.Cursor |
getScreenCursor()
Queries the screen cursor for this viewer.
|
int |
getScreenHeight()
Returns the screen height, in pixels
|
int |
getScreenWidth()
Returns the screen width, in pixels
|
int |
getScreenX()
Returns the x component of the origin of the component implementing this
viewer.
|
int |
getScreenY()
Returns the y component of the origin of the component implementing this
viewer.
|
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()
Returns true if "select on press" is enabled for the viewers.
|
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.
|
abstract GLTextRenderer |
getTextRenderer() |
AffineTransform2dBase |
getTextureMatrix()
Gets the current texture matrix.
|
void |
getTextureMatrix(AffineTransform2d X)
Gets the current texture matrix.
|
boolean |
getTransparencyBlending() |
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.
|
Viewer.ViewControlMask |
getViewControlMask()
Queries the view control mask.
|
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 |
isDepthEnabled() |
boolean |
isDepthWriteEnabled() |
boolean |
isLightingEnabled() |
boolean |
isMultiSampleEnabled() |
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.
|
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() |
int |
maxClipSurfaces()
Queries the maximum number of clip surfaces available to this viewer.
|
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 |
numFreeClipSurfaces()
Queries the number of clip surfaces currently available to this viewer.
|
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)
Removes a clip plane from this viewer.
|
void |
removeDragger(Dragger3d d)
Removes an application-defined dragger fixture from this viewer.
|
void |
removeKeyListener(java.awt.event.KeyListener l)
Removes a key listener from this viewer.
|
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)
Removes a mouse input listener from this viewer.
|
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()
Resets the elliptic cursor size for this viewer to its default value.
|
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 |
setAxisDrawStyle(Renderer.AxisDrawStyle style) |
void |
setAxisLength(double len)
Sets the length used for rendering coordinate axes in this viewer.
|
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.
|
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)
Sets the background color for this viewer.
|
void |
setBlendDestFactor(GLViewer.BlendFactor factor) |
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 |
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 |
setDragBox(java.awt.Rectangle box)
Sets a drag box to be displayed by the viewer.
|
void |
setDrawTool(Dragger3d d)
Sets the draw tool for this viewer.
|
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)
Sets whether an elliptic cursor is active for this viewer.
|
void |
setEllipticCursorSize(Vector2d size)
Sets the elliptic cursor size for this viewer.
|
void |
setEllipticSelection(boolean enable)
Set whether elliptic selection is enabled for this viewer.
|
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 |
setGridSizeAndPosition(Point3d pcenter,
double r)
Sets the position and minimum size of the viewer grid.1`
|
void |
setGridVisible(boolean visible)
Sets the viewer grid to be visible.
|
void |
setHighlightColor(java.awt.Color color)
Sets the highlight color used by this viewer.
|
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)
Calls
Viewer.autoFitOrtho() or Viewer.autoFitPerspective() depending on
whether enable is true or false . |
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(Viewer.RotationMode mode)
Sets the rotation mode that controls how the viewer responds to
interactive rotation requests specified as horizontal and vertical
angular displacements in the view plane.
|
boolean |
setRoundedPoints(boolean enable) |
void |
setScreenCursor(java.awt.Cursor cursor)
Sets the screen cursor for this viewer.
|
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)
Set whether or not selection is done when the mouse is pressed.
|
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 |
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 |
setTransparencyBlending(boolean set) |
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 |
setViewControlMask(Viewer.ViewControlMask mask)
Sets the view control mask that constrains view control motions
to either the x or y screens axes.
|
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 |
translate(double delx,
double dely)
Translate the eye position with respect to the x-y plane of the eye
frame.
|
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, wait
drawArrow, 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, hasNormalMapping
public static boolean useGLJPanel
public static GLViewer.BlendFactor DEFAULT_SRC_BLENDING
public static GLViewer.BlendFactor DEFAULT_DST_BLENDING
public static double DEFAULT_AXIS_RADIUS_RATIO
public static final double AUTO_FIT
public static Viewer.RotationMode DEFAULT_ROTATION_MODE
public static Viewer.ViewControlMask DEFAULT_VIEW_CONTROL_MASK
public static Vector2d DEFAULT_ELLIPTIC_CURSOR_SIZE
public static boolean DEFAULT_ELLIPTIC_CURSOR_ACTIVE
public static PropertyList myProps
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
public 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 HasProperties
name
- name of the desired property or sub-propertypublic void setProfiling(boolean enable)
public boolean getProfiling()
public Vector2d getEllipticCursorSize()
getEllipticCursorSize
in interface Viewer
public void setEllipticCursorSize(Vector2d size)
setEllipticCursorSize
in interface Viewer
size
- new elliptic cursor sizepublic void resetEllipticCursorSize()
resetEllipticCursorSize
in interface Viewer
public boolean getEllipticCursorActive()
getEllipticCursorActive
in interface Viewer
true
if an elliptic cursor is activepublic void setEllipticCursorActive(boolean active)
setEllipticCursorActive
in interface Viewer
active
- de true}, activates an elliptic cursorpublic int getSurfaceResolution()
Renderer
getSurfaceResolution
in interface Renderer
Renderer.setSurfaceResolution(int)
public int setSurfaceResolution(int nres)
Renderer
setSurfaceResolution
in interface Renderer
nres
- resolution for curved surfacespublic void setAxisLength(double len)
<= 0
implies that coordinate axes will not be rendered.setAxisLength
in interface Viewer
len
- axis rendering lengthpublic double getAxisLength()
getAxisLength
in interface Viewer
public void setAxisDrawStyle(Renderer.AxisDrawStyle style)
public Renderer.AxisDrawStyle getAxisDrawStyle()
public double getAxisRadiusRatio()
Renderer.setAxisRadiusRatio(double)
for
more information.getAxisRadiusRatio
in interface Renderer
public void setAxisRadiusRatio(double ratio)
setAxisRadiusRatio
in interface Renderer
ratio
- new axis render ratiopublic void setGridVisible(boolean visible)
setGridVisible
in interface Viewer
visible
- if true
, makes the grid visiblepublic boolean getGridVisible()
getGridVisible
in interface Viewer
true
if the grid is visiblepublic java.awt.event.KeyListener[] getKeyListeners()
getKeyListeners
in interface Viewer
public void addKeyListener(java.awt.event.KeyListener l)
addKeyListener
in interface Viewer
l
- listener to be addedpublic void removeKeyListener(java.awt.event.KeyListener l)
removeKeyListener
in interface Viewer
l
- listener to be removedpublic java.util.LinkedList<Dragger3d> getDraggers()
Viewer
getDraggers
in interface Viewer
public void addSelectionListener(ViewerSelectionListener l)
Viewer
addSelectionListener
in interface Viewer
l
- selection listener to addViewer.removeSelectionListener(maspack.render.ViewerSelectionListener)
public boolean removeSelectionListener(ViewerSelectionListener l)
Viewer
removeSelectionListener
in interface Viewer
l
- selection listener to removeViewer.addSelectionListener(maspack.render.ViewerSelectionListener)
public ViewerSelectionListener[] getSelectionListeners()
Viewer
getSelectionListeners
in interface Viewer
Viewer.addSelectionListener(maspack.render.ViewerSelectionListener)
,
Viewer.removeSelectionListener(maspack.render.ViewerSelectionListener)
public ViewerSelectionEvent getSelectionEvent()
public void addRenderListener(RenderListener l)
Viewer
addRenderListener
in interface Viewer
l
- render listener to add.public boolean removeRenderListener(RenderListener l)
Viewer
removeRenderListener
in interface Viewer
l
- render listener to removetrue
if l
was present and removed.public RenderListener[] getRenderListeners()
Viewer
getRenderListeners
in interface Viewer
public void addRenderable(IsRenderable d)
Viewer
addRenderable
in interface Viewer
d
- renderable to addpublic void addDragger(Dragger3d d)
addDragger
in interface Viewer
d
- dragger to addpublic void setDrawTool(Dragger3d d)
Viewer
setDrawTool
in interface Viewer
d
- draw tool to setpublic Dragger3d getDrawTool()
Viewer
getDrawTool
in interface Viewer
null
if there is nonepublic boolean removeRenderable(IsRenderable d)
Viewer
removeRenderable
in interface Viewer
d
- renderable to removetrue
if r
was present and removedpublic void removeDragger(Dragger3d d)
removeDragger
in interface Viewer
d
- dragger to removepublic void clearDraggers()
Viewer
clearDraggers
in interface Viewer
public java.util.List<Dragger3d> getAllDraggers()
Viewer
This method is intended for use by the mouse input handler that manages dragger activity.
getAllDraggers
in interface Viewer
public void clearRenderables()
Viewer
clearRenderables
in interface Viewer
public double getViewPlaneDistance()
Renderer
getViewPlaneDistance
in interface Renderer
Renderer.getFarPlaneDistance()
public double getFarPlaneDistance()
Renderer
getFarPlaneDistance
in interface Renderer
Renderer.getViewPlaneDistance()
public double getVerticalFieldOfView()
autoFitOrtho
.getVerticalFieldOfView
in interface Viewer
public void setVerticalFieldOfView(double fov)
autoFitOrtho
.setVerticalFieldOfView
in interface Viewer
fov
- vertical field of view (degrees).public void repaint()
Viewer
public void paint()
public void setExternalRenderList(RenderList list)
Viewer
Viewer.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 Viewer
list
- new external render list, or null
to clear
the external listpublic RenderList getExternalRenderList()
Viewer
null
if the viewer does not have an external render list.getExternalRenderList
in interface Viewer
public void rerender(int flags)
public boolean isSpecialRenderFlagsSet()
public void rerender()
Viewer
Viewer.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 Viewer
left
- 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 Viewer
fieldOfView
- 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 Viewer
fieldHeight
- 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)
Viewer
setOrthogonal
in interface Viewer
left
- 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()
true
if this renderer is currently configured for
orthogonal projection.isOrthogonal
in interface Renderer
isOrthogonal
in interface Viewer
true
if projection is orthogonalpublic void setOrthographicView(boolean enable)
Viewer.autoFitOrtho()
or Viewer.autoFitPerspective()
depending on
whether enable
is true
or false
.setOrthographicView
in interface Viewer
enable
- enables (and auto-fits) orthographic view if true
and
perspective view if false
public double estimateRadiusAndCenter(Point3d center)
public void autoFit()
Viewer
Viewer.autoFitOrtho()
or Viewer.autoFitPerspective()
,
depending on whether the current view is orthogonal or perspective.public void setGridSizeAndPosition(Point3d pcenter, double r)
Viewer
setGridSizeAndPosition
in interface Viewer
pcenter
- position of the grid centerr
- radius value, which equals 1/4 the minimum sizepublic 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 Viewer
Viewer.setUpVector(maspack.matrix.Vector3d)
,
Viewer.getUpVector()
public void autoFitOrtho()
Viewer
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. The eye frame orientation is adjusted so that
its $y$ axis is parallel to the current value of the ``up'' vector.autoFitOrtho
in interface Viewer
Viewer.setUpVector(maspack.matrix.Vector3d)
,
Viewer.getUpVector()
public java.awt.Component getComponent()
getComponent
in interface Viewer
public int getScreenWidth()
getScreenWidth
in interface Renderer
public int getScreenHeight()
getScreenHeight
in interface Renderer
public int getScreenX()
getScreenX
in interface Viewer
public int getScreenY()
getScreenY
in interface Viewer
public void setScreenCursor(java.awt.Cursor cursor)
setScreenCursor
in interface Viewer
cursor
- new screen cursorpublic java.awt.Cursor getScreenCursor()
getScreenCursor
in interface Viewer
public com.jogamp.opengl.GL getGL()
getGL
in interface GLRenderer
public void setAutoSwapBufferMode(boolean enable)
public boolean getAutoSwapBufferMode()
public com.jogamp.opengl.GLContext getContext()
public void rotate(double xang, double yang)
public void translate(double delx, double dely)
public void zoom(double s)
public double distancePerPixel(Vector3d pnt)
distancePerPixel
in interface Renderer
pnt
- point undergoing the displacementpublic double centerDistancePerPixel()
centerDistancePerPixel
in interface Renderer
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 Viewer
REW
- 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 Viewer
Viewer.setAxialView(maspack.matrix.AxisAlignedRotation)
public GLDrawableComponent getCanvas()
public void init(com.jogamp.opengl.GLAutoDrawable drawable)
init
in interface com.jogamp.opengl.GLEventListener
public boolean isMultiSampleEnabled()
public int numMultiSamples()
public void setMultiSampleEnabled(boolean set)
public void dispose(com.jogamp.opengl.GLAutoDrawable drawable)
dispose
in interface com.jogamp.opengl.GLEventListener
public void addMouseInputListener(javax.swing.event.MouseInputListener l)
Viewer
addMouseInputListener
in interface Viewer
l
- listener to be addedpublic void removeMouseInputListener(javax.swing.event.MouseInputListener l)
removeMouseInputListener
in interface Viewer
l
- listener to be removedpublic javax.swing.event.MouseInputListener[] getMouseInputListeners()
getMouseInputListeners
in interface Viewer
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.GLEventListener
public double getViewPlaneHeight()
Renderer
getViewPlaneHeight
in interface Renderer
public double getViewPlaneWidth()
Renderer
getViewPlaneWidth
in interface Renderer
public void setPointSize(float s)
Renderer
setPointSize
in interface Renderer
s
- new point size (in pixels).Renderer.getPointSize()
public float getPointSize()
Renderer
getPointSize
in interface Renderer
Renderer.setPointSize(float)
public void setLineWidth(float w)
Renderer
setLineWidth
in interface Renderer
w
- new line width (in pixels).Renderer.getLineWidth()
public float getLineWidth()
Renderer
getLineWidth
in interface Renderer
Renderer.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)
Renderer
getViewMatrix
in interface Renderer
TWE
- returns the current transform from world to eye coordinatespublic RigidTransform3d getViewMatrix()
Renderer
getViewMatrix
in interface Renderer
public void getEyeToWorld(RigidTransform3d X)
Viewer
getEyeToWorld
in interface Viewer
X
- returns the eye-to-world transformpublic void setEyeToWorld(RigidTransform3d X)
setEyeToWorld
in interface Viewer
X
- new EyeToWorld transformationpublic void setEyeToWorld(Point3d eye, Point3d center, Vector3d up)
lookat
method.setEyeToWorld
in interface Viewer
eye
- 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 Renderer
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 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 Renderer
offset
- new depth offset valuepublic int getDepthOffset()
Renderer.setDepthOffset(int)
for
a description. The default value is 0.getDepthOffset
in interface Renderer
public void display(com.jogamp.opengl.GLAutoDrawable drawable)
display
in interface com.jogamp.opengl.GLEventListener
public abstract void display(com.jogamp.opengl.GLAutoDrawable drawable, int flags)
public void setBackgroundColor(float r, float g, float b)
Viewer
setBackgroundColor
in interface Viewer
r
- red color componentg
- red color componentb
- red color componentpublic void setBackgroundColor(float[] rgba)
Viewer
setBackgroundColor
in interface Viewer
rgba
- RGB (if length 3) or RGBA values (if length 4) for the
background colorpublic void setBackgroundColor(java.awt.Color color)
setBackgroundColor
in interface Viewer
color
- new background colorpublic java.awt.Color getBackgroundColor()
getBackgroundColor
in interface Viewer
public float[] getBackgroundColor(float[] rgba)
Viewer
rgba
.
Otherwise, if this argument is null
, an array is allocated
internally.getBackgroundColor
in interface Viewer
rgba
- 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()
Renderer
getColorInterpolation
in interface Renderer
public Renderer.ColorInterpolation setColorInterpolation(Renderer.ColorInterpolation interp)
setColorInterpolation
in interface Renderer
interp
- new color interpolationpublic boolean setTextureMappingEnabled(boolean enable)
public boolean isTextureMappingEnabled()
public abstract boolean hasVertexColorMixing(Renderer.ColorMixing cmix)
Renderer
hasVertexColorMixing
in interface Renderer
true
if the color mixing method is supportedpublic Renderer.ColorMixing setVertexColorMixing(Renderer.ColorMixing cmix)
Renderer
Renderer.hasVertexColorMixing(maspack.render.Renderer.ColorMixing)
to test whether a method is suuported.setVertexColorMixing
in interface Renderer
cmix
- new color mixing methodpublic Renderer.ColorMixing getVertexColorMixing()
Renderer
getVertexColorMixing
in interface Renderer
public abstract boolean hasColorMapMixing(Renderer.ColorMixing cmix)
Renderer
hasColorMapMixing
in interface Renderer
true
if the color mixing method is supportedpublic ColorMapProps setColorMap(ColorMapProps props)
Renderer
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.setColorMap
in interface Renderer
props
- properties for the color map, or null
to disablepublic ColorMapProps getColorMap()
Renderer
null
if no color map is currently set or color mapping
is not supported.getColorMap
in interface Renderer
Renderer.setColorMap(maspack.render.ColorMapProps)
public NormalMapProps setNormalMap(NormalMapProps props)
Renderer
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
.
setNormalMap
in interface Renderer
props
- properties for the normal mapping, or null
to disablepublic NormalMapProps getNormalMap()
Renderer
null
if no normal mapping has been set or normal mapping
is not supported.getNormalMap
in interface Renderer
Renderer.setNormalMap(maspack.render.NormalMapProps)
public BumpMapProps setBumpMap(BumpMapProps props)
Renderer
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
.
setBumpMap
in interface Renderer
props
- properties for the bump mapping, or null
to disablepublic BumpMapProps getBumpMap()
Renderer
null
if no bump mapping has been set or bump mapping
is not supported.getBumpMap
in interface Renderer
Renderer.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)
Renderer
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.setShading
in interface Renderer
shading
- new shading model to be usedpublic Renderer.Shading getShading()
Renderer
Renderer.Shading.NONE
turns off lighting and causes primitives to be
rendered in solid colors, using the current diffuse color.getShading
in interface Renderer
public boolean setRoundedPoints(boolean enable)
public boolean getRoundedPoints()
public boolean isTransparencyEnabled()
public void setTransparencyEnabled(boolean enable)
public boolean getTransparencyBlending()
public void setTransparencyBlending(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)
Viewer
setEyeToWorld (getEye(), getCenter(), up);
setUpVector
in interface Viewer
upVector
- new up vector, in world coordinatesViewer.getEye()
,
Renderer.getCenter()
public Vector3d getUpVector()
Viewer
getUpVector
in interface Viewer
Viewer.setUpVector(maspack.matrix.Vector3d)
,
Viewer.setCenter(maspack.matrix.Point3d)
,
Viewer.setEye(maspack.matrix.Point3d)
public boolean hasSelection()
hasSelection
in interface Renderer
true
if selection is supported.public boolean isSelecting()
isSelecting
in interface Renderer
public boolean setHighlightStyle(Renderer.HighlightStyle style)
Viewer
Renderer.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 Viewer
style
- highlighting style to be settrue
if the highlighting style is supported.Viewer.hasHighlightStyle(maspack.render.Renderer.HighlightStyle)
public boolean hasHighlightStyle(Renderer.HighlightStyle style)
Viewer
true
if this viewer supports the indicated
highlighting style.hasHighlightStyle
in interface Viewer
true
if style
is supportedpublic Renderer.HighlightStyle getHighlightStyle()
Renderer.HighlightStyle.NONE
indicates that
highlighting is deactivated.getHighlightStyle
in interface Renderer
getHighlightStyle
in interface Viewer
public void setHighlightColor(java.awt.Color color)
setHighlightColor
in interface Viewer
color
- new highlight colorpublic void getHighlightColor(float[] rgba)
Renderer.HighlightStyle.COLOR
.getHighlightColor
in interface Renderer
rgba
- array of length 3 or 4 in which the RGB or RGBA components
of the highlight color are returned.public java.awt.Color getHighlightColor()
getHighlightColor
in interface Viewer
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)
Renderer
Renderer.FaceStyle.FRONT
.setFaceStyle
in interface Renderer
style
- new face styleRenderer.getFaceStyle()
public Renderer.FaceStyle getFaceStyle()
Renderer
getFaceStyle
in interface Renderer
Renderer.setFaceStyle(maspack.render.Renderer.FaceStyle)
public void setSelectionEnabled(boolean selection)
Viewer
Renderer.hasSelection()
returns
false
, then this method does nothing.setSelectionEnabled
in interface Viewer
selection
- if true
, enables selectionpublic boolean isSelectionEnabled()
Viewer
true
if viewer-based selection is enabled.isSelectionEnabled
in interface Viewer
false
if selection is disabled or not supported.public void setSelectOnPress(boolean enable)
Viewer
setSelectOnPress
in interface Viewer
enable
- Whether or not selection is enabled.public boolean getSelectOnPress()
Viewer
getSelectOnPress
in interface Viewer
public void setEllipticSelection(boolean enable)
Viewer
setEllipticSelection
in interface Viewer
enable
- if true
, enables elliptic selectionViewer.getEllipticSelection()
public boolean getEllipticSelection()
Viewer
getEllipticSelection
in interface Viewer
true
if elliptic selection is enabledViewer.setEllipticSelection(boolean)
public Point3d getCenter()
Renderer
public void setCenter(Point3d c)
setCenter
in interface Viewer
c
- new center location, in world coordinatesgetUpVector()
public Point3d getEye()
Viewer
public void setEye(Point3d eye)
setEye
in interface Viewer
eye
- new eye location, in world coordinatesgetCenter()
,
getUpVector()
public RigidTransform3d getCenterToWorld()
Viewer
Viewer.getCenterToWorld(RigidTransform3d)
, only with transform allocated and
returned.getCenterToWorld
in interface Viewer
public void getCenterToWorld(RigidTransform3d TCW)
getCenterToWorld
in interface Viewer
TCW
- returns the center-to-world transformpublic void setDragBox(java.awt.Rectangle box)
null
value means that no drag box should be
displayed.setDragBox
in interface Viewer
box
- drag box in screen coordinates, or null
if the drag box is to be removedpublic java.awt.Rectangle getDragBox()
getDragBox
in interface Viewer
null
if no box is currently being displayed.public int getCellDivisions()
public double getCellSize()
public GridPlane getGrid()
Viewer
public Light addLight(float[] position, float[] ambient, float[] diffuse, float[] specular)
public int addLight(Light light)
Viewer
Changes 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)
Viewer
Changes 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 Viewer
i
- index of the light to be removedpublic boolean removeLight(Light light)
Viewer
Changes 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 Viewer
light
- light to be removedtrue
if the viewer contained the light
and it was removedpublic Light getLight(int i)
Viewer
public int getIndexOfLight(Light light)
Viewer
getIndexOfLight
in interface Viewer
light
- light for which an index is soughtpublic int numLights()
Viewer
public 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(Viewer.RotationMode mode)
Viewer.RotationMode.FIXED_VERTICAL
.setRotationMode
in interface Viewer
mode
- new rotation modepublic Viewer.RotationMode getRotationMode()
Viewer.setRotationMode(maspack.render.Viewer.RotationMode)
.getRotationMode
in interface Viewer
public void setViewControlMask(Viewer.ViewControlMask mask)
setViewControlMask
in interface Viewer
mask
- new view control maskpublic Viewer.ViewControlMask getViewControlMask()
Viewer.setViewControlMask(maspack.render.Viewer.ViewControlMask)
.getViewControlMask
in interface Viewer
public boolean setTransparencyFaceCulling(boolean enable)
public boolean getTransparencyFaceCulling()
public Vector3d getEyeZDirection()
Renderer
getEyeZDirection
in interface Renderer
public void setGlobalRenderFlags(int flags)
public int getRenderFlags()
public boolean begin2DRendering()
Renderer
false
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 Renderer
true
if 2D rendering is supportedRenderer.getScreenWidth()
,
Renderer.getScreenHeight()
,
Renderer.has2DRendering()
public boolean has2DRendering()
Renderer
true
if this Renderer supports 2D rendering mode.has2DRendering
in interface Renderer
true
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)
Renderer
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.begin2DRendering
in interface Renderer
w
- width of the screen coordinatesh
- height of the screen coordinatestrue
if 2D rendering is supportedRenderer.has2DRendering()
public void end2DRendering()
Renderer
end2DRendering
in interface Renderer
public boolean is2DRendering()
Renderer
is2DRendering
in interface Renderer
true
if in 2D rendering mode.public int numSelectionQueriesNeeded()
public void beginSelectionQuery(int idx)
Renderer
qid
. 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 Renderer
idx
- identifier for the selection queryRenderer.endSelectionQuery()
public void endSelectionQuery()
Renderer
Renderer.beginSelectionQuery(int)
.endSelectionQuery
in interface Renderer
Renderer.beginSelectionQuery(int)
public void beginSubSelection(IsSelectable s, int idx)
Renderer
IsSelectable
s
that
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 Renderer
s
- Selectable that is managing its own sub-selectionidx
- current selection query identifierpublic void endSubSelection()
Renderer
Renderer.beginSubSelection(maspack.render.IsSelectable, int)
.endSubSelection
in interface Renderer
Renderer.endSubSelection()
public void setSelectionFilter(ViewerSelectionFilter filter)
Viewer
setSelectionFilter
in interface Viewer
filter
- Selection filter to be appliedpublic ViewerSelectionFilter getSelectionFilter()
Viewer
getSelectionFilter
in interface Viewer
null
if there is none.public boolean isSelectable(IsSelectable s)
Renderer
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.isSelectable
in interface Renderer
public GLMouseListener getMouseHandler()
public void setMouseHandler(GLMouseListener handler)
public abstract void cleanupScreenShots()
public void clearPickMatrix()
public void setModelMatrix(AffineTransform3dBase m)
Renderer
setModelMatrix
in interface Renderer
m
- new model matrix valuepublic void setViewMatrix(RigidTransform3d v)
Viewer
setViewMatrix
in interface Viewer
v
- transform from world to eye coordinates.public void getModelMatrix(AffineTransform3d m)
Renderer
getModelMatrix
in interface Renderer
m
- returns the current model matrix valuepublic AffineTransform3dBase getModelMatrix()
Renderer
RigidTransform3d
;
otherwise, it is a more general AffineTransform3d
.getModelMatrix
in interface Renderer
public 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 Renderer
tx
- translation along xty
- translation along ytz
- translation along zpublic void rotateModelMatrix(double zdeg, double ydeg, double xdeg)
Renderer
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 ]
rotateModelMatrix
in interface Renderer
zdeg
- 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 Renderer
s
- scale factorpublic void scaleModelMatrix(double sx, double sy, double sz)
public void mulModelMatrix(AffineTransform3dBase trans)
Renderer
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 ]
mulModelMatrix
in interface Renderer
trans
- 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)
Renderer
setTextureMatrix
in interface Renderer
T
- new texture transform matrixpublic AffineTransform2dBase getTextureMatrix()
Renderer
RigidTransform2d
;
otherwise, it is a more general AffineTransform2d
.getTextureMatrix
in interface Renderer
public void getTextureMatrix(AffineTransform2d X)
Renderer
getTextureMatrix
in interface Renderer
X
- returns the current texture matrix valueRenderer.setTextureMatrix(AffineTransform2dBase)
public void pushViewMatrix()
public boolean popViewMatrix()
public void pushModelMatrix()
Renderer
pushModelMatrix
in interface Renderer
public boolean popModelMatrix()
Renderer
popModelMatrix
in interface Renderer
false
if the model matrix stack is emptypublic void pushProjectionMatrix()
public boolean popProjectionMatrix()
public void pushTextureMatrix()
public boolean popTextureMatrix()
public int numFreeClipSurfaces()
Viewer.maxClipSurfaces()
minus the
number required by all the currently held clip planes, with the result
set to 0 if negative. Clipping will be curtailed if the number of
available surfaces is 0.numFreeClipSurfaces
in interface Viewer
public int maxClipSurfaces()
maxClipSurfaces
in interface Viewer
public GLClipPlane addClipPlane()
addClipPlane(null,0)
.addClipPlane
in interface Viewer
public GLClipPlane addClipPlane(RigidTransform3d X, double size)
addClipPlane
in interface Viewer
X
- transform specifying the clip plane pose with respect to world
coordinates. If null
, the pose is centered on the origin and
aligned with the current axial view.size
- visible width of the clip plane in each direction. If
<= 0
, this is set to a default value based on the current
viewing frustum.public void addClipPlane(GLClipPlane clipPlane)
addClipPlane
in interface Viewer
clipPlane
- clip plane to addpublic GLClipPlane getClipPlane(int idx)
idx
-th clip plane held by this viewer. idx
must be <
#getNumClipPlanes
.getClipPlane
in interface Viewer
idx
- index of the desired clip planeidx
-th clip planepublic int getNumClipPlanes()
getNumClipPlanes
in interface Viewer
public GLClipPlane[] getClipPlanes()
getClipPlanes
in interface Viewer
public boolean removeClipPlane(GLClipPlane clipPlane)
removeClipPlane
in interface Viewer
clipPlane
- clip plane to removetrue
if the clip plane was found and removedpublic void clearClipPlanes()
clearClipPlanes
in interface Viewer
public void drawSphere(Vector3d pnt, double rad)
Renderer
Renderer.getSurfaceResolution()
.drawSphere
in interface Renderer
pnt
- center of the sphererad
- radius of the spherepublic void drawCube(Vector3d pnt, double w)
Renderer
public void drawBox(Vector3d pnt, Vector3d widths)
Renderer
public void drawCylinder(Vector3d pnt0, Vector3d pnt1, double rad, boolean capped)
Renderer
Renderer.getSurfaceResolution()
.drawCylinder
in interface Renderer
pnt0
- 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)
Renderer
Renderer.getSurfaceResolution()
.drawSpindle
in interface Renderer
pnt0
- first end pointpnt1
- second end pointrad
- radius of the spindlepublic void drawCone(Vector3d pnt0, Vector3d pnt1, double rad0, double rad1, boolean capped)
Renderer
Renderer.getSurfaceResolution()
.public void drawArrow(Vector3d pnt0, Vector3d pnt1, double rad, boolean capped)
Renderer
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 Renderer.getSurfaceResolution()
.public void drawArrow(Vector3d pnt, Vector3d dir, double scale, double rad, boolean capped)
Renderer
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 Renderer.drawArrow(Vector3d,Vector3d,double,boolean)
.public void drawLine(RenderProps props, float[] pnt0, float[] pnt1, boolean highlight)
Renderer
props
. This method is functionally
equivalent to Renderer.drawLine(RenderProps,Vector3d,Vector3d,boolean)
except that the points are specified using float[]
.public void drawLine(RenderProps props, Vector3d pnt0, Vector3d pnt1, boolean highlight)
Renderer
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
.
public void drawRay(RenderProps props, Vector3d pnt, Vector3d dir, double scale, boolean highlight)
Renderer
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
.
public void drawLine(RenderProps props, float[] pnt0, float[] pnt1, boolean capped, boolean highlight)
Renderer
props
. 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 Renderer
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 linepublic void drawPoint(Vector3d pnt)
Renderer
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
.public void drawPoint(double px, double py, double pz)
Renderer
px
, 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 drawPoint(RenderProps props, Vector3d pnt, boolean highlight)
Renderer
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
.
public void drawLine(Vector3d pnt0, Vector3d pnt1)
Renderer
Renderer.Shading.NONE
.public void drawLine(double px0, double py0, double pz0, double px1, double py1, double pz1)
Renderer
Renderer.drawLine(Vector3d,Vector3d)
.public void drawTriangle(Vector3d pnt0, Vector3d pnt1, Vector3d pnt2)
Renderer
Renderer.Shading.NONE
, the shading will be effectively flat.drawTriangle
in interface Renderer
pnt0
- first pointpnt1
- second pointpnt2
- third pointpublic void drawAxes(RigidTransform3d X, Renderer.AxisDrawStyle style, double len, int width, double rad, boolean highlight)
Renderer
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.drawAxes
in interface Renderer
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 Renderer.getAxisRadiusRatio()
.highlight
- if true
, indicates that the axes should be
highlighted.public void drawAxes(RigidTransform3d X, Renderer.AxisDrawStyle style, double[] lens, int width, double rad, boolean highlight)
Renderer
X
. This method is identical to
Renderer.drawAxes(RigidTransform3d,AxisDrawStyle,double,int,double,boolean)
,
except that the length of each axis can be specified separately.drawAxes
in interface Renderer
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 Renderer.getAxisRadiusRatio()
.highlight
- if true
, indicates that the axes should be
highlighted.public void drawAxes(RigidTransform3d X, double len, int width, boolean highlight)
Renderer
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.public void drawSolidAxes(RigidTransform3d X, double[] lens, double rad, boolean highlight)
Renderer
X
. 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 Renderer
X
- coordinate frame defining the axeslens
- lengths for each axisrad
- axis cylinder radius. If , the radius is determined
automatically using the value returned by Renderer.getAxisRadiusRatio()
.highlight
- if true
, indicates that the axes should be
highlighted.public void drawSolidAxes(RigidTransform3d X, double len, double rad, boolean highlight)
Renderer
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.drawSolidAxes
in interface Renderer
X
- coordinate frame defining the axeslen
- axis lengthrad
- axis cylinder radius. If , the radius is determined
automatically using the value returned by Renderer.getAxisRadiusRatio()
.highlight
- if true
, indicates that the axes should be
highlighted.public abstract GLTextRenderer getTextRenderer()
public void setDefaultFont(java.awt.Font font)
Renderer
setDefaultFont
in interface Renderer
font
- 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()
Renderer
getDefaultFont
in interface Renderer
public boolean hasTextRendering()
Renderer
hasTextRendering
in interface Renderer
true
if text rendering is supported.public java.awt.geom.Rectangle2D getTextBounds(java.awt.Font font, java.lang.String str, double emSize)
Renderer
getTextBounds
in interface Renderer
font
- 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)
Renderer
public double drawText(java.awt.Font font, java.lang.String str, Vector3d pos, double emSize)
Renderer
drawText
in interface Renderer
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 coordinatespublic double drawText(java.lang.String str, Vector3d pos, double emSize)
Renderer
public 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 Renderer
enable
- if true
, enable highlighting.Renderer.getHighlightColor(float[])
public boolean getHighlighting()
Renderer
getHighlighting
in interface Renderer
true
if highlighting is enabledpublic void setFrontColor(float[] rgba)
Renderer
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 Renderer.setBackColor(float[])
.setFrontColor
in interface Renderer
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.public float[] getColor(float[] rgba)
rgba
- array to fill, or null to create new arraypublic float[] getFrontColor(float[] rgba)
Renderer
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)
.getFrontColor
in interface Renderer
rgba
- optional storage of length 3 or 4 for returning either
the RGB or RGBA values.public void setBackColor(float[] rgba)
Renderer
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
.setBackColor
in interface Renderer
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.public float[] getBackColor(float[] rgba)
Renderer
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.getBackColor
in interface Renderer
rgba
- 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 Renderer
rgb
- array of length 3 specifying RGB values in
the range [0,1].public float[] getEmission(float[] rgb)
Renderer
rgb
.
Otherwise, if rgb
is null
,
an array will be allocated for returning the RGB values.getEmission
in interface Renderer
rgb
- optional storage for returning the RGB values.public void setSpecular(float[] rgb)
Renderer
(0.1, 0.1, 0.1)
.setSpecular
in interface Renderer
rgb
- array of length 3 specifying RGB values in
the range [0,1].public float[] getSpecular(float[] rgb)
Renderer
rgb
.
Otherwise, if rgb
is null
,
an array will be allocated for returning the RGB values.getSpecular
in interface Renderer
rgb
- optional storage for returning the RGB values.public void setShininess(float s)
Renderer
Renderer.getShininess()
. This should be in the
range [0,128], and the default value is 32.setShininess
in interface Renderer
s
- shininess parameterpublic float getShininess()
Renderer
getShininess
in interface Renderer
public void setFrontAlpha(float a)
Renderer
setFrontAlpha
in interface Renderer
a
- alpha value, in the range [0,1].public void setColor(float[] rgba, boolean highlight)
Renderer
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);
public void setColor(float[] rgba)
Renderer
rgba
. 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)
Renderer
Renderer.setColor(float[])
, only with alpha assumed to be 1.public void setColor(float r, float g, float b, float a)
Renderer
Renderer.setColor(float[])
.public void setColor(java.awt.Color color)
Renderer
Renderer.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)
Renderer
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.setPropsColoring
in interface Renderer
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 highlightingpublic void setLineColoring(RenderProps props, boolean highlight)
Renderer
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 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 Renderer
props
- supplies the shininess and line color valueshighlight
- if true
, enables highlightingpublic void setPointColoring(RenderProps props, boolean highlight)
Renderer
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 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 Renderer
props
- supplies the shininess and point color valueshighlight
- if true
, enables highlightingpublic void setEdgeColoring(RenderProps props, boolean highlight)
Renderer
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 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 Renderer
props
- supplies the shininess and edge (or line) color valueshighlight
- if true
, enables highlightingpublic void setFaceColoring(RenderProps props, boolean highlight)
Renderer
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 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 Renderer
props
- supplies the shininess and front and back color valueshighlight
- if true
, enables highlightingpublic void setFaceColoring(RenderProps props, float[] rgba, boolean highlight)
Renderer
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 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 Renderer
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 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 Renderer
props
- 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 Renderer
props
- properties giving the shading and line stylepublic Renderer.Shading setPropsShading(RenderProps props)
props.getShading()
.setPropsShading
in interface Renderer
props
- properties giving the shadingpublic void drawPoints(RenderObject robj)
Renderer
drawPoints
in interface Renderer
robj
- render objectpublic void drawPoints(RenderObject robj, Renderer.PointStyle style, double rad)
Renderer
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.drawPoints
in interface Renderer
robj
- 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)
Renderer
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.drawPoints
in interface Renderer
robj
- render objectgidx
- point group indexstyle
- point style to use for drawingrad
- radius for spheres or width for pixel-based pointspublic void drawLines(RenderObject robj)
Renderer
public void drawLines(RenderObject robj, Renderer.LineStyle style, double rad)
Renderer
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.public void drawLines(RenderObject robj, int gidx, Renderer.LineStyle style, double rad)
Renderer
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.public void drawTriangles(RenderObject robj)
Renderer
drawTriangles
in interface Renderer
robj
- render objectpublic void drawTriangles(RenderObject robj, int gidx)
Renderer
drawTriangles
in interface Renderer
robj
- render objectgidx
- triangle group indexpublic void draw(RenderObject robj)
Renderer
public void drawVertices(RenderObject robj, VertexIndexArray idxs, Renderer.DrawMode mode)
Renderer
VertexIndexArray
can detect whether or not it has been modified,
which allows for caching.drawVertices
in interface Renderer
robj
- render objectidxs
- vertex indicesmode
- drawing mode to be used for drawing the verticespublic void beginDraw(Renderer.DrawMode mode)
Renderer
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.public void addVertex(float px, float py, float pz)
Renderer
addVertex
in interface Renderer
px
- vertex x coordinatepy
- vertex y coordinatepz
- vertex z coordinateRenderer.beginDraw(maspack.render.Renderer.DrawMode)
public void setNormal(float nx, float ny, float nz)
Renderer
setNormal
call. The normal does not
need to be normalized.setNormal
in interface Renderer
nx
- normal x coordinateny
- normal y coordinatenz
- normal z coordinateRenderer.beginDraw(maspack.render.Renderer.DrawMode)
public void setTextureCoord(float x, float y)
Renderer
setTexcoord
call. The coordinate should
be within the range [0, 1]setTextureCoord
in interface Renderer
x
- texture x coordinatey
- texture y coordinateRenderer.beginDraw(maspack.render.Renderer.DrawMode)
public void addVertex(double px, double py, double pz)
Renderer
addVertex
in interface Renderer
px
- vertex x coordinatepy
- vertex y coordinatepz
- vertex z coordinateRenderer.beginDraw(maspack.render.Renderer.DrawMode)
public void addVertex(Vector3d pnt)
Renderer
addVertex
in interface Renderer
pnt
- coordinates for the vertexRenderer.beginDraw(maspack.render.Renderer.DrawMode)
public void addVertex(float[] pnt)
Renderer
addVertex
in interface Renderer
pnt
- coordinates for the vertexRenderer.beginDraw(maspack.render.Renderer.DrawMode)
public void setNormal(double nx, double ny, double nz)
Renderer
Renderer.setNormal(float,float,float)
.setNormal
in interface Renderer
nx
- normal x coordinateny
- normal y coordinatenz
- normal z coordinateRenderer.beginDraw(maspack.render.Renderer.DrawMode)
public void setNormal(Vector3d nrm)
Renderer
Renderer.setNormal(float,float,float)
.setNormal
in interface Renderer
nrm
- normal coordinatesRenderer.beginDraw(maspack.render.Renderer.DrawMode)
public void setTextureCoord(double tx, double ty)
Renderer
Renderer.setTextureCoord(float,float)
.setTextureCoord
in interface Renderer
tx
- texture x coordinatety
- texture y coordinateRenderer.beginDraw(maspack.render.Renderer.DrawMode)
public void setTextureCoord(Vector2d tex)
Renderer
Renderer.setTextureCoord(float,float)
.setTextureCoord
in interface Renderer
tex
- texture coordinatesRenderer.beginDraw(maspack.render.Renderer.DrawMode)
public void endDraw()
Renderer
glEnd()
in the old
GL specification.public abstract void maybeUpdateMaterials()
public void restoreDefaultState(boolean strictChecking)
Renderer
restoreDefaultState
in interface Renderer
strictChecking
- if true
, enables strict
checking.public com.jogamp.opengl.GL beginGL()
getGL()
, etc. Save the current
graphics state.public void endGL()
beginGL()
was called.