Class SceneRenderer

java.lang.Object
cz.fidentis.analyst.rendering.SceneRenderer

public class SceneRenderer extends Object
Handles DrawableMeshs - objects to be drawn, and (re-)renders them on demand.
  • Field Details

    • BRIGHT_BACKGROUND

      public static final Color BRIGHT_BACKGROUND
    • DARK_BACKGROUND

      public static final Color DARK_BACKGROUND
  • Constructor Details

    • SceneRenderer

      public SceneRenderer()
  • Method Details

    • initGLContext

      public void initGLContext(com.jogamp.opengl.GLContext glContext)
      Initialization method - must be called first.
      Parameters:
      glContext - An OpenGL context. Must not be null, must be at least GL2
      Throws:
      IllegalArgumentException - if the gl is null
    • setBrightBackground

      public void setBrightBackground()
      Sets the scene background to bright.
    • setDarkBackground

      public void setDarkBackground()
      Sets the scene background to dark.
    • setViewport

      public void setViewport(int x, int y, int width, int height)
      Sets the view-port.
      Parameters:
      x - X corner
      y - Y corner
      width - Width
      height - Height
    • renderScene

      public void renderScene(Camera camera, Collection<Drawable> drawables)
      Renders drawable objects.
    • getViewportWidth

      public int getViewportWidth()
      gets view port width in pixels
      Returns:
      view port width in pixels
    • getViewportHeight

      public int getViewportHeight()
      gets view port height in pixels
      Returns:
      view port height in pixels
    • clearScene

      protected void clearScene()
      Clears the scene and prepares it for the re-drawing.
    • getShadersManager

      public ShadersManager getShadersManager()
      Gets the current manager of shaders
      Returns:
      shaders manager
    • hasShaders

      public boolean hasShaders()
      Returns true, if OpenGL shaders are available
      Returns:
      true, if OpenGL shaders are available
    • castRayThroughPixel

      public Ray castRayThroughPixel(int pixelX, int pixelY, Camera camera)
      Cast a ray through a pixel under the mouse pointer.
      Parameters:
      pixelX - The X coordinate of mouse pointer
      pixelY - The X coordinate of mouse pointer
      camera - Camera
      Returns:
      A ray directing towards the scene