Class View3DLit
- java.lang.Object
-
- vmm3d.core.View
-
- vmm3d.core3D.View3D
-
- vmm3d.core3D.View3DWithLightSettings
-
- vmm3d.core3D.View3DLit
-
- All Implemented Interfaces:
- java.util.EventListener, javax.swing.event.ChangeListener, Decorateable, Parameterizable
- Direct Known Subclasses:
- IFS.IFSView, SpaceCurveParametric.SpaceCurveParametricViewAsTube, SurfaceView
public class View3DLit extends View3DWithLightSettings
-
-
Field Summary
Fields Modifier and Type Field and Description static intNO_ORIENTATIONA constant that can be used as a parameter tosetOrientation(int)to specify that surfaces have no orientation, so that both faces of a patch are treated as front faces.static intNORMAL_ORIENTATIONA constant that can be used as a parameter tosetOrientation(int)to specify that surfaces have normal orientation, in which the normal vector points out from the front face.static intPATCH_RENDERINGA constant that can be used as a parameter tosetRenderingStyle(int)to specify that surfaces should always be rendered as solid patches.static intREVERSE_ORIENTATIONA constant that can be used as a parameter tosetOrientation(int)to specify that surfaces have reverse orientation, in which the normal vector points out from the back face.static intWIREFRAME_RENDERINGA constant that can be used as a parameter tosetRenderingStyle(int)to specify that surfaces should always be rendered as wireframes.-
Fields inherited from class vmm3d.core3D.View3D
CROSS_EYE_STEREO_VIEW, MONOCULAR_VIEW, RED_GREEN_STEREO_VIEW, STEREOGRAPH_VIEW
-
-
Constructor Summary
Constructors Constructor and Description View3DLit()Create a View3DLit object, using default light settings and normal orientation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddrawSurface(Grid3D surfaceData)Draws an entire surface represented in the form of a Grid3D object, taking into account current lighting and rendering settings.voiddrawSurface(Grid3D surfaceData, double startPercent, double endPercent)Draws all or part of a surface that is represented in the form of a Grid3D object, taking into account current lighting and rendering settings.voidfillPolygon(Vector3D[] vertices, java.awt.Color outlineColor)Draws a filled-in polygon in current drawing color.booleangetBlackAndWhite()Tells whether surfaces are rendered in gray-scale rather than color.booleangetDragAsSurface()Determines how surfaces are rendered when the "fast draw" mode is in effect, such as during rotation, zooming, or dragging by the user.intgetOrientation()Returns the current orientation setting for surfaces.booleangetPhongShading()Returns the current shading setting, true for Phong shading or false for flat shading.intgetRenderingStyle()Returns the current rendering style.ActionListgetSettingsCommands()Adds a checkbox for setting the dragAsSurface property to any settings contributed by the superclass.doublegetTransparency()Returns the current degree of transparency.ActionListgetViewCommands()Adds commands for setting various View3DLit options to any view commands contributed by the superclass.voidsetBlackAndWhite(boolean blackAndWhite)Set whether surfaces should be rendered in gray-scale or in color.voidsetDragAsSurface(boolean dragAsSurface)Specify how surfaces are rendered when the "fast draw" mode is in effect, such as during rotation, zooming, or dragging by the user.voidsetEnableThreeD(boolean enable)Sets the enableThreeD property.voidsetOrientation(int orientation)Set how front and back faces of surface patches are determined.voidsetPhongShading(boolean phongShading)Select the type of shading to be used for surface patches.voidsetRenderingStyle(int style)Sets the rendering style that is used to draw surfaces.voidsetTransparency(double transparency)Set the degree of transparency for surfaces displayed in this View3DLit.voidsetViewStyle(int style)Overridden in this subclass to swap in the anaglyph or non-anaglph light settings, as appropriate.voidtakeExhibit(View view, boolean shareTransform)Set this View to view the same exhibit as another specififed view.-
Methods inherited from class vmm3d.core3D.View3DWithLightSettings
addExtraXML, getLightingEnabled, getLightSettings, readExtraXML, setLightingEnabled, setLightSettings
-
Methods inherited from class vmm3d.core3D.View3D
clip, drawCollaredCurve, drawCollaredCurve, drawCollaredCurve, drawCurve, drawCurve, drawCurve, drawDot, drawLine, drawPixel, drawPixelDirect, drawPixels, drawString, drawWireframeSurface, finish, getDefaultMouseTask, getEnableThreeD, getOrthographicProjection, getTransform3D, getViewPoint, getViewStyle, getViewUp, moveStereographImages, setBackground, setDisplay, setExhibit, setOrthographicProjection, setTransform, setViewPoint, setViewUp, setWindowForUseWhileThreeDDisabled, stateChanged, stereographLeftEyeRect, stereographRightEyeRect
-
Methods inherited from class vmm3d.core.View
addDecoration, addParameter, beginDrawToOffscreenImage, clearDecorations, drawCurve, drawCurve, drawCurve, drawDot, drawLine, drawLine, drawLineDirect, drawPixel, drawPixel, drawPixels, drawString, drawString, endDrawToOffscreenImage, fillRectDirect, forceRedraw, getActions, getActionsForViewAndExhibit, getAdditionalAnimations, getAdditionalAnimationsForViewAndExhibit, getAntialiased, getApplyGraphics2DTransform, getBackground, getColor, getCurrentGraphics, getDecorations, getDisplay, getExhibit, getFastDrawing, getForeground, getImage, getName, getNeedRecalculate, getNeedRedraw, getParameterByName, getParameters, getPreserveAspect, getRequestedWindow, getSettingsCommandsForViewAndExhibit, getShowAxes, getStatusText, getTitle, getTransform, getViewAndExhibitParameters, getWindow, parameterChanged, removeDecoration, removeParameter, render, setAntialiased, setApplyGraphics2DTransform, setColor, setCurrentGraphics, setFastDrawing, setFastDrawing, setForeground, setName, setNeedRecalculate, setNeedRedraw, setPreserveAspect, setShowAxes, setStrokeSizeMultiplier, setWindow, setWindow
-
-
-
-
Field Detail
-
WIREFRAME_RENDERING
public static final int WIREFRAME_RENDERING
A constant that can be used as a parameter tosetRenderingStyle(int)to specify that surfaces should always be rendered as wireframes.- See Also:
- Constant Field Values
-
PATCH_RENDERING
public static final int PATCH_RENDERING
A constant that can be used as a parameter tosetRenderingStyle(int)to specify that surfaces should always be rendered as solid patches.- See Also:
- Constant Field Values
-
NORMAL_ORIENTATION
public static final int NORMAL_ORIENTATION
A constant that can be used as a parameter tosetOrientation(int)to specify that surfaces have normal orientation, in which the normal vector points out from the front face.- See Also:
- Constant Field Values
-
REVERSE_ORIENTATION
public static final int REVERSE_ORIENTATION
A constant that can be used as a parameter tosetOrientation(int)to specify that surfaces have reverse orientation, in which the normal vector points out from the back face.- See Also:
- Constant Field Values
-
NO_ORIENTATION
public static final int NO_ORIENTATION
A constant that can be used as a parameter tosetOrientation(int)to specify that surfaces have no orientation, so that both faces of a patch are treated as front faces.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
View3DLit
public View3DLit()
Create a View3DLit object, using default light settings and normal orientation.
-
-
Method Detail
-
getRenderingStyle
public int getRenderingStyle()
Returns the current rendering style.- See Also:
setRenderingStyle(int)
-
setRenderingStyle
public void setRenderingStyle(int style)
Sets the rendering style that is used to draw surfaces. The two available styles are WIREFRAME_RENDERING and PATCH_RENDERING. With the former, only surface grid lines are drawn. With the latter, surface patches are drawn with color determined by their intrinsic color and lighting conditions.- Parameters:
style- the new rendering style; must be one of the constants WIREFRAME_RENDERING or PATCH_RENDERING
-
getBlackAndWhite
public boolean getBlackAndWhite()
Tells whether surfaces are rendered in gray-scale rather than color.- See Also:
setBlackAndWhite(boolean)
-
setBlackAndWhite
public void setBlackAndWhite(boolean blackAndWhite)
Set whether surfaces should be rendered in gray-scale or in color. In a gray-scale image, the color is computed as usual but then only the brightness is used to determine the level of gray for drawing. Note that this setting has no effectg in anaglyph stereo views, since the drawing there is effectively always done in gray-scale.- Parameters:
blackAndWhite- true if surfaces are to be drawn in gray-scale; false if they are to be drawn in color
-
getOrientation
public int getOrientation()
Returns the current orientation setting for surfaces.- See Also:
setOrientation(int)
-
setOrientation
public void setOrientation(int orientation)
Set how front and back faces of surface patches are determined. In NORMAL_ORIENTATION, the standard normal vectorto a surface patch points out of the front face of the patch. In REVERSE_ORIENTATION, the normal vector points out of the back face. In NO_ORIENTATION, both faces are considered to be front faces.- Parameters:
orientation- the method for determining front/back faces of surface patches. Must be one of the contstants NORMAL_ORIENTATION, REVERSE_ORIENTATION, or NO_ORIENTATION.
-
getPhongShading
public boolean getPhongShading()
Returns the current shading setting, true for Phong shading or false for flat shading.- See Also:
getPhongShading()
-
setPhongShading
public void setPhongShading(boolean phongShading)
Select the type of shading to be used for surface patches. If phongShading is set to true, then the Phong shading algorithm is used to determine the color of each individual pixel in the surface patch. This gives the highest quality results, but is time consuming. If phongShading is set to false, and flat shading is used; in flat shading, the same color is used for all pixels in the patch.
-
getDragAsSurface
public boolean getDragAsSurface()
Determines how surfaces are rendered when the "fast draw" mode is in effect, such as during rotation, zooming, or dragging by the user.- See Also:
setDragAsSurface(boolean),View#setFastDrawing(boolean)
-
setDragAsSurface
public void setDragAsSurface(boolean dragAsSurface)
Specify how surfaces are rendered when the "fast draw" mode is in effect, such as during rotation, zooming, or dragging by the user. If dragAsSurface is set to false, then wireframe rendering is used for fast drawing of surface. If dragAsSurface is set to true, and the rendering method is set to PATCH_RENDERING, then "rough" surfaces are drawn during fast drawing. In a "rough" surface, flat shading is always used and all the subpatches in a patch are rendered as a single large patch. Note that when WIREFRAME_RENDERING is in effect, fast drawing will be done in wireframe mode regardless of the setting of the dragAsSurface property.
-
getTransparency
public double getTransparency()
Returns the current degree of transparency. The value is in the range 0.0 to 1.0.
-
setTransparency
public void setTransparency(double transparency)
Set the degree of transparency for surfaces displayed in this View3DLit. The transparency degree is a number in the range 0.0 to 1.0, with 0.0 representing a fully opaque surface and 1.0 representing a fully transparent surface that will, in effect, be invisible.- Parameters:
transparency- the desired degree of transparency. The value is clamped so that it lies in the range 0 to 1, inclusive.
-
setEnableThreeD
public void setEnableThreeD(boolean enable)
Description copied from class:View3DSets the enableThreeD property. When this property is set to false, three-D related items in the Settings menu are disabled. When 3D is disabled, the view style is set to MONOCULAR, the Viewpoint is set to (1,0,0), and the projection is set to be orthographic, so any 3D drawing that is done while 3D is disabled will use a simple projection onto the yz-plane by discarding the x-coordinate. (Although in general you should not be doing any 3D drawing while 3D is disabled.) When 3D is enabled after being disabled, the view style and viewpoint settings are restored to what they were when 3D was entered unless they have been changed in the meantime.Note that if this view has an Axes decoration, they type of Axes decoration (Axes2D or Axes3D) is set to match the new state of the enableThreeD property.
WARNING: This method does NOT do anything about mouse tasks, so you might want to change the mouse task in this View's display at the same time that you call this method.
- Overrides:
setEnableThreeDin classView3D
-
getSettingsCommands
public ActionList getSettingsCommands()
Adds a checkbox for setting the dragAsSurface property to any settings contributed by the superclass.- Overrides:
getSettingsCommandsin classView3DWithLightSettings- See Also:
View#getSettingsCommands()
-
setViewStyle
public void setViewStyle(int style)
Description copied from class:View3DWithLightSettingsOverridden in this subclass to swap in the anaglyph or non-anaglph light settings, as appropriate. SeeView3DWithLightSettings.setAnaglyphLightSettings(LightSettings)andView3DWithLightSettings.setNonAnaglyphLightSettings(LightSettings).- Overrides:
setViewStylein classView3DWithLightSettings- Parameters:
style- the new view style. This is ignored if it is not one of the four legal options.
-
takeExhibit
public void takeExhibit(View view, boolean shareTransform)
Description copied from class:View3DSet this View to view the same exhibit as another specififed view. This is overridden here to copy the 3D transform from the specified view (if it has one) and to copy its viewStyle if it is a View3D and to properly handle the enableThreeD propety. Since a 3D View cannot make effective use of a 2D transform, the sharedTransform parameter is ignored if the transform in the given view is not a 3D transform.- Overrides:
takeExhibitin classView3D- Parameters:
view- The view whose Exhibit is to be copied. After the method is called, both views will be drawing the same exhibit. If null, then the exhibit of this view will also be set to null.shareTransform- If true, the two views will share the same Transform, so that changes made to the transform in one will also result in a change in the other.
-
getViewCommands
public ActionList getViewCommands()
Adds commands for setting various View3DLit options to any view commands contributed by the superclass.- Overrides:
getViewCommandsin classView3D- See Also:
View#getViewCommands()
-
drawSurface
public void drawSurface(Grid3D surfaceData)
Draws an entire surface represented in the form of a Grid3D object, taking into account current lighting and rendering settings.
-
drawSurface
public void drawSurface(Grid3D surfaceData, double startPercent, double endPercent)
Draws all or part of a surface that is represented in the form of a Grid3D object, taking into account current lighting and rendering settings. The ability to draw only part of a surface is used in surface build animations.If fast drawing mode is in effect, the entire surface is always drawn; the startIndex and endIndex are ignored in this case. Also, if WIREFRAME_RENDERING is in effect, the entire surface is drawn in wireframe form. For normal speed rendering with patch display, the startPercent and endPercent specify a range of subpatches to draw; these numbers are given as percentages of the total number of available patches (taking into account patches that have been clipped). The subpatches are sorted into back-to-front order. (The total number of subpatches can be determined by calling
Grid3D.getSubPatchCountInSurface(), but note that some of the patches might not be included in the drawing or in the calculation of percentages because ofclipping.)
-
fillPolygon
public void fillPolygon(Vector3D[] vertices, java.awt.Color outlineColor)
Draws a filled-in polygon in current drawing color. To projection of the polygon onto the xy-plane is drawn. Note: This is used byIFS.- Parameters:
vertices- The vertices of the polygon, in object coordinates.outlineColor- If non-null, then the polygon is outlined with this color.
-
-
DMelt 3.0 © DataMelt by jWork.ORG