Class HeadlessRenderer
java.lang.Object
nl.colorize.multimedialib.renderer.headless.HeadlessRenderer
- All Implemented Interfaces:
InputDevice,Renderer,SceneContext,Updatable
Headless renderer implementation which can be used for testing and
simulation purposes, and (unlike all other renderers) can be used on
platforms without a graphics environment.
The headless renderer can be started without an active animation loop. In this scenatio, all frame updates need to be performed manually.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancastPickRay(Point2D canvasPosition, Box area) Casts a pick ray from the specified 2D canvas position, and returns true if the pick ray intersects with the specified 3D world coordinates.voidClears all pointer state for all currently active pointers.createMesh(Shape3D shape, ColorRGB color) Programmatically creates a 3D polygon mesh with a solid color, based on the specified shape.voiddoFrame()voiddoFrame(float deltaTime) voidfillClipboard(String text) Copies the specified text to the system clipboard.Deprecated.getInput()Returns all currently active pointers.Returns the display name for the underlying renderer.getStage()booleanbooleanbooleanisKeyPressed(KeyCode keyCode) Returns true if the key with the specified key code was pressed during the current frame.booleanisKeyReleased(KeyCode keyCode) Returns true if the key with the specified key code was released during the current frame.booleanbooleanbooleanisSupported(GraphicsMode graphicsMode) booleanReturns the 3D world coordinates that correspond to the specified 2D canvas coordinates, based on the current camera position.nl.colorize.util.Subject<String> requestTextInput(String label, String initialValue) Shows a dialog window with a text input field.voidsetConfig(RenderConfig config) voidsetGraphics(StageVisitor graphics) voidsetGraphicsEnvironmentEnabled(boolean graphicsEnvironmentEnabled) voidsetKeyboardAvailable(boolean keyboardAvailable) voidsetMediaLoader(MediaLoader mediaLoader) voidsetNetwork(Network network) voidsetPointer(Point2D pointer) voidsetPointerPressed(boolean pointerPressed) voidsetPointerReleased(boolean pointerReleased) voidsetSceneManager(SceneManager sceneManager) voidvoidsetTouchAvailable(boolean touchAvailable) voidstart(RenderConfig config, Scene initialScene) Starts this renderer based on the specified configuration.voidvoidtakeScreenshot(File screenshotFile) Captures a screenshot of the renderer's current graphics and then exports the screenshot to a PNG file.voidTerminates the renderer, which will end the animation loop and quit the application.voidupdate(float deltaTime) Updates this object for the current frame.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface nl.colorize.multimedialib.renderer.InputDevice
isPointerPressed, isPointerReleasedMethods inherited from interface nl.colorize.multimedialib.scene.SceneContext
attach, attach, attach, attachGlobal, changeScene, createMesh, getCanvas, getDebugInformation, getFrameStats
-
Field Details
-
DEFAULT_FONT
-
-
Constructor Details
-
HeadlessRenderer
public HeadlessRenderer(boolean graphicsEnvironmentEnabled)
-
-
Method Details
-
start
Description copied from interface:RendererStarts this renderer based on the specified configuration. The renderer will initially display the specified scene.This method can be called from any thread. The renderer will run in its own thread, which is started by calling this method. All callback methods will be called from the renderer thread.
-
start
-
terminate
public void terminate()Description copied from interface:SceneContextTerminates the renderer, which will end the animation loop and quit the application.- Specified by:
terminatein interfaceSceneContext
-
project
Description copied from interface:SceneContextReturns the 3D world coordinates that correspond to the specified 2D canvas coordinates, based on the current camera position.- Specified by:
projectin interfaceSceneContext
-
castPickRay
Description copied from interface:SceneContextCasts a pick ray from the specified 2D canvas position, and returns true if the pick ray intersects with the specified 3D world coordinates.- Specified by:
castPickRayin interfaceSceneContext
-
createMesh
Description copied from interface:SceneContextProgrammatically creates a 3D polygon mesh with a solid color, based on the specified shape.- Specified by:
createMeshin interfaceSceneContext
-
takeScreenshot
Description copied from interface:SceneContextCaptures a screenshot of the renderer's current graphics and then exports the screenshot to a PNG file.- Specified by:
takeScreenshotin interfaceSceneContext
-
getRendererName
Description copied from interface:SceneContextReturns the display name for the underlying renderer. The display name will not include the word "renderer".- Specified by:
getRendererNamein interfaceSceneContext
-
isSupported
- Specified by:
isSupportedin interfaceRenderer
-
getContext
Deprecated. -
doFrame
public void doFrame() -
doFrame
public void doFrame(float deltaTime) -
update
public void update(float deltaTime) Description copied from interface:UpdatableUpdates this object for the current frame.deltaTimeindicates the elapsed time since the last frame update, in seconds. -
getInput
- Specified by:
getInputin interfaceSceneContext
-
getPointers
Description copied from interface:InputDeviceReturns all currently active pointers. Depending on the current platform and device, pointers could be based on mouse input, a trackpad, or touch controls.Note that the type of pointer will also influence its behavior. The mouse pointer is always included in this list, since the mouse cursor is always visible. Touch pointer are only available during the touch, as the pointer disappears once the touch event has ended.
- Specified by:
getPointersin interfaceInputDevice
-
clearPointerState
public void clearPointerState()Description copied from interface:InputDeviceClears all pointer state for all currently active pointers. Using this method is the equivalent of usingPointer.clearState()on all pointers.- Specified by:
clearPointerStatein interfaceInputDevice
-
isKeyPressed
Description copied from interface:InputDeviceReturns true if the key with the specified key code was pressed during the current frame.- Specified by:
isKeyPressedin interfaceInputDevice
-
isKeyReleased
Description copied from interface:InputDeviceReturns true if the key with the specified key code was released during the current frame.- Specified by:
isKeyReleasedin interfaceInputDevice
-
requestTextInput
Description copied from interface:InputDeviceShows a dialog window with a text input field. The dialog window is not part of the scene, it uses the platform's native user interface.- Specified by:
requestTextInputin interfaceInputDevice
-
fillClipboard
Description copied from interface:InputDeviceCopies the specified text to the system clipboard.- Specified by:
fillClipboardin interfaceInputDevice
-
isGraphicsEnvironmentEnabled
public boolean isGraphicsEnvironmentEnabled() -
getConfig
- Specified by:
getConfigin interfaceSceneContext
-
getGraphics
-
getMediaLoader
- Specified by:
getMediaLoaderin interfaceSceneContext
-
getNetwork
- Specified by:
getNetworkin interfaceSceneContext
-
getSceneManager
- Specified by:
getSceneManagerin interfaceSceneContext
-
getStage
- Specified by:
getStagein interfaceSceneContext
-
isTouchAvailable
public boolean isTouchAvailable()- Specified by:
isTouchAvailablein interfaceInputDevice
-
isKeyboardAvailable
public boolean isKeyboardAvailable()- Specified by:
isKeyboardAvailablein interfaceInputDevice
-
getPointer
-
isPointerPressed
public boolean isPointerPressed() -
isPointerReleased
public boolean isPointerReleased() -
setGraphicsEnvironmentEnabled
public void setGraphicsEnvironmentEnabled(boolean graphicsEnvironmentEnabled) -
setConfig
-
setGraphics
-
setMediaLoader
-
setNetwork
-
setSceneManager
-
setStage
-
setTouchAvailable
public void setTouchAvailable(boolean touchAvailable) -
setKeyboardAvailable
public void setKeyboardAvailable(boolean keyboardAvailable) -
setPointer
-
setPointerPressed
public void setPointerPressed(boolean pointerPressed) -
setPointerReleased
public void setPointerReleased(boolean pointerReleased)
-