Class: AmbientLight

zen3d.AmbientLight(coloropt, intensityopt)

new AmbientLight(coloropt, intensityopt)

This light globally illuminates all objects in the scene equally. This light cannot be used to cast shadows as it does not have a direction.
Parameters:
Name Type Attributes Default Description
color number <optional>
0xffffff
intensity number <optional>
1
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:

color :zen3d.Color3

Color of the light.
Type:
Inherited From:
Default Value:
  • zen3d.Color3(0xffffff)
Source:

euler :zen3d.Euler

Object's local rotation as an zen3d.Euler, in radians.
Type:
Inherited From:
Default Value:
  • Euler(0, 0, 0)
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:

intensity :number

The light's intensity, or strength.
Type:
  • number
Inherited From:
Default Value:
  • 1
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:

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:
Inherited From:
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) → {zen3d.Light}

Copies properties from the source light into this one.
Parameters:
Name Type Description
source zen3d.Light The source light.
Inherited From:
Source:
Returns:
- This light.
Type
zen3d.Light

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

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:

updateMatrix()

Update the local transform.
Inherited From:
Source: