|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectCustomWidget
artofillusion.ViewerCanvas
public abstract class ViewerCanvas
ViewerCanvas is the abstract superclass of all components which display objects, and allow the user to manipulate them with EditingTools.
Field Summary | |
---|---|
static java.awt.Color |
backgroundColor
|
static java.awt.Color |
disabledColor
|
static java.awt.Color |
handleColor
|
static java.awt.Color |
highlightColor
|
static RGBColor |
highValueColor
|
static java.awt.Color |
lineColor
|
static RGBColor |
lowValueColor
|
static int |
RENDER_FLAT
|
static int |
RENDER_RENDERED
|
static int |
RENDER_SMOOTH
|
static int |
RENDER_TEXTURED
|
static int |
RENDER_TRANSPARENT
|
static int |
RENDER_WIREFRAME
|
static java.awt.Color |
specialHighlightColor
|
static java.awt.Color |
surfaceColor
|
static RGBColor |
surfaceRGBColor
|
static RGBColor |
transparentColor
|
static int |
VIEW_BACK
|
static int |
VIEW_BOTTOM
|
static int |
VIEW_FRONT
|
static int |
VIEW_LEFT
|
static int |
VIEW_OTHER
|
static int |
VIEW_RIGHT
|
static int |
VIEW_TOP
|
Constructor Summary | |
---|---|
ViewerCanvas()
|
|
ViewerCanvas(boolean useOpenGL)
|
Method Summary | |
---|---|
static void |
addViewerControl(int index,
ViewerControl control)
Add a new ViewerControl that will be added to each new ViewerCanvas. |
static void |
addViewerControl(ViewerControl control)
Add a new ViewerControl that will be added to each new ViewerCanvas. |
void |
adjustCamera(boolean perspective)
|
void |
copyOrientationFromCamera()
If there is a camera bound to this view, copy the coordinates from it. |
void |
drawBorder()
Draw a border around the rendered image. |
void |
drawBox(int x,
int y,
int width,
int height,
java.awt.Color color)
Draw a filled box in the rendered image. |
void |
drawBoxes(java.util.List<java.awt.Rectangle> box,
java.awt.Color color)
Draw a set of filled boxes in the rendered image. |
void |
drawDraggedShape(java.awt.Shape shape)
Show feedback to the user in response to a mouse drag, by drawing a Shape over the image. |
void |
drawHRule(int y,
java.awt.Color color)
Draw a horizontal line across the rendered image. |
void |
drawImage(java.awt.Image image,
int x,
int y)
Draw an image onto the canvas. |
void |
drawLine(java.awt.Point p1,
java.awt.Point p2,
java.awt.Color color)
Draw a line into the rendered image. |
void |
drawShape(java.awt.Shape shape,
java.awt.Color color)
Draw the outline of a Shape into the canvas. |
void |
drawString(java.lang.String text,
int x,
int y,
java.awt.Color color)
Draw a piece of text onto the canvas. |
void |
drawVRule(int x,
java.awt.Color color)
Draw a vertical line across the rendered image. |
abstract double[] |
estimateDepthRange()
Estimate the range of depth values that the camera will need to render. |
void |
fillShape(java.awt.Shape shape,
java.awt.Color color)
Draw a filled Shape onto the canvas. |
void |
frameBox(BoundingBox bb)
Adjust the camera position and magnification so that the specified box fills the view. |
ActionProcessor |
getActionProcessor()
Get the ActionProcessor which is currently in use for processing mouse events (may be null). |
ObjectInfo |
getBoundCamera()
Get the SceneCamera (if any) which is bound to this view. |
Camera |
getCamera()
|
CanvasDrawer |
getCanvasDrawer()
Get the CanvasDrawer which is rendering the image for this canvas. |
EditingTool |
getCurrentTool()
Get the currently selected tool. |
Vec3 |
getDefaultRotationCenter()
Get the default location around which the view should be rotated. |
boolean |
getDrawFocus()
Get whether a focus ring should be drawn around this component. |
double |
getGridSpacing()
Get the grid spacing. |
java.awt.Dimension |
getMinimumSize()
|
int |
getOrientation()
Get the current orientation mode. |
java.awt.Dimension |
getPreferredSize()
|
int |
getRenderMode()
|
Vec3 |
getRotationCenter()
Get the location around which the view should be rotated. |
double |
getScale()
Get the current scale factor for the view. |
Scene |
getScene()
Get the Scene being displayed in this canvas. |
boolean |
getShowAxes()
Determine whether the coordinate axes are currently showing. |
boolean |
getShowGrid()
Get whether the grid is shown. |
boolean |
getSnapToGrid()
Get whether Snap To Grid is enabled. |
int |
getSnapToSubdivisions()
Get the number of "snap to" subdivisions between grid lines. |
java.awt.Image |
getTemplateImage()
Get the template image. |
boolean |
getTemplateShown()
Determine whether the template image is currently showing. |
static java.util.List |
getViewerControls()
Get the list of ViewerControls which will be added to each new ViewerCanvas. |
java.util.Map |
getViewerControlWidgets()
Get a Map whose keys are the defined ViewerControls, and whose values are the corresponding Widgets for this canvas. |
static boolean |
isOpenGLAvailable()
Determine whether OpenGL rendering is available. |
boolean |
isPerspective()
Determine whether the view is currently is perspective mode. |
void |
prepareCameraForRendering()
This should be called by the CanvasDrawer just before rendering an image. |
static void |
removeViewerControl(ViewerControl control)
Remove a ViewerControl from the list of ones to be added to each new ViewerCanvas. |
void |
renderBox(int x,
int y,
int width,
int height,
double depth,
java.awt.Color color)
Render a filled box at a specified depth in the rendered image. |
void |
renderBoxes(java.util.List<java.awt.Rectangle> box,
java.util.List<java.lang.Double> depth,
java.awt.Color color)
Render a set of filled boxes at specified depths in the rendered image. |
void |
renderImage(java.awt.Image image,
Vec3 p1,
Vec3 p2,
Vec3 p3,
Vec3 p4)
Render an image onto the canvas. |
void |
renderLine(Vec2 p1,
double zf1,
Vec2 p2,
double zf2,
Camera cam,
java.awt.Color color)
Render a line into the image. |
void |
renderLine(Vec3 p1,
Vec3 p2,
Camera cam,
java.awt.Color color)
Render a line into the image. |
void |
renderMesh(RenderingMesh mesh,
VertexShader shader,
Camera cam,
boolean closed,
boolean[] hideFace)
Render a mesh to the canvas. |
void |
renderMeshTransparent(RenderingMesh mesh,
VertexShader shader,
Camera cam,
Vec3 viewDir,
boolean[] hideFace)
Render an object with flat shading in subtractive (transparent) mode. |
void |
renderWireframe(WireframeMesh mesh,
Camera cam,
java.awt.Color color)
Render a wireframe object. |
void |
setAltTool(EditingTool tool)
Set the tool which should be active when the alt key is pressed. |
void |
setBoundCamera(ObjectInfo boundCamera)
Set the SceneCamera which is bound to this view (may be null). |
void |
setDrawFocus(boolean draw)
Set whether a focus ring should be drawn around this component. |
void |
setGrid(double spacing,
int subdivisions,
boolean show,
boolean snap)
Set the grid parameters for this view. |
void |
setMetaTool(EditingTool tool)
Set the tool which should be active when the meta key is pressed. |
void |
setOrientation(int which)
Set the view orientation to any of the values shown in the choice menu. |
void |
setPerspective(boolean perspective)
Set whether to display perspective or parallel mode. |
void |
setPopupMenuManager(PopupMenuManager manager)
Set the PopupMenuManager for this canvas. |
void |
setPreferredSize(java.awt.Dimension size)
This needs to be overridden, since the component may not be a JComponent. |
void |
setRenderMode(int mode)
|
void |
setRotationCenter(Vec3 rotationCenter)
Set the location around which the view should be rotated. |
void |
setScale(double scale)
Set the scale factor for the view. |
void |
setShowAxes(boolean show)
Set whether the coordinate axes should be displayed. |
void |
setShowTemplate(boolean show)
Set whether the template image should be displayed. |
void |
setTemplateImage(java.io.File f)
Set the template image based on an image file. |
void |
setTemplateImage(java.awt.Image im)
Set the template image. |
void |
setTool(EditingTool tool)
Set the currently selected tool. |
void |
updateImage()
Subclasses should override this to draw the contents of the canvas, but should begin by calling super.updateImage() to display the grid. |
void |
viewChanged(boolean selectionOnly)
This is called when the content of the view has changed. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.awt.Color backgroundColor
public static java.awt.Color lineColor
public static java.awt.Color handleColor
public static java.awt.Color highlightColor
public static java.awt.Color specialHighlightColor
public static java.awt.Color disabledColor
public static java.awt.Color surfaceColor
public static RGBColor surfaceRGBColor
public static RGBColor transparentColor
public static RGBColor lowValueColor
public static RGBColor highValueColor
public static final int RENDER_WIREFRAME
public static final int RENDER_FLAT
public static final int RENDER_SMOOTH
public static final int RENDER_TEXTURED
public static final int RENDER_TRANSPARENT
public static final int RENDER_RENDERED
public static final int VIEW_FRONT
public static final int VIEW_BACK
public static final int VIEW_LEFT
public static final int VIEW_RIGHT
public static final int VIEW_TOP
public static final int VIEW_BOTTOM
public static final int VIEW_OTHER
Constructor Detail |
---|
public ViewerCanvas()
public ViewerCanvas(boolean useOpenGL)
Method Detail |
---|
public CanvasDrawer getCanvasDrawer()
public void setPreferredSize(java.awt.Dimension size)
public java.awt.Dimension getPreferredSize()
public java.awt.Dimension getMinimumSize()
public ActionProcessor getActionProcessor()
public Camera getCamera()
public Scene getScene()
public void setTool(EditingTool tool)
public EditingTool getCurrentTool()
public void setMetaTool(EditingTool tool)
public void setAltTool(EditingTool tool)
public void setPerspective(boolean perspective)
public boolean isPerspective()
public double getScale()
public void setScale(double scale)
public boolean getDrawFocus()
public void setDrawFocus(boolean draw)
public boolean getShowAxes()
public void setShowAxes(boolean show)
public boolean getTemplateShown()
public void setShowTemplate(boolean show)
public java.awt.Image getTemplateImage()
public void setTemplateImage(java.awt.Image im)
public void setTemplateImage(java.io.File f) throws java.lang.InterruptedException
java.lang.InterruptedException
public Vec3 getRotationCenter()
getDefaultRotationCenter()
will be used instead.
public void setRotationCenter(Vec3 rotationCenter)
getDefaultRotationCenter()
will be used instead.
public Vec3 getDefaultRotationCenter()
getRotationCenter()
returns null.
public void setPopupMenuManager(PopupMenuManager manager)
public void adjustCamera(boolean perspective)
public ObjectInfo getBoundCamera()
public void setBoundCamera(ObjectInfo boundCamera)
public void setGrid(double spacing, int subdivisions, boolean show, boolean snap)
public boolean getShowGrid()
public boolean getSnapToGrid()
public double getGridSpacing()
public int getSnapToSubdivisions()
public void frameBox(BoundingBox bb)
public void prepareCameraForRendering()
public abstract double[] estimateDepthRange()
public void viewChanged(boolean selectionOnly)
selectionOnly
- if true, the only change to the view is what is currently selectedpublic void updateImage()
public int getRenderMode()
public void setRenderMode(int mode)
public int getOrientation()
public void setOrientation(int which)
public void copyOrientationFromCamera()
public void drawDraggedShape(java.awt.Shape shape)
public void drawBorder()
public void drawHRule(int y, java.awt.Color color)
public void drawVRule(int x, java.awt.Color color)
public void drawBox(int x, int y, int width, int height, java.awt.Color color)
public void drawBoxes(java.util.List<java.awt.Rectangle> box, java.awt.Color color)
public void renderBox(int x, int y, int width, int height, double depth, java.awt.Color color)
public void renderBoxes(java.util.List<java.awt.Rectangle> box, java.util.List<java.lang.Double> depth, java.awt.Color color)
public void drawLine(java.awt.Point p1, java.awt.Point p2, java.awt.Color color)
public void renderLine(Vec3 p1, Vec3 p2, Camera cam, java.awt.Color color)
p1
- the first endpoint of the linep2
- the second endpoint of the linecam
- the camera from which to draw the linecolor
- the line colorpublic void renderLine(Vec2 p1, double zf1, Vec2 p2, double zf2, Camera cam, java.awt.Color color)
p1
- the first endpoint of the line, in screen coordinateszf1
- the z coordinate of the first endpoint, in view coordinatesp2
- the second endpoint of the line, in screen coordinateszf2
- the z coordinate of the second endpoint, in view coordinatescam
- the camera from which to draw the linecolor
- the line colorpublic void renderWireframe(WireframeMesh mesh, Camera cam, java.awt.Color color)
public void renderMeshTransparent(RenderingMesh mesh, VertexShader shader, Camera cam, Vec3 viewDir, boolean[] hideFace)
public void renderMesh(RenderingMesh mesh, VertexShader shader, Camera cam, boolean closed, boolean[] hideFace)
public void drawString(java.lang.String text, int x, int y, java.awt.Color color)
public void drawImage(java.awt.Image image, int x, int y)
public void renderImage(java.awt.Image image, Vec3 p1, Vec3 p2, Vec3 p3, Vec3 p4)
image
- the image to renderp1
- the coordinates of the first corner of the imagep2
- the coordinates of the second corner of the imagep3
- the coordinates of the third corner of the imagep4
- the coordinates of the fourth corner of the imagepublic void drawShape(java.awt.Shape shape, java.awt.Color color)
public void fillShape(java.awt.Shape shape, java.awt.Color color)
public static boolean isOpenGLAvailable()
public static java.util.List getViewerControls()
public static void addViewerControl(ViewerControl control)
control
- the ViewerControl to addpublic static void addViewerControl(int index, ViewerControl control)
index
- the position (from left to right) at which the new control should be addedcontrol
- the ViewerControl to addpublic static void removeViewerControl(ViewerControl control)
control
- the ViewerControl to removepublic java.util.Map getViewerControlWidgets()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |