Class Stage
java.lang.Object
nl.colorize.multimedialib.stage.Stage
The stage contains the graphics and audio for the currently active scene.
The stage can contain both 2D and 3D graphics. It is structured as a
scene graph,
where transforming a parent node propagates to its children.
While the scene has full control over the stage, this control cannot outlive the scene itself: at the end of the scene the contents of the stage are cleared so the next scene can take over.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionStage(GraphicsMode graphicsMode, Canvas canvas) Creates a new stage that will be drawn to the specified canvas, using the specified graphics mode. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new container, then adds it to the root of the scene graph.addContainer(String name) Creates a new container with the specified name, then adds it to the root of the scene graph.Creates a new group with the specified name, then adds it to the root container for 3D graphics to make it part of the stage.voidclear()Removes all 2D and 3D graphics from the stage.voiddetach(StageNode2D node) Deprecated.voiddetach(StageNode3D node) Deprecated.Prefer usingStageNode2D.detach()instead.findNodePath(StageNode2D node) Returns the path towards the specified node.findNodePath(StageNode3D node) Returns the path towards the specified node.getRoot()voidRecalculates the global transform for the specified node.voidRecalculates the global transform for the specified node.voidsetAmbientLightColor(ColorRGB ambientLightColor) voidsetBackgroundColor(ColorRGB backgroundColor) voidsetCameraFocus(Point3D cameraFocus) voidsetCameraPosition(Point3D cameraPosition) voidsubscribe(StageSubscriber subscriber) Subscribes to this stage, receiving events every time nodes are added or removed.toString()Returns a textual representation of the stage's current contents, which can be used for testing and debugging purposes.voidvisit(StageVisitor visitor) Visits all nodes that are currently part of the stage.
-
Field Details
-
DEFAULT_AMBIENT_LIGHT_COLOR
-
-
Constructor Details
-
Stage
Creates a new stage that will be drawn to the specified canvas, using the specified graphics mode.
-
-
Method Details
-
addContainer
Creates a new container, then adds it to the root of the scene graph. Returns the container that was just created. This is a convenience method to easily create top-level containers. -
addContainer
-
addGroup
-
detach
Deprecated.Prefer usingStageNode2D.detach()instead. This method remains only for backward compatibility.Detaches the specified node from the scene graph. If the node is not currently part of the stage, calling this method does nothing. -
detach
Deprecated.Prefer usingStageNode2D.detach()instead. This method remains only for backward compatibility.Detaches the specified node from the scene graph. If the node is not currently part of the stage, calling this method does nothing. -
clear
public void clear()Removes all 2D and 3D graphics from the stage. This is always called at the end of a scene, but can also be used manually mid-scene. -
visit
Visits all nodes that are currently part of the stage. Nodes will be visited in the order in which they should be drawn. Parent nodes will be visited before their children. -
subscribe
Subscribes to this stage, receiving events every time nodes are added or removed. -
findNodePath
Returns the path towards the specified node. The first element in the list is the root node, the last element is the node itself. If the node is not currently part of the stage, this returns a list containing only the node itself. -
findNodePath
Returns the path towards the specified node. The first element in the list is the root node, the last element is the node itself. If the node is not currently part of the stage, this returns a list containing only the node itself. -
recalculateGlobalTransform
Recalculates the global transform for the specified node. The global transform is normally updated at the end of each frame update when the node is drawn. This method can be used to force-recalculate the global transform for a single node.Since the global transform is relative to the node's parent, this will also recalculate the global transform for its parents, recursively. This method therefore has a performance impact, and should only be used on/for a limited number of nodes per frame update.
-
recalculateGlobalTransform
Recalculates the global transform for the specified node. The global transform is normally updated at the end of each frame update when the node is drawn. This method can be used to force-recalculate the global transform for a single node.Since the global transform is relative to the node's parent, this will also recalculate the global transform for its parents, recursively. This method therefore has a performance impact, and should only be used on/for a limited number of nodes per frame update.
-
toString
-
getGraphicsMode
-
getCanvas
-
getAnimationTimer
-
getRoot
-
getBackgroundColor
-
getRoot3D
-
getCameraPosition
-
getCameraFocus
-
getAmbientLightColor
-
setBackgroundColor
-
setCameraPosition
-
setCameraFocus
-
setAmbientLightColor
-
StageNode2D.detach()instead.