Coppercube API Documentation
Class Scene
A 3d scene, containing all SceneNodes.
The scene holds all SceneNodes and is able to draw and animate them.
Field Attributes | Field Name and Description |
---|---|
<static> |
Scene.REDRAW_EVERY_FRAME
Constant for using in Scene.setRedrawMode, specifying the scene should be redrawn every frame.
|
<static> |
Scene.REDRAW_WHEN_CAM_MOVED
Constant for using in Scene.setRedrawMode, specifying the scene should be redrawn only when the camera changed
|
<static> |
Constant for using in Scene.setRedrawMode, specifying the scene should be redrawn only when the scene has changed
|
<static> |
Scene.RENDER_MODE_2DOVERLAY
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
|
<static> |
Scene.RENDER_MODE_CAMERA
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
|
<static> |
Scene.RENDER_MODE_DEFAULT
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
|
<static> |
Scene.RENDER_MODE_LIGHTS
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
|
<static> |
Scene.RENDER_MODE_SKYBOX
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
|
<static> |
Scene.RENDER_MODE_TRANSPARENT
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
|
Method Attributes | Method Name and Description |
---|---|
drawAll(renderer)
Draws and animates the whole 3D scene.
|
|
Forces the renderer to redraw this scene the next frame, independent of the currently used redraw mode.
|
|
Returns the currently active {CameraSceneNode} in the scene.
|
|
getAllSceneNodesOfType(type)
Returns all scene nodes in this scene with the specified type SceneNodes.
|
|
Gets the background color of the scene
|
|
Returns the automatically generated collision geometry containing all scene nodes with had the collision flag set to true
in the editor.
|
|
Returns the current mode of rendering, can be for example Scene.RENDER_MODE_TRANSPARENT.
|
|
getName()
Returns the name of the scene
|
|
Returns the root SceneNode, the root of the whole scene graph.
|
|
Returns the first SceneNode in this scene with the specified id.
|
|
getSceneNodeFromName(name)
Returns the first SceneNode in this scene with the specified name.
|
|
Returns the type string of the current scene.
|
|
Returns the start time in milliseconds of this scene.
|
|
registerNodeForRendering(s, mode)
Used for Scene nodes to register themselves for rendering
When called SceneNode.OnRegisterSceneNode, a scene node should call
this method to register itself for rendering if it decides that it wants to be rendered.
|
|
setActiveCamera(activeCamera)
Sets the currently active {CameraSceneNode} in the scene.
|
|
setBackgroundColor(clr)
Sets the background color for the scene
|
|
setName(name)
Sets the name of the scene
|
|
setRedrawMode(mode)
Specifies when the scene should be redrawn.
|
Field Detail
<static>
Scene.REDRAW_EVERY_FRAME
Constant for using in Scene.setRedrawMode, specifying the scene should be redrawn every frame.
<static>
Scene.REDRAW_WHEN_CAM_MOVED
Constant for using in Scene.setRedrawMode, specifying the scene should be redrawn only when the camera changed
<static>
Scene.REDRAW_WHEN_SCENE_CHANGED
Constant for using in Scene.setRedrawMode, specifying the scene should be redrawn only when the scene has changed
<static>
Scene.RENDER_MODE_2DOVERLAY
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
<static>
Scene.RENDER_MODE_CAMERA
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
<static>
Scene.RENDER_MODE_DEFAULT
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
<static>
Scene.RENDER_MODE_LIGHTS
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
<static>
Scene.RENDER_MODE_SKYBOX
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
<static>
Scene.RENDER_MODE_TRANSPARENT
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
Method Detail
drawAll(renderer)
Draws and animates the whole 3D scene. Not necessary to call usually, CopperLicht is doing this
itself by default.
- Parameters:
- renderer
- Renderer used for drawing.
forceRedrawNextFrame()
Forces the renderer to redraw this scene the next frame, independent of the currently used redraw mode.
{CameraSceneNode}
getActiveCamera()
Returns the currently active {CameraSceneNode} in the scene.
- Returns:
- {CameraSceneNode} active camera
{Array}
getAllSceneNodesOfType(type)
Returns all scene nodes in this scene with the specified type SceneNodes.
- Returns:
- {Array} array with all scene nodes found with this type.
{Number}
getBackgroundColor()
Gets the background color of the scene
- Returns:
- {Number} Background color. See Core.createColor on how to create such a color value.
getCollisionGeometry()
Returns the automatically generated collision geometry containing all scene nodes with had the collision flag set to true
in the editor.
- Returns:
- Returns a MetaTriangleSelector providing access to all to collision geomertry in this scene.
getCurrentRenderMode()
Returns the current mode of rendering, can be for example Scene.RENDER_MODE_TRANSPARENT.
Is useful for scene nodes which render themselves for example both solid and transparent.
getName()
Returns the name of the scene
{SceneNode}
getRootSceneNode()
Returns the root SceneNode, the root of the whole scene graph.
- Returns:
- {SceneNode} The root scene node.
{SceneNode}
getSceneNodeFromId(id)
Returns the first SceneNode in this scene with the specified id.
- Returns:
- {SceneNode} the found scene node or null if not found.
{SceneNode}
getSceneNodeFromName(name)
Returns the first SceneNode in this scene with the specified name.
- Returns:
- {SceneNode} the found scene node or null if not found.
getSceneType()
Returns the type string of the current scene.
getStartTime()
Returns the start time in milliseconds of this scene. Useful for Animators.
registerNodeForRendering(s, mode)
Used for Scene nodes to register themselves for rendering
When called SceneNode.OnRegisterSceneNode, a scene node should call
this method to register itself for rendering if it decides that it wants to be rendered.
In this way, scene nodes can be rendered in the optimal order.
- Parameters:
- s
- {SceneNode} Node which registers itself for rendering
- mode
- render mode the scene node wishes to register itself. Usually, use Scene.RENDER_MODE_DEFAULT. For transparent nodes, Scene.RENDER_MODE_TRANSPARENT is ideal.
setActiveCamera(activeCamera)
Sets the currently active {CameraSceneNode} in the scene.
- Parameters:
- {CameraSceneNode} activeCamera
- The new active camera
setBackgroundColor(clr)
Sets the background color for the scene
- Parameters:
- clr
- {Number} New color. See Core.createColor on how to create such a color value.
setName(name)
Sets the name of the scene
- Parameters:
- name
setRedrawMode(mode)
Specifies when the scene should be redrawn.
- Parameters:
- mode
- Possible values are Scene.REDRAW_WHEN_CAM_MOVED, Scene.REDRAW_WHEN_SCENE_CHANGED and Scene.REDRAW_EVERY_FRAME.