public interface Viewer extends Renderer
Renderable, which provides
 the primary functionality by which renderables can render themselves.Renderer.ColorInterpolation, Renderer.ColorMixing, Renderer.DrawMode, Renderer.FaceStyle, Renderer.HighlightStyle, Renderer.LineStyle, Renderer.PointStyle, Renderer.ShadingHIGHLIGHT, SORT_FACES| Modifier and Type | Method and Description | 
|---|---|
| int | addLight(Light light)Adds a specified light to this viewer and enables it. | 
| void | addRenderable(IsRenderable r)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 | autoFit()Calls either  autoFitOrtho()orautoFitPerspective(),
 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. | 
| void | clearRenderables()Removes all renderables from this viewer. | 
| AxisAlignedRotation | getAxialView()Returns the current axis-aligned view. | 
| java.awt.Color | getBackgroundColor()Returns the background color for this viewer. | 
| float[] | getBackgroundColor(float[] rgba)Returns the background color for this viewer. | 
| RenderList | getExternalRenderList()Returns the external render list for this viewer, or  nullif the viewer does not have an external render list. | 
| Point3d | getEye()Returns the eye position. | 
| void | getEyeToWorld(RigidTransform3d TEW)Gets the eye-to-world transform for this viewer. | 
| int | getIndexOfLight(Light light)Get the index of a specified light in this viewer. | 
| Light | getLight(int idx)Get a specified light by index in this viewer. | 
| RenderListener[] | getRenderListeners()Returns an array of all render listeners held by this viewer. | 
| 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. | 
| 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. | 
| double | getVerticalFieldOfView()Returns the default vertical field of view in degrees. | 
| boolean | hasHighlightStyle(Renderer.HighlightStyle style)Returns  trueif this viewer supports the indicated
 highlighting style. | 
| boolean | isSelectionEnabled()Returns  trueif viewer-based selection is enabled. | 
| int | numLights()Returns the number of lights in this viewer. | 
| void | removeLight(int idx)Removes the light with the specified index from this viewer. | 
| boolean | removeLight(Light light)Removes the indicated light from this viewer. | 
| boolean | removeRenderable(IsRenderable r)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  rerender(int)withflags= 0. | 
| void | rerender(int flags)Performs a rerender for this viewer. | 
| void | setAxialView(AxisAlignedRotation REW)Sets an axial (or axis-aligned) view. | 
| 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 | setCenter(Point3d center)Sets the center point for the viewer, and adjusts the eye-to-world
 transform so that the eye's -z axis is directed at the center point. | 
| void | setExternalRenderList(RenderList list)Sets the external render list for this viewer. | 
| void | setEye(Point3d eye)Sets the eye coordinates to a specified location in world coordinates,
 and adjusts the eye-to-world transform so that the eye's -z axis is
 directed at the center point. | 
| void | setEyeToWorld(Point3d eye,
             Point3d center,
             Vector3d up)Sets the eye-to-world transform for this viewer, using the canonical
 parameters used by the GL  lookatmethod. | 
