Class: Camera

Camera(width, height, distance, target, ortho, up)

new Camera(width, height, distance, target, ortho, up)

Create a combined camera (orthographic and persepctive).
Parameters:
Name Type Description
width number canvas width.
height number canvas height.
distance number distance from the lookAt point.
target THREE.Vector3 target (Vector3) to look at.
ortho boolean flag whether the initial camera should be orthographic.
up string Z or Y to define whether Z or Y direction is camera up.
Source:

Methods

dispose()

Remove assets.
Source:

getCamera() → {THREE.Camera}

Get the current camera.
Source:
Returns:
Camera object.
Type
THREE.Camera

getPosition() → {THREE.Vector3}

Get the current camera position.
Source:
Returns:
camera position.
Type
THREE.Vector3

getQuaternion() → {THREE.Quaternion}

Get the current camera quaternion.
Source:
Returns:
camera quaternion.
Type
THREE.Quaternion

getRotation() → {THREE.Euler}

Get the current camera rotation.
Source:
Returns:
camera rotation.
Type
THREE.Euler

getZoom() → {number}

Return current zoom value.
Source:
Returns:
zoom value.
Type
number

lookAtTarget()

Set the lookAt point for the camera to the provided target.
Source:

presetCamera(dir)

Move the camera to a given preset.
Parameters:
Name Type Description
dir string can be "iso", "top", "bottom", "front", "rear", "left", "right"
Source:

projectSize(frustum, aspect)

Calculate projected size for orthographic ca,era
Parameters:
Name Type Description
frustum number view frustum.
aspect number viewer aspect (width / height).
Source:

setPosition(relative, position)

Set camera position.
Parameters:
Name Type Description
relative boolean flag whether the position is a relative (e.g. [1,1,1] for iso) or absolute point.
position Array(3) | THREE.Vector3 position as 3 dim Array [x,y,z] or as Vector3.
Source:

setQuaternion(quaternion)

Set camera quaternion.
Parameters:
Name Type Description
quaternion Array(4) | THREE.Quaternion quaternion as 4 dim Array or as Quaternion.
Source:

setZoom(val)

Set zoom value.
Parameters:
Name Type Description
val number float zoom value.
Source:

setupCamera(relative, position, quaternion, zoom)

Setup the current camera.
Parameters:
Name Type Default Description
relative boolean flag whether the position is a relative (e.g. [1,1,1] for iso) or absolute point.
position THREE.Vector3 null the camera position (relative or absolute).
quaternion THREE.Quaternion null the camera rotation expressed by a quaternion.
zoom number null zoom value.
Source:

switchCamera(ortho_flag)

Switch between orthographic and perspective camera.
Parameters:
Name Type Description
ortho_flag boolean true for orthographic camera, else persepctive camera.
Source:

updateProjectionMatrix()

Update current camera's projection matrix.
Source: