All Implemented Interfaces:
com.jogamp.opengl.GLEventListener, MouseListener, MouseMotionListener, MouseWheelListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class Viewport extends OpenGLPanel implements com.jogamp.opengl.GLEventListener
Viewport is an OpenGLPanel that uses a set of RenderPasses to draw the Registry.getScene() from the perspective of a Registry.getActiveCamera().
See Also:
  • Field Details

  • Constructor Details

    • Viewport

      public Viewport()
  • Method Details

    • saveRenderPassState

      public void saveRenderPassState()
      Save the viewport pass state to the Preferences.
    • addNotify

      public void addNotify()
      Overrides:
      addNotify in class OpenGLPanel
    • removeNotify

      public void removeNotify()
      Overrides:
      removeNotify in class OpenGLPanel
    • init

      public void init(com.jogamp.opengl.GLAutoDrawable glAutoDrawable)
      Specified by:
      init in interface com.jogamp.opengl.GLEventListener
      Overrides:
      init in class OpenGLPanel
    • dispose

      public void dispose(com.jogamp.opengl.GLAutoDrawable glAutoDrawable)
      Specified by:
      dispose in interface com.jogamp.opengl.GLEventListener
      Overrides:
      dispose in class OpenGLPanel
    • reshape

      public void reshape(com.jogamp.opengl.GLAutoDrawable glAutoDrawable, int x, int y, int width, int height)
      Specified by:
      reshape in interface com.jogamp.opengl.GLEventListener
      Overrides:
      reshape in class OpenGLPanel
    • display

      public void display(com.jogamp.opengl.GLAutoDrawable glAutoDrawable)
      Specified by:
      display in interface com.jogamp.opengl.GLEventListener
      Overrides:
      display in class OpenGLPanel
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
      Overrides:
      mouseClicked in class OpenGLPanel
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
      Overrides:
      mousePressed in class OpenGLPanel
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
      Overrides:
      mouseReleased in class OpenGLPanel
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      Specified by:
      mouseDragged in interface MouseMotionListener
      Overrides:
      mouseDragged in class OpenGLPanel
    • mouseWheelMoved

      public void mouseWheelMoved(MouseWheelEvent e)
      Specified by:
      mouseWheelMoved in interface MouseWheelListener
      Overrides:
      mouseWheelMoved in class OpenGLPanel
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      Specified by:
      mouseMoved in interface MouseMotionListener
      Overrides:
      mouseMoved in class OpenGLPanel
    • getOrbitChangeFactor

      public double getOrbitChangeFactor()
    • setOrbitChangeFactor

      public void setOrbitChangeFactor(double amount)
      Parameters:
      amount - a value greater than one.
    • getRayThroughPoint

      public Ray getRayThroughPoint(Camera camera, double x, double y)

      Return the ray coming through the viewport in the current projection. Remember that in OpenGL the camera -Z=forward, +X=right, +Y=up

      Parameters:
      x - the cursor position in screen coordinates [-1,1]
      y - the cursor position in screen coordinates [-1,1]
      Returns:
      the ray coming through the viewport in the current projection.
    • getCursorAsNormalized

      public javax.vecmath.Vector3d getCursorAsNormalized()
      Returns:
      the cursor position as values from -1...1.
    • getCursorPosition

      public javax.vecmath.Point2d getCursorPosition()
    • getAspectRatio

      public double getAspectRatio()
    • getUserMovementScale

      public double getUserMovementScale()
    • setUserMovementScale

      public void setUserMovementScale(double scale)
      Set the scale of user movement. This is used to scale the mouse movement to the camera movement.
      Parameters:
      scale - a value greater than zero.