Class Canvas

All Implemented Interfaces:
HumanFaceListener, ImageObserver, MenuContainer, Serializable, Accessible

public class Canvas extends JPanel implements HumanFaceListener
OpenGL canvas.
See Also:
  • Constructor Details

    • Canvas

      public Canvas()
      Constructor.
  • Method Details

    • getSceneRenderer

      public SceneRenderer getSceneRenderer()
      Returns the scene
      Returns:
      the scene
    • renderScene

      public void renderScene()
      Renders the scene.
    • getCanvasPanel

      public JPanel getCanvasPanel()
    • getScene

      public Scene getScene()
    • getState

      public CanvasState getState()
      Creates the set of the canvas. Primarily stores the camera, background color, transparency and rendering mode of the faces.
      Returns:
      the state of the canvas
    • setState

      public void setState(CanvasState state)
      Sets the state of the canvas. Primarily adjusts the camera, background color, transparency and rendering mode of the faces.
      Parameters:
      state - the state to set
    • getCamera

      public Camera getCamera()
      Returns camera.
      Returns:
      camera
    • setCamera

      public void setCamera(Camera camera)
    • getGLCanvas

      public com.jogamp.opengl.awt.GLCanvas getGLCanvas()
      Returns the underlying OpenGL canvas.
      Returns:
      the underlying OpenGL canvas.
    • getListener

      public CanvasListener getListener()
    • setDarkBackground

      public void setDarkBackground(boolean dark)
      Sets background color
      Parameters:
      dark - If true, then dark background is set
    • addToolBox

      public void addToolBox(JPanel toolbox)
      Adds a toolbox to the scene toolbar.
      Parameters:
      toolbox - New toolbox
    • acceptEvent

      public void acceptEvent(HumanFaceEvent event)
      Description copied from interface: HumanFaceListener
      Subscription method, which is invoked when an event appears.
      Specified by:
      acceptEvent in interface HumanFaceListener
      Parameters:
      event - A fired event.
    • captureCanvas

      public BufferedImage captureCanvas()
      Captures the canvas and returns it as a buffered image.
      Returns:
      the captured canvas
    • castRayThroughPixel

      public org.openide.util.Pair<HumanFace,RayIntersection> castRayThroughPixel(int pixelX, int pixelY)
      Cast a ray through a pixel and find the intersection with visible faces only (hidden faces and other graphical objects are omitted).
      Parameters:
      pixelX - The X coordinate of mouse pointer
      pixelY - The X coordinate of mouse pointer
      Returns:
      The intersection with the closest visible face