Skip to content

Class: Camera3D

Camera components

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Camera3D(): Camera3D

Returns

Camera3D

Overrides

ComponentBase.constructor

Defined in

src/core/Camera3D.ts:155

Properties

object3D

object3D: Object3D = null

owner object3D

Inherited from

ComponentBase.object3D

Defined in

src/components/ComponentBase.ts:17


isDestroyed

isDestroyed: boolean = false

Inherited from

ComponentBase.isDestroyed

Defined in

src/components/ComponentBase.ts:37


fov

fov: number = 60

camera Perspective

Defined in

src/core/Camera3D.ts:28


name

name: string

camera use name

Defined in

src/core/Camera3D.ts:33


aspect

aspect: number = 1

Viewport width and height Scale

Defined in

src/core/Camera3D.ts:38


near

near: number = 1

camera near plane

Defined in

src/core/Camera3D.ts:43


far

far: number = 5000

camera far plane

Defined in

src/core/Camera3D.ts:48


left

left: number = -100

orth camera right plane

Defined in

src/core/Camera3D.ts:53


right: number = 100

orth camera left plane

Defined in

src/core/Camera3D.ts:58


top

top: number = 100

orth camera top plane

Defined in

src/core/Camera3D.ts:63


bottom

bottom: number = -100

orth camera bottom plane

Defined in

src/core/Camera3D.ts:68


frustumSize

frustumSize: number = 0

orth view size

Defined in

src/core/Camera3D.ts:73


frustumDepth

frustumDepth: number = 0

Defined in

src/core/Camera3D.ts:74


viewPort

viewPort: Rect

camera view port size

Defined in

src/core/Camera3D.ts:79


frustum

frustum: Frustum

camera frustum

Defined in

src/core/Camera3D.ts:84


sh

sh: Float32Array

Defined in

src/core/Camera3D.ts:98


isShadowCamera

isShadowCamera: boolean = false

this camera is shadow camera

Defined in

src/core/Camera3D.ts:103


mainCamera

mainCamera: Camera3D

Defined in

src/core/Camera3D.ts:119


lookTarget

lookTarget: Vector3

camera look at from where point

Defined in

src/core/Camera3D.ts:132


type

type: CameraType = CameraType.perspective

camera type

Defined in

src/core/Camera3D.ts:137


csm

csm: FrustumCSM

Defined in

src/core/Camera3D.ts:139

Accessors

eventDispatcher

get eventDispatcher(): CEventDispatcher

Returns

CEventDispatcher

Inherited from

ComponentBase.eventDispatcher

Defined in

src/components/ComponentBase.ts:23

set eventDispatcher(value): void

Parameters

NameType
valueCEventDispatcher

Returns

void

Inherited from

ComponentBase.eventDispatcher

Defined in

src/components/ComponentBase.ts:28


isStart

get isStart(): boolean

Returns

boolean

Inherited from

ComponentBase.isStart

Defined in

src/components/ComponentBase.ts:39


transform

get transform(): Transform

Return the Transform component attached to the Object3D.

Returns

Transform

Inherited from

ComponentBase.transform

Defined in

src/components/ComponentBase.ts:46


enable

get enable(): boolean

Enable/disable components. The enabled components can be updated, while the disabled components cannot be updated.

Returns

boolean

Inherited from

ComponentBase.enable

Defined in

src/components/ComponentBase.ts:67

set enable(value): void

Enable/disable components. The enabled components can be updated, while the disabled components cannot be updated.

Parameters

NameType
valueboolean

Returns

void

Inherited from

ComponentBase.enable

Defined in

src/components/ComponentBase.ts:53


enableCSM

get enableCSM(): boolean

Returns

boolean

Defined in

src/core/Camera3D.ts:146

set enableCSM(value): void

Parameters

NameType
valueboolean

Returns

void

Defined in

src/core/Camera3D.ts:149


viewMatrix

get viewMatrix(): Matrix4

view invert matrix

Returns

Matrix4

Defined in

src/core/Camera3D.ts:317


shadowViewMatrix

get shadowViewMatrix(): Matrix4

shadow camera view invert matrix

Returns

Matrix4

Defined in

src/core/Camera3D.ts:327


pvMatrix

get pvMatrix(): Matrix4

get project * view matrix

Returns

Matrix4

Defined in

src/core/Camera3D.ts:378


pvMatrix2

get pvMatrix2(): Matrix4

