Class: Scene

zen3d.Scene()

new Scene()

Scenes allow you to set up what and where is to be rendered by zen3d. This is where you place objects, lights and cameras.
Source:

Extends

Members

castShadow :boolean

Whether the object gets rendered into shadow map.
Type:
  • boolean
Inherited From:
Default Value:
  • false
Source:

children :Array.<zen3d.Object3D>

Object's parent in the scene graph. An object can have at most one parent.
Type:
Inherited From:
Source:

clippingPlanes :Array.<zen3d.Plane>

User-defined clipping planes specified as zen3d.Plane objects in world space. These planes apply to the scene. Points in space whose dot product with the plane is negative are cut away.
Type:
Default Value:
  • []
Source:

disableShadowSampler :boolean

Defines whether disable shadow sampler feature. Shader with sampler2DShadow uniforms may cause unknown error on some android phones, set disableShadowSampler to true to avoid these bugs.
Type:
  • boolean
Default Value:
  • false
Source:

euler :zen3d.Euler

Object's local rotation as an zen3d.Euler, in radians.
Type:
Inherited From:
Default Value:
  • Euler(0, 0, 0)
Source:

fog :zen3d.Fog

A zen3d.Fog instance defining the type of fog that affects everything rendered in the scene.
Type:
Default Value:
  • null
Source:

frustumCulled :boolean

When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object. Otherwise the object gets rendered every frame even if it isn't visible.
Type:
  • boolean
Inherited From:
Default Value:
  • true
Source:

lights :zen3d.LightCache

A zen3d.LightCache instance that collected all lights info after the calling of zen3d.Scene#updateLights.
Type:
Default Value:
  • zen3d.LightCache()
Source:

matrix :zen3d.Matrix4

The local transform matrix.
Type:
Inherited From:
Source:

matrixAutoUpdate :boolean

When this is set, it calculates the matrix of position, (rotation or quaternion) and scale every frame and also recalculates the worldMatrix property.
Type:
  • boolean
Inherited From:
Default Value:
  • true
Source:

matrixNeedsUpdate :boolean

When this is set, it calculates the matrix in that frame and resets this property to false.
Type:
  • boolean
Inherited From:
Default Value:
  • true
Source:

name :string

