CopperLicht API Documentation
Class CL3D.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> |
CL3D.Scene.EPOSTEFFECT_BLACK_AND_WHITE
Constant for post effect mode
|
<static> |
CL3D.Scene.EPOSTEFFECT_BLOOM
Constant for post effect mode
|
<static> |
CL3D.Scene.EPOSTEFFECT_BLUR
Constant for post effect mode
|
<static> |
CL3D.Scene.EPOSTEFFECT_BLUR_HORIZONTAL
Constant for post effect mode
|
<static> |
CL3D.Scene.EPOSTEFFECT_BLUR_VERTICAL
Constant for post effect mode
|
<static> |
CL3D.Scene.EPOSTEFFECT_COLORIZE
Constant for post effect mode
|
<static> |
CL3D.Scene.EPOSTEFFECT_COUNT
Constant for post effect mode
|
<static> |
CL3D.Scene.EPOSTEFFECT_INVERT
Constant for post effect mode
|
<static> |
CL3D.Scene.EPOSTEFFECT_LIGHT_TRESHOLD
Constant for post effect mode
|
<static> |
CL3D.Scene.EPOSTEFFECT_VIGNETTE
Constant for post effect mode
|
<static> |
CL3D.Scene.REDRAW_EVERY_FRAME
Constant for using in Scene.setRedrawMode, specifying the scene should be redrawn every frame.
|
<static> |
CL3D.Scene.REDRAW_WHEN_CAM_MOVED
Constant for using in Scene.setRedrawMode, specifying the scene should be redrawn only when the camera changed
|
<static> |
CL3D.Scene.REDRAW_WHEN_SCENE_CHANGED
Constant for using in Scene.setRedrawMode, specifying the scene should be redrawn only when the scene has changed
|
<static> |
CL3D.Scene.RENDER_MODE_2DOVERLAY
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
|
<static> |
CL3D.Scene.RENDER_MODE_CAMERA
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
|
<static> |
CL3D.Scene.RENDER_MODE_DEFAULT
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
|
<static> |
CL3D.Scene.RENDER_MODE_LIGHTS
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
|
<static> |
CL3D.Scene.RENDER_MODE_RTT_SCENE
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
|
<static> |
CL3D.Scene.RENDER_MODE_SHADOW_BUFFER
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
|
<static> |
CL3D.Scene.RENDER_MODE_SKYBOX
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
|
<static> |
CL3D.Scene.RENDER_MODE_TRANSPARENT
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
|
<static> |
CL3D.Scene.RENDER_MODE_TRANSPARENT_AFTER_ZBUFFER_CLEAR
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
|
Controls shadowmap backface bias.
|
|
Value for influencing which pixels are taken for in shadow and which are not.
|
|
this gives a way to adjust the detail: Between how long are shadows visible in
the distance and how detailed the shadow map is in close vicinity.
|
|
Controls the transparency with which the shadows are being drawn.
|
|
Use orthogonal light for shadows.
|
|
Enable for rendering realtime 3D shadows in this scene.
|
|
Texture size of the shadow map, usually 1024
|
|
<static> |
CL3D.Scene.TRANSPARENT_SOLID_AFTER_ZBUFFER_CLEAR
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.
|
|
drawRegistered3DNodes(renderer, callbackForOnAfterSkyboxRendering)
/implementation part of drawAll(), which usually gets called during drawAll() for drawing the reigered 3d nodes.
|
|
Forces the renderer to redraw this scene the next frame, independent of the currently used redraw mode.
|
|
Returns the currently active {CL3D.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.
|
|
getCullingBBoxAndStoreCameraFrustrum(renderer, projectionMatrix, viewMatrix, camPos, alwaysReturnBox)
|
|
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.
|
|
initShadowMapRendering(renderer)
|
|
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.
|
|
renderShadowMap(renderer)
|
|
setActiveCamera(activeCamera)
Sets the currently active {CL3D.CameraSceneNode} in the scene.
|
|
setBackgroundColor(clr)
Sets the background color for the scene
|
|
setFog(enabled, color, density)
Enables/disables fog for this whole scene and changes its color and density
|
|
setName(name)
Sets the name of the scene
|
|
setRedrawMode(mode)
Specifies when the scene should be redrawn.
|
Field Detail
<static>
CL3D.Scene.EPOSTEFFECT_BLACK_AND_WHITE
Constant for post effect mode
<static>
CL3D.Scene.EPOSTEFFECT_BLOOM
Constant for post effect mode
<static>
CL3D.Scene.EPOSTEFFECT_BLUR
Constant for post effect mode
<static>
CL3D.Scene.EPOSTEFFECT_BLUR_HORIZONTAL
Constant for post effect mode
<static>
CL3D.Scene.EPOSTEFFECT_BLUR_VERTICAL
Constant for post effect mode
<static>
CL3D.Scene.EPOSTEFFECT_COLORIZE
Constant for post effect mode
<static>
CL3D.Scene.EPOSTEFFECT_COUNT
Constant for post effect mode
<static>
CL3D.Scene.EPOSTEFFECT_INVERT
Constant for post effect mode
<static>
CL3D.Scene.EPOSTEFFECT_LIGHT_TRESHOLD
Constant for post effect mode
<static>
CL3D.Scene.EPOSTEFFECT_VIGNETTE
Constant for post effect mode
<static>
CL3D.Scene.REDRAW_EVERY_FRAME
Constant for using in Scene.setRedrawMode, specifying the scene should be redrawn every frame.
<static>
CL3D.Scene.REDRAW_WHEN_CAM_MOVED
Constant for using in Scene.setRedrawMode, specifying the scene should be redrawn only when the camera changed
<static>
CL3D.Scene.REDRAW_WHEN_SCENE_CHANGED
Constant for using in Scene.setRedrawMode, specifying the scene should be redrawn only when the scene has changed
<static>
CL3D.Scene.RENDER_MODE_2DOVERLAY
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
<static>
CL3D.Scene.RENDER_MODE_CAMERA
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
<static>
CL3D.Scene.RENDER_MODE_DEFAULT
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
<static>
CL3D.Scene.RENDER_MODE_LIGHTS
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
<static>
CL3D.Scene.RENDER_MODE_RTT_SCENE
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
Used by objects in order to render the fully animated scene as separate pass into their
own render target texture. They can call drawRegistered3DNodes() for this once this pass is called.
<static>
CL3D.Scene.RENDER_MODE_SHADOW_BUFFER
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
Used by the scene manager to indicate that the current rendering call is for drawing into a shadow buffer
<static>
CL3D.Scene.RENDER_MODE_SKYBOX
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
<static>
CL3D.Scene.RENDER_MODE_TRANSPARENT
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
<static>
CL3D.Scene.RENDER_MODE_TRANSPARENT_AFTER_ZBUFFER_CLEAR
Constant for using in Scene.registerNodeForRendering, specifying the render mode of a scene node.
{Number}
ShadowMapBackfaceBias
Controls shadowmap backface bias. 0.5 culls backfaces for shadows nicely looking, 0 not at all, and 1 culls all shadows away.
{Number}
ShadowMapBias1
Value for influencing which pixels are taken for in shadow and which are not.
Depends on your scene. Tweak it so that the shadows in your scene look the way you want them to,
values like 0.001, 0.0001 or even 0.00001 are usual.
{Number}
ShadowMapCameraViewDetailFactor
this gives a way to adjust the detail: Between how long are shadows visible in
the distance and how detailed the shadow map is in close vicinity. Make the value bigger
(like 1.0) for longer viewable shadows but with smaller details, and smaller (like 0.2)
for detailed shadow which don't have a big view distance.
{Number}
ShadowMapOpacity
Controls the transparency with which the shadows are being drawn.
ShadowMapOrthogonal
Use orthogonal light for shadows. Usually leave this 'true'.
{Boolean}
ShadowMappingEnabled
Enable for rendering realtime 3D shadows in this scene. The scene must have a directional light for this.
{Number}
ShadowMapResolution
Texture size of the shadow map, usually 1024
<static>
CL3D.Scene.TRANSPARENT_SOLID_AFTER_ZBUFFER_CLEAR
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:
- {CL3D.Renderer} renderer
- used for drawing.
drawRegistered3DNodes(renderer, callbackForOnAfterSkyboxRendering)
/implementation part of drawAll(), which usually gets called during drawAll() for drawing the reigered 3d nodes.
can be called separately by special nodes like water or reflections, which needs to render everything a bit differently
into a RTT
- Parameters:
- {CL3D.Renderer} renderer
- used for drawing.
- callbackForOnAfterSkyboxRendering
forceRedrawNextFrame()
Forces the renderer to redraw this scene the next frame, independent of the currently used redraw mode.
{CL3D.CameraSceneNode}
getActiveCamera()
Returns the currently active {CL3D.CameraSceneNode} in the scene.
- Returns:
- {CL3D.CameraSceneNode} active camera
{Array}
getAllSceneNodesOfType(type)
Returns all scene nodes in this scene with the specified type SceneNodes.
- Parameters:
- type
- {String} type name of the SceneNode. See SceneNode.getType().
- 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 CL3D.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.
getCullingBBoxAndStoreCameraFrustrum(renderer, projectionMatrix, viewMatrix, camPos, alwaysReturnBox)
- Parameters:
- renderer
- projectionMatrix
- viewMatrix
- camPos
- alwaysReturnBox
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
{CL3D.SceneNode}
getRootSceneNode()
Returns the root SceneNode, the root of the whole scene graph.
- Returns:
- {CL3D.SceneNode} The root scene node.
{CL3D.SceneNode}
getSceneNodeFromId(id)
Returns the first SceneNode in this scene with the specified id.
- Parameters:
- id
- {Number} name of the SceneNode. See SceneNode.getId().
- Returns:
- {CL3D.SceneNode} the found scene node or null if not found.
{CL3D.SceneNode}
getSceneNodeFromName(name)
Returns the first SceneNode in this scene with the specified name.
- Parameters:
- name
- {String} name of the SceneNode. See SceneNode.getName().
- Returns:
- {CL3D.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.
initShadowMapRendering(renderer)
- Parameters:
- renderer
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:
- {CL3D.SceneNode} s
- Node which registers itself for rendering
- {Integer} mode
- render mode the scene node wishes to register itself. Usually, use CL3D.Scene.RENDER_MODE_DEFAULT. For transparent nodes, CL3D.Scene.RENDER_MODE_TRANSPARENT is ideal.
renderShadowMap(renderer)
- Parameters:
- renderer
setActiveCamera(activeCamera)
Sets the currently active {CL3D.CameraSceneNode} in the scene.
- Parameters:
- {CL3D.CameraSceneNode} activeCamera
- The new active camera
setBackgroundColor(clr)
Sets the background color for the scene
- Parameters:
- clr
- {Number} New color. See CL3D.createColor on how to create such a color value.
setFog(enabled, color, density)
Enables/disables fog for this whole scene and changes its color and density
scene.setFog(true, CL3D.createColor(1, 100, 100, 100), 0.1);
- Parameters:
- enabled
- {Boolean} (optional) set to true to enable fog and false not to enable
- color
- {Number} Fog color. See CL3D.createColor on how to create such a color value.
- density
- {Number} Density of the fog. A value like 0.001 is default.
setName(name)
Sets the name of the scene
- Parameters:
- name
setRedrawMode(mode)
Specifies when the scene should be redrawn.
- Parameters:
- mode
- Possible values are CL3D.Scene.REDRAW_WHEN_CAM_MOVED, CL3D.Scene.REDRAW_WHEN_SCENE_CHANGED and CL3D.Scene.REDRAW_EVERY_FRAME.