Returns

Matrix4

Defined in

src/core/Camera3D.ts:383


pvMatrixInv

get pvMatrixInv(): Matrix4

get (project * view) invert matrix

Returns

Matrix4

Defined in

src/core/Camera3D.ts:393


vMatrixInv

get vMatrixInv(): Matrix4

Returns

Matrix4

Defined in

src/core/Camera3D.ts:399


cameraToWorld

get cameraToWorld(): Matrix4

Returns

Matrix4

Defined in

src/core/Camera3D.ts:405


ndcToView

get ndcToView(): Matrix4

Returns

Matrix4

Defined in

src/core/Camera3D.ts:413


projectionMatrixInv

get projectionMatrixInv(): Matrix4

get project invert matrix

Returns

Matrix4

Defined in

src/core/Camera3D.ts:423


jitterFrameIndex

get jitterFrameIndex(): number

Returns

number

Defined in

src/core/Camera3D.ts:549


jitterX

get jitterX(): number

Returns

number

Defined in

src/core/Camera3D.ts:553


jitterY

get jitterY(): number

Returns

number

Defined in

src/core/Camera3D.ts:557

Methods

start

start(): void

Returns

void

Inherited from

ComponentBase.start

Defined in

src/components/ComponentBase.ts:112


stop

stop(): void

Returns

void

Inherited from

ComponentBase.stop

Defined in

src/components/ComponentBase.ts:113


onEnable

