Class: Camera

zen3d.Camera()

new Camera()

The camera used for rendering a 3D scene.
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:

euler :zen3d.Euler

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

frustum :zen3d.Frustum

The frustum of the camera.
Type:
Source:

frustumCulled :boolean

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

gammaFactor :number

The factor of gamma.
Type:
  • number
Default Value:
  • 2.0
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:

outputEncoding :zen3d.TEXEL_ENCODING_TYPE

Output pixel encoding.
Type:
Default Value:
  • zen3d.TEXEL_ENCODING_TYPE.LINEAR
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:

projectionMatrix :zen3d.Matrix4

This is the matrix which contains the projection.
Type:
Source:

projectionMatrixInverse :zen3d.Matrix4

This is the matrix which contains the projection.
Type:
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:

rect :zen3d.Vector4

Where on the screen is the camera rendered in normalized coordinates.
Type:
Default Value:
  • zen3d.Vector4(0, 0, 1, 1)
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:

viewMatrix :zen3d.Matrix4

This is the inverse of worldMatrix.
Type:
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.
Overrides:
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

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.
Overrides:
Source:
Returns:
- the result.
Type
Vector3

lookAt(target, up)

Set view by look at, this func will set quaternion of this camera.
Parameters:
Name Type Description
target zen3d.Vector3 The target that the camera look at.
up zen3d.Vector3 The up direction of the camera.
Overrides:
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:

setOrtho(left, right, bottom, top, near, far)

Set orthographic projection matrix.
Parameters:
Name Type Description
left number — Camera frustum left plane.
right number — Camera frustum right plane.
bottom number — Camera frustum bottom plane.
top number — Camera frustum top plane.
near number — Camera frustum near plane.
far number — Camera frustum far plane.
Source:

setPerspective(fov, aspect, near, far)

Set perspective projection matrix.
Parameters:
Name Type Description
fov number — Camera frustum vertical field of view.
aspect number — Camera frustum aspect ratio.
near number — Camera frustum near plane.
far number — Camera frustum far plane.
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.
Overrides:
Source: