Package nl.colorize.multimedialib.scene
Interface SceneContext
public interface SceneContext
The currently active scene (and its sub-scenes) receive access to the
scene context, which is provided by the renderer via callback
methods. This allows the scene to access the underlying renderer and
the stage.
The stage contains the graphics and audio for the currently active scene. The stage can contain both 2D and 3D graphics, depending on what is supported by the renderer. At the end of a scene, the stage is cleared so the next scene can take over.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidWraps aRunnableso that is acts as a sub-scene for the currently active scene.default voidAttaches a sub-scene to the currently active scene.default voidAttaches anUpdatableto act as a sub-scene for the currently active scene.default voidattachGlobal(Scene globalSubScene) Attaches a scene that is *not* tied to the currently active scene, and will remain active for the rest of the application.booleancastPickRay(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.default voidchangeScene(Scene requestedScene) Requests to change the active scene after the current frame update has been completed.default MeshcreateMesh(Shape3D shape) Programmatically creates a 3D polygon mesh that initially does not have any color or texture information attached to it.createMesh(Shape3D shape, ColorRGB color) Programmatically creates a 3D polygon mesh with a solid color, based on the specified shape.default CanvasReturns debug and support information that can be displayed when running a MultimediaLib application in debug mode.default FrameStatsgetInput()Returns the display name for the underlying renderer.getStage()Returns the 3D world coordinates that correspond to the specified 2D canvas coordinates, based on the current camera position.voidtakeScreenshot(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.
-
Method Details
-
getConfig
RenderConfig getConfig() -
getCanvas
-
getMediaLoader
MediaLoader getMediaLoader() -
getInput
InputDevice getInput() -
getNetwork
Network getNetwork() -
getSceneManager
SceneManager getSceneManager() -
getStage
Stage getStage() -
getFrameStats
-
changeScene
Requests to change the active scene after the current frame update has been completed. If another scene had already been requested, calling this method again will overrule that request. -
attach
Attaches a sub-scene to the currently active scene. The sub-scene will remain active until it is detached or the parent scene ends. -
attach
Attaches anUpdatableto act as a sub-scene for the currently active scene. The sub-scene will remain active until it is detached or the parent scene ends. -
attach
Wraps aRunnableso that is acts as a sub-scene for the currently active scene. The sub-scene will remain active until it is detached or the parent scene ends. -
attachGlobal
Attaches a scene that is *not* tied to the currently active scene, and will remain active for the rest of the application. Multiple global scenes can be attached. -
createMesh
Programmatically creates a 3D polygon mesh with a solid color, based on the specified shape.- Throws:
UnsupportedOperationException- if this renderer does not support 3D graphics.
-
createMesh
Programmatically creates a 3D polygon mesh that initially does not have any color or texture information attached to it. The mesh can be modified after creation usingMesh.applyColor(ColorRGB)andMesh.applyTexture(Image)respectively.- Throws:
UnsupportedOperationException- if this renderer does not support 3D graphics.
-
project
Returns the 3D world coordinates that correspond to the specified 2D canvas coordinates, based on the current camera position.- Throws:
UnsupportedOperationException- if this renderer does not support 3D graphics.
-
castPickRay
Casts a pick ray from the specified 2D canvas position, and returns true if the pick ray intersects with the specified 3D world coordinates.- Throws:
UnsupportedOperationException- if this renderer does not support 3D graphics.
-
takeScreenshot
Captures a screenshot of the renderer's current graphics and then exports the screenshot to a PNG file.- Throws:
UnsupportedOperationException- if this renderer does not support taking screenshots at runtime.
-
terminate
void terminate()Terminates the renderer, which will end the animation loop and quit the application.- Throws:
UnsupportedOperationException- if the current platform does not support terminating applications.
-
getRendererName
String getRendererName()Returns the display name for the underlying renderer. The display name will not include the word "renderer". -
getDebugInformation
Returns debug and support information that can be displayed when running a MultimediaLib application in debug mode. The returned list is intended to be displayed in aText, which can be styled to match the application appearance.
-