| void | setEyeToWorld(RigidTransform3d TEW)Sets the eye-to-world transform for this viewer. | 
| boolean | setHighlightStyle(Renderer.HighlightStyle style)Sets the highlighting style for this viewer. | 
| 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 | 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 | setSelectionEnabled(boolean enable)Enables or disables viewer-based selection. | 
| void | setSelectionFilter(ViewerSelectionFilter filter)Sets a selection filter for the viewer. | 
| void | setUpVector(Vector3d up)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. | 
| void | setVerticalFieldOfView(double fov)Sets the default vertical field of view in degrees. | 
| void | setViewMatrix(RigidTransform3d TWE)Sets the view matrix for this viewer. | 
addVertex, addVertex, addVertex, addVertex, begin2DRendering, begin2DRendering, beginDraw, beginSelectionQuery, beginSubSelection, centerDistancePerPixel, distancePerPixel, draw, drawArrow, drawArrow, drawArrow, drawAxes, drawAxes, drawBox, drawBox, drawBox, drawCone, drawCone, drawCube, drawCube, drawCylinder, drawCylinder, drawLine, drawLine, drawLine, drawLine, drawLine, drawLine, drawLines, drawLines, drawLines, drawLines, drawLines, drawLines, drawLineStrip, drawPoint, drawPoint, drawPoint, drawPoint, drawPoints, drawPoints, drawPoints, drawPoints, drawPoints, drawPoints, drawSolidAxes, drawSolidAxes, drawSphere, drawSphere, drawSpindle, drawSpindle, drawText, drawText, drawText, drawText, drawTriangle, drawTriangle, drawTriangles, drawTriangles, drawTriangles, drawTriangles, drawVertices, drawVertices, drawVertices, end2DRendering, endDraw, endSelectionQuery, endSubSelection, getBackColor, getBumpMap, getCenter, getColorInterpolation, getColorMap, getDefaultFont, getDepthOffset, getEmission, getEyeZDirection, getFaceStyle, getFarPlaneDistance, getFrontColor, getHighlightColor, getHighlighting, getHighlightStyle, getLineWidth, getModelMatrix, getModelMatrix, getNormalMap, getPointSize, getScreenHeight, getScreenWidth, getShading, getShininess, getSpecular, getSurfaceResolution, getTextBounds, getTextureMatrix, getTextureMatrix, getVertexColorMixing, getViewMatrix, getViewMatrix, getViewPlaneDistance, getViewPlaneHeight, getViewPlaneWidth, has2DRendering, hasBumpMapping, hasColorMapMixing, hasColorMapping, hasNormalMapping, hasSelection, hasTextRendering, hasVertexColorMixing, is2DRendering, isOrthogonal, isSelectable, isSelecting, mulModelMatrix, popModelMatrix, pushModelMatrix, restoreDefaultState, rotateModelMatrix, scaleModelMatrix, setBackColor, setBumpMap, setColor, setColor, setColor, setColor, setColor, setColorInterpolation, setColorMap, setDefaultFont, setDepthOffset, setEdgeColoring, setEmission, setFaceColoring, setFaceColoring, setFaceStyle, setFrontAlpha, setFrontColor, setHighlighting, setLineColoring, setLineShading, setLineWidth, setModelMatrix, setModelMatrix2d, setNormal, setNormal, setNormal, setNormalMap, setPointColoring, setPointShading, setPointSize, setPropsColoring, setPropsShading, setShading, setShininess, setSpecular, setSurfaceResolution, setTextureCoord, setTextureCoord, setTextureCoord, setTextureMatrix, setVertexColorMixing, translateModelMatrixvoid addRenderable(IsRenderable r)
r - renderable to addboolean removeRenderable(IsRenderable r)
r - renderable to removetrue if r was present and removedvoid clearRenderables()
void setExternalRenderList(RenderList list)
addRenderable(maspack.render.IsRenderable), 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 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.
list - new external render list, or null to clear
 the external listRenderList getExternalRenderList()
null
 if the viewer does not have an external render list.void rerender()
rerender(int) with
 flags = 0.void rerender(int flags)
prerender() method
 for all renderables in the viewer and collects them into an
 internal render list;render() method for all renderables in
 both the internal render list and the external render list (if
 specified).render() methods are called with this viewer as the
 renderer and the flags argument as the flags.flags - rendering flagsvoid repaint()
void addRenderListener(RenderListener l)
l - render listener to add.boolean removeRenderListener(RenderListener l)
l - render listener to removetrue if l was present and removed.RenderListener[] getRenderListeners()
boolean setHighlightStyle(Renderer.HighlightStyle style)
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.style - highlighting style to be settrue if the highlighting style is supported.hasHighlightStyle(maspack.render.Renderer.HighlightStyle)boolean hasHighlightStyle(Renderer.HighlightStyle style)
true if this viewer supports the indicated
 highlighting style.true if style is supportedvoid setSelectionEnabled(boolean enable)
Renderer.hasSelection() returns
 false, then this method does nothing.enable - if true, enables selectionboolean isSelectionEnabled()
