Package cz.fidentis.analyst.rendering
Class SceneRenderer
java.lang.Object
cz.fidentis.analyst.rendering.SceneRenderer
Handles
DrawableMesh
s - objects to be drawn, and (re-)renders them on demand.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncastRayThroughPixel
(int pixelX, int pixelY, Camera camera) Cast a ray through a pixel under the mouse pointer.protected void
Clears the scene and prepares it for the re-drawing.Gets the current manager of shadersint
gets view port height in pixelsint
gets view port width in pixelsboolean
Returnstrue
, if OpenGL shaders are availablevoid
initGLContext
(com.jogamp.opengl.GLContext glContext) Initialization method - must be called first.void
renderScene
(Camera camera, Collection<Drawable> drawables) Renders drawable objects.void
Sets the scene background to bright.void
Sets the scene background to dark.void
setViewport
(int x, int y, int width, int height) Sets the view-port.
-
Field Details
-
Constructor Details
-
Method Details
-
initGLContext
public void initGLContext(com.jogamp.opengl.GLContext glContext) Initialization method - must be called first.- Parameters:
glContext
- An OpenGL context. Must not benull
, must be at least GL2- Throws:
IllegalArgumentException
- if thegl
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 cornery
- Y cornerwidth
- Widthheight
- Height
-
renderScene
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
Gets the current manager of shaders- Returns:
- shaders manager
-
hasShaders
public boolean hasShaders()Returnstrue
, if OpenGL shaders are available- Returns:
true
, if OpenGL shaders are available
-
castRayThroughPixel
Cast a ray through a pixel under the mouse pointer.- Parameters:
pixelX
- The X coordinate of mouse pointerpixelY
- The X coordinate of mouse pointercamera
- Camera- Returns:
- A ray directing towards the scene
-