Scene Class

Extends Scene
Module: Core

Scenes allow you to set up what and where is to be rendered by the engine.

This is where you place objects, lights and cameras.

A program may contain multiple scenes, its possible to change between scene using scripts.

Scene three.js documentation available here https://threejs.org/docs/index.html#Reference/Scenes/Scene.

Methods

addCamera

(
  • camera
)

Add camera to active cameras list.

Parameters:

  • camera Camera

getCamera

(
  • uuid
  • object
)
Camera

Get camera from scene using cameras uuid.

Parameters:

  • uuid String

    UUID of the camera

  • object Object3D

    Object to search cameras in.

Returns:

Camera:

Camera if found, else null

isCameraActive

(
  • camera
)

Check is camera is active.

Parameters:

  • camera Camera

    Camera to be removed

removeCamera

(
  • camera
)

Remove camera from active camera list.

Parameters:

  • camera Camera

    Camera to be removed

render

(
  • renderer
)

Render scene using all active cameras.

Parameters:

  • renderer Renderer

setFogMode

(
  • mode
)

Set scene fog mode.

It recreates the fog object attached to the scene and set the same color.

Parameters:

  • mode Number

update

(
  • delta
)

Update scene objects and the physics world.

Also updates the global ray caster object used for object culling.

Parameters:

  • delta Number

    The time since the last frame.

updateCameraOrder

()

Update active camera lister order.

This method should be called after changing order value for an active camera.

Properties

alpha

Number

Opacity of the background color.

background

Color | Texture | Null

Background of the scene.

The background of the scene is drawn after the renderer clears the buffers.

It can be a color, a texture or a cube map.

cameras

Array

List of active cameras currently being displayed.

The cameras are rendered by their render order.

canvas

Element

Canvas used to draw this scene.

defaultCamera

Camera

Default camera of the scene used where there is no active camera.

While using the editor the scene default camera gets set as the last camera configuration used.

delta

Number

Stores the time since the last frame.

mouse

Vector2

Normalized mouse coordinates used by the scene internal raycaster.

program

Program

Program that contains this scene.

raycaster

Raycaster

Raycaster used for mouse interaction with 3D objects.

This raycaster is automatically updated using the first camera being drawn.

useOctree

Boolean

Indicates if the scene is using octree indexation for ray casting.

world

World

Cannon.js world used for physics simulation.

The world is configured by default with a NaiveBroadphase and a SplitSolver.

Documentation for cannon.js physics World object can be found at http://schteppe.github.io/cannon.js/docs/classes/World.html.

Attributes

octree

PointOctree

Octree used to index all the unoObject in the scene being visualized.

It is used to filter the visibility of objects and raycast them.

octreeMatches

Array

Stores the octree object matches, that are the objects currently visible.

octreeUpdateScheduled

Boolean

Flag indicating if the is a octree update scheduled.

Avoids scheduling multiple octree updates from different objects.