Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
GEF3D Camera
Draw3D comes with a user friendly, figure aware camera. It is a combination of cameras known from first person shooters (moving the camera) and other 3D libraries such as Java3D (orbiting). This document describes the cameras provided by Draw3D. If you need different functionality, see at the end of this document on how to implement your own camera or automated camera tracks.
Default controls
The default settings are as follows:
- Arrow up/down/left/right: move camera (i.e. slide) up/down/left/right
- Shift + arrow up/down/left/right: slowly move camera (i.e. slide) up/down/left/right
- Esc: reset camera position and view direction (cetner view)
- X/Y: roll left/right
- Shift + X/Y: slowly roll left/right
- +/-: zoom in/out, i.e. move camera forward/backward
Mouse:
- Move mouse while left button pressed: move camera (slide)
- Move mouse while right button pressed: move camera, look at original location. That is, the viewing direction of the camera is adjusted
- Alt + Move mouse while mouse button pressed: orbit around figure under mouse cursor (when mouse button was pressed). If no figure is found, nothing happens)
Depending on system, the following features may work:
- Mouse wheel / move two finges up/down on track pad: zoom in/out, i.e. move camera forward/backward
Camera tracks:
- Double click on element: a camera tracks positions the camera so that the selected elements is rendered plane parallel to the screen
- Double click on background: a camera tracks positions the camera so that the camera looks in the direction of the z axis, the x axis (if Shift is pressed), or the y axis (Shift and Alt pressed).
Draw3D Preferences Dialog
You can configure what camera to use and the keys in the Draw3D preferences, as shown in Figure 1 and Figure 2.
Actually, there are two cameras implemented which behave slightly differently. The default one behaves as described, while the so called "restricted" camera retains the "up vector" of the camera when orbiting around figures.
Developer Notes
You can easily create your own camera. Draw3D provides an interface org.eclipse.draw3d.camera.ICamera
and an abstract implementation org.eclipse.draw3d.camera.AbstractCamera
, however you can simply extend the both existing implementations org.eclipse.draw3d.camera.(Restricted)FirstPersonCamera
. The camera has to be passed to the 3D lightweight system via org.eclipse.draw3d.LightweightSystem3D.setCamera(ICamera)
.
Although GEF3D/Draw3D does not provide any functionality for automated camera tracks yet, it is very easy to implement such functionality. You can use org.eclipse.gef3d.examples.graph.editor.performance.Camera360DegreeOrbit
as a starting point. Also, you can use the animation classes provided by GEF/Draw2D, see org.eclipse.draw2d.Animation
.
Feel free to contribute your own cameras! We would be happy to add them to the Draw3D camera collection :-)
The camera system implemented in Draw3D is also briefly described in:
Jens von Pilgrim and Kristian Duske: GEF3D -- a Framework for Two-, Two-and-a-Half-, and Three-Dimensional Graphical Editors. In: SoftVis '08, Proceedings, 2008, DOI: 10.1145/1409720.1409737