Jump to: navigation, search

Difference between revisions of "GEF3D Camera"

(Initial version)
 
m (added category GEF3D)
Line 35: Line 35:
  
 
Feel free to contribute your own cameras! We would be happy to add them to the Draw3D camera collection :-)
 
Feel free to contribute your own cameras! We would be happy to add them to the Draw3D camera collection :-)
 +
 +
[[Category:GEF3D]]

Revision as of 07:06, 5 January 2011

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


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.

Figure 1: Draw3D Preferences
Figure 2: Draw3D Camera Control Preferences

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 :-)