Optional name of the object (doesn't need to be unique).
Type:
  • string
Inherited From:
Default Value:
  • ""
Source:

overrideMaterial :zen3d.Material

If not null, it will force everything in the scene to be rendered with that material.
Type:
Default Value:
  • null
Source:

parent :zen3d.Object3D

Object's parent in the scene graph. An object can have at most one parent.
Type:
Inherited From:
Source:

position :zen3d.Vector3

A Vector3 representing the object's local position.
Type:
Inherited From:
Default Value:
  • Vector3(0, 0, 0)
Source:

quaternion :zen3d.Quaternion

Object's local rotation as a zen3d.Quaternion.
Type:
Inherited From:
Default Value:
  • Quaternion(0, 0, 0, 1)
Source:

receiveShadow :boolean

Whether the material receives shadows.
Type:
  • boolean
Inherited From:
Default Value:
  • false
Source:

renderOrder :number

This value allows the default rendering order of scene graph objects to be overridden although opaque and transparent objects remain sorted independently. Sorting is from lowest to highest renderOrder.
Type:
  • number
Inherited From:
Default Value:
  • 0
Source:

scale :zen3d.Vector3

The object's local scale.
Type:
Inherited From:
Default Value:
  • Vector3(1, 1, 1)
Source:

shadowType :zen3d.SHADOW_TYPE

Defines shadow map type.
Type:
Inherited From:
Default Value:
  • SHADOW_TYPE.PCF3_SOFT
Source:

type :zen3d.OBJECT_TYPE

Type of the object. Set by Subclass.
Type:
Overrides:
Source:

userData :Object

An object that can be used to store custom data about the zen3d.Object3D. It should not hold references to functions as these will not be cloned.
Type:
  • Object
Inherited From:
Default Value:
  • {}
Source:

uuid :string

UUID of this object instance. This gets automatically assigned, so this shouldn't be edited.
Type:
  • string
Inherited From:
Source:

visible :boolean

Object gets rendered if true.
Type:
  • boolean
Inherited From:
Default Value:
  • true
Source:

worldMatrix :zen3d.Matrix4

The global transform of the object. If the Object3D has no parent, then it's identical to the local transform zen3d.Object3D#matrix.
Type:
Inherited From:
Source:

worldMatrixNeedsUpdate :boolean

When this is set, it calculates the world matrix in that frame and resets this property to false.
Type:
  • boolean
Inherited From:
Default Value:
  • true
Source:

Methods

add(object)

Add object as child of this object.
Parameters:
Name Type Description
object zen3d.Object3D
Inherited From:
Source:

clone(recursiveopt) → {zen3d.Object3D}

Returns a clone of this object and optionally all descendants.
Parameters:
Name Type Attributes Default Description
recursive function <optional>
true if true, descendants of the object are also cloned.
Inherited From:
Source:
Returns:
Type
zen3d.Object3D

copy(source, recursiveopt) → {zen3d.Object3D}

Copy the given object into this object.
Parameters:
Name Type Attributes Default Description
source zen3d.Object3D The object to be copied.
recursive function <optional>
true if true, descendants of the object are also copied.
Inherited From:
Source:
Returns:
Type
zen3d.Object3D

getObjectByName(name) → {zen3d.Object3D}

Searches through the object's children and returns the first with a matching name. Note that for most objects the name is an empty string by default. You will have to set it manually to make use of this method.
Parameters:
Name Type Description
name string String to match to the children's zen3d.Object3D#name property.
Inherited From:
Source:
Returns:
Type
zen3d.Object3D

getObjectByProperty(name, value) → {zen3d.Object3D}

Searches through the object's children and returns the first with a property that matches the value given.
Parameters:
Name Type Description
name string the property name to search for.
value number value of the given property.
Inherited From:
Source:
Returns:
Type
zen3d.Object3D

getRenderList(camera) → {RenderList}

Get zen3d.RenderList for the scene and camera. The Render List must be updated before this calling.
Parameters:
Name Type Description
camera zen3d.Camera The camera.
Source:
Returns:
- The target render list.
Type
RenderList

getWorldDirection(optionalTarget=opt) → {Vector3}

Returns a vector representing the direction of object's positive z-axis in world space. This call must be after zen3d.Object3D#updateMatrix.
Parameters:
Name Type Attributes Description
optionalTarget= Vector3 <optional>
— the result will be copied into this Vector3.
Inherited From:
Source:
Returns:
- the result.
Type
Vector3

lookAt(target, up)

Rotates the object to face a point in local space.
Parameters:
Name Type Description
target Vector3 A vector representing a position in local space.
up Vector3 — A vector representing the up direction in local space.
Inherited From:
Source:

onAfterRender()

An optional callback that is executed immediately after the Object3D is rendered.
Inherited From:
Source:

onBeforeRender()

An optional callback that is executed immediately before the Object3D is rendered.
Inherited From:
Source:

(abstract) raycast(raycaster, intersects)

Method to get intersections between a casted ray and this object.
Parameters:
Name Type Description
raycaster Raycaster The zen3d.Raycaster instance.
intersects Array output intersects array.
Inherited From:
Source:

remove(object)

Remove object as child of this object.
Parameters:
Name Type Description
object zen3d.Object3D
Inherited From:
Source:

traverse(callback)

Executes the callback on this object and all descendants.
Parameters:
Name Type Description
callback function A function with as first argument an object3D object.
Inherited From:
Source:

updateLights() → {LightCache}

Update all lights in the scene.
Source:
Returns:
- An instance of LightCache whitch contains all lights in the scene.
Type
LightCache

updateMatrix()

Update the local transform.
Inherited From:
Source:

updateRenderList(camera) → {RenderList}

Update zen3d.RenderList for the scene and camera.
Parameters:
Name Type Description
camera zen3d.Camera The camera.
Source:
Returns:
- The result render list.
Type
RenderList