true if viewer-based selection is enabled.false if selection is disabled or not supported.void setSelectionFilter(ViewerSelectionFilter filter)
filter - Selection filter to be appliedViewerSelectionFilter getSelectionFilter()
null if there is none.int addLight(Light light)
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.
light - light to add to the viewerint numLights()
Light getLight(int idx)
idx - index of the lightint getIndexOfLight(Light light)
light - light for which an index is soughtboolean removeLight(Light light)
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.
light - light to be removedtrue if the viewer contained the light
 and it was removedvoid removeLight(int idx)
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.
idx - index of the light to be removedjava.lang.IndexOutOfBoundsException - if the specified index was not in the
 range 0 to numLights()-1.java.awt.Color getBackgroundColor()
float[] getBackgroundColor(float[] rgba)
rgba.
 Otherwise, if this argument is null, an array is allocated
 internally.rgba - optional array for returning the valuesvoid setBackgroundColor(java.awt.Color color)
color - new background colorvoid setBackgroundColor(float[] rgba)
rgba - RGB (if length 3) or RGBA values (if length 4) for the
 background colorvoid setEyeToWorld(Point3d eye, Point3d center, Vector3d up)
lookat method. The eye-to-world
 transform is the inverse of the view matrix.eye - position of the eye, in world coordinatescenter - point that the eye is looking at, in world coordinatesup - up direction, in world coordinatesvoid setEyeToWorld(RigidTransform3d TEW)
TEW - new eye-to-world transformvoid getEyeToWorld(RigidTransform3d TEW)
TEW - returns the eye-to-world transformvoid 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().
REW - axis-aligned rotational component for 
 the eye-to-world transformgetAxialView(), 
setUpVector(maspack.matrix.Vector3d), 
getUpVector()AxisAlignedRotation getAxialView()
setAxialView(maspack.matrix.AxisAlignedRotation).setAxialView(maspack.matrix.AxisAlignedRotation)void setViewMatrix(RigidTransform3d TWE)
TWE - transform from world to eye coordinates.Point3d getEye()
void setCenter(Point3d center)
setEyeToWorld (getEye(), center, getUpVector());
center - new center location, in world coordinatesgetUpVector()void setEye(Point3d eye)
setEyeToWorld (eye, getCenter(), getUpVector());
eye - new eye location, in world coordinatesRenderer.getCenter(), 
getUpVector()void setUpVector(Vector3d up)
setEyeToWorld (getEye(), getCenter(), up);
up - new up vector, in world coordinatesgetEye(), 
Renderer.getCenter()Vector3d getUpVector()
setUpVector(maspack.matrix.Vector3d), 
setCenter(maspack.matrix.Point3d), 
setEye(maspack.matrix.Point3d)void setPerspective(double left,
                    double right,
                    double bottom,
                    double top,
                    double near,
                    double far)
left - left edge position of the view planeright - right edge position of the view 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)void setPerspective(double fieldOfView,
                    double near,
                    double far)
getVerticalFieldOfView.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)void setOrthogonal(double left,
                   double right,
                   double bottom,
                   double top,
                   double near,
                   double far)
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)void setOrthogonal(double fieldHeight,
                   double near,
                   double far)
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)void autoFit()
autoFitOrtho() or autoFitPerspective(),
 depending on whether the current view is orthogonal or perspective.void autoFitOrtho()
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 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.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 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.double getVerticalFieldOfView()
autoFitOrtho() and autoFitPerspective().void setVerticalFieldOfView(double fov)
autoFitOrtho() and autoFitPerspective().fov - new default vertical field of view (degrees).void addSelectionListener(ViewerSelectionListener l)
l - selection listener to addremoveSelectionListener(maspack.render.ViewerSelectionListener)boolean removeSelectionListener(ViewerSelectionListener l)
l - selection listener to removeaddSelectionListener(maspack.render.ViewerSelectionListener)ViewerSelectionListener[] getSelectionListeners()
addSelectionListener(maspack.render.ViewerSelectionListener), 
removeSelectionListener(maspack.render.ViewerSelectionListener)