onEnable(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onEnable

Defined in

src/components/ComponentBase.ts:114


onDisable

onDisable(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onDisable

Defined in

src/components/ComponentBase.ts:115


onLateUpdate

onLateUpdate(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onLateUpdate

Defined in

src/components/ComponentBase.ts:117


onBeforeUpdate

onBeforeUpdate(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onBeforeUpdate

Defined in

src/components/ComponentBase.ts:118


onCompute

onCompute(view?, command?): any

Parameters

NameType
view?View3D
command?GPUCommandEncoder

Returns

any

Inherited from

ComponentBase.onCompute

Defined in

src/components/ComponentBase.ts:119


onGraphic

onGraphic(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onGraphic

Defined in

src/components/ComponentBase.ts:120


onParentChange

onParentChange(lastParent?, currentParent?): any

Parameters

NameType
lastParent?Object3D
currentParent?Object3D

Returns

any

Inherited from

ComponentBase.onParentChange

Defined in

src/components/ComponentBase.ts:121


onAddChild

onAddChild(child): any

Parameters

NameType
childObject3D

Returns

any

Inherited from

ComponentBase.onAddChild

Defined in

src/components/ComponentBase.ts:122


onRemoveChild

onRemoveChild(child): any

Parameters

NameType
childObject3D

Returns

any

Inherited from

ComponentBase.onRemoveChild

Defined in

src/components/ComponentBase.ts:123


cloneTo

cloneTo(obj): void

clone component data to target object3D

Parameters

NameTypeDescription
objObject3Dtarget object3D

Returns

void

Inherited from

ComponentBase.cloneTo

Defined in

src/components/ComponentBase.ts:130


copyComponent

copyComponent(from): this

Parameters

NameType
fromthis

Returns

this

Inherited from

ComponentBase.copyComponent

Defined in

src/components/ComponentBase.ts:132


beforeDestroy

beforeDestroy(force?): void

before release this component, object refrences are not be set null now.

Parameters

NameType
force?boolean

Returns

void

Inherited from

ComponentBase.beforeDestroy

Defined in

src/components/ComponentBase.ts:199


destroy

destroy(force?): void

release this component

Parameters

NameType
force?boolean

Returns

void

Inherited from

ComponentBase.destroy

Defined in

src/components/ComponentBase.ts:206


init

init(): void

Returns

void

Overrides

ComponentBase.init

Defined in

src/core/Camera3D.ts:159


updateProjection

updateProjection(): void

Returns

void

Defined in

src/core/Camera3D.ts:175


getShadowBias

getShadowBias(depthTexSize): number

Parameters

NameType
depthTexSizenumber

Returns

number

Defined in

src/core/Camera3D.ts:189


getShadowWorldExtents

getShadowWorldExtents(): number

Returns

number

Defined in

src/core/Camera3D.ts:195


getCSMShadowBiasScale

getCSMShadowBiasScale(shadowCamera): number

Parameters

NameType
shadowCameraCamera3D

Returns

number

Defined in

src/core/Camera3D.ts:211


getCSMShadowWorldExtents

getCSMShadowWorldExtents(index): number

Parameters

NameType
indexnumber

Returns

number

Defined in

src/core/Camera3D.ts:221


perspective

perspective(fov, aspect, near, far): void

Create a perspective camera

Parameters

NameType
fovnumber
aspectnumber
nearnumber
farnumber

Returns

void

Defined in

src/core/Camera3D.ts:232


ortho

ortho(frustumSize, frustumDepth): void

set an orthographic camera with a frustumSize(viewHeight) and frustumSizeDepth

Parameters

NameTypeDescription
frustumSizenumberthe frustum view height
frustumDepthnumber-

Returns

void

Defined in

src/core/Camera3D.ts:252


ortho2

ortho2(frustumSize, near, far): void

set an orthographic camera with a frustumSize(viewHeight) and specific near & far

Parameters

NameTypeDescription
frustumSizenumberthe frustum view height
nearnumbercamera near plane
farnumbercamera far plane

Returns

void

Defined in

src/core/Camera3D.ts:275


orthoOffCenter

orthoOffCenter(left, right, bottom, top, near, far): void

set an orthographic camera with specified frustum space

Parameters

NameTypeDescription
leftnumbercamera left plane
rightnumbercamera right plane
bottomnumbercamera bottom plane
topnumbercamera top plane
nearnumbercamera near plane
farnumbercamera far plane

Returns

void

Defined in

src/core/Camera3D.ts:296


object3DToScreenRay

object3DToScreenRay(n, target?): Vector3

world space object to screen

Parameters

NameTypeDefault valueDescription
nVector3undefinedworld space
targetVector3nullCreating an orthogonal camera with 2D screen coordinates that default to null will return a new object

Returns

Vector3

Defined in

src/core/Camera3D.ts:339


screenRayToObject3D

screenRayToObject3D(n, target?): Vector3

Convert 2D screen coordinates to 3D coordinates as world space

Parameters

NameTypeDefault valueDescription
nVector3undefined2D screen coordinates
targetVector3null3D coordinates as world space

Returns

Vector3

Defined in

src/core/Camera3D.ts:359


unProject

unProject(nX, nY, sZ, target?): Vector3

Enter a 3D coordinate point to obtain the projected coordinate point

Parameters

NameTypeDescription
nXnumber3D x
nYnumber3D y
sZnumber3D z
target?Vector3The projected coordinate point can be empty

Returns

Vector3

Coordinates after projection

Defined in

src/core/Camera3D.ts:437


screenPointToRay

screenPointToRay(viewPortPosX, viewPortPosY): Ray

Enter the 2D coordinates of the screen to obtain a ray that starts from the camera position and passes through the corresponding 3D position of the screen.

Parameters

NameTypeDescription
viewPortPosXnumberScreen x coordinate
viewPortPosYnumberScreen y coordinate

Returns

Ray

ray

Defined in

src/core/Camera3D.ts:476


screenPointToWorld

screenPointToWorld(viewPortPosX, viewPortPosY, z): Vector3

Convert screen coordinates to world coordinates

Parameters

NameTypeDescription
viewPortPosXnumberScreen x coordinate
viewPortPosYnumberScreen y coordinate
znumberScreen z coordinate

Returns

Vector3

World coordinates

Defined in

src/core/Camera3D.ts:497


worldToScreenPoint

worldToScreenPoint(point, target?): Vector3

Convert world coordinates to screen coordinates

Parameters

NameType
pointVector3
target?Vector3

Returns

Vector3

World coordinates

Defined in

src/core/Camera3D.ts:509


lookAt

lookAt(pos, target, up?): void

Current object's gaze position (global) (modified by its own global transformation)

Parameters

NameTypeDefault valueDescription
posVector3undefinedOwn position (global)
targetVector3undefinedLocation of the target (global)
upVector3Vector3.Y_AXISUpward direction

Returns

void

Defined in

src/core/Camera3D.ts:520


enableJitterProjection

enableJitterProjection(value): void

Parameters

NameType
valueboolean

Returns

void

Defined in

src/core/Camera3D.ts:561


getWorldDirection

getWorldDirection(target?): Vector3

Parameters

NameType
target?Vector3

Returns

Vector3

Defined in

src/core/Camera3D.ts:668

Released under the MIT License