Skip to content

Class: Camera3D

Camera components

Hierarchy

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Camera3D(): Camera3D

Returns

Camera3D

Overrides

ComponentBase.constructor

Defined in

src/core/Camera3D.ts:128

Properties

object3D

object3D: Object3D = null

owner object3D

Inherited from

ComponentBase.object3D

Defined in

src/components/ComponentBase.ts:17


isDestroyed

Optional isDestroyed: boolean

Inherited from

ComponentBase.isDestroyed

Defined in

src/components/ComponentBase.ts:38


fov

fov: number = 1

camera Perspective

Defined in

src/core/Camera3D.ts:27


name

name: string

camera use name

Defined in

src/core/Camera3D.ts:32


aspect

aspect: number = 1

Viewport width and height Scale

Defined in

src/core/Camera3D.ts:37


near

near: number = 1

camera near plane

Defined in

src/core/Camera3D.ts:42


far

far: number = 5000

camera far plane

Defined in

src/core/Camera3D.ts:47


viewPort

viewPort: Rect

camera view port size

Defined in

src/core/Camera3D.ts:52


frustum

frustum: Frustum

camera frustum

Defined in

src/core/Camera3D.ts:57


sh_bak

sh_bak: Float32Array

Defined in

src/core/Camera3D.ts:59


sh

sh: Float32Array

Defined in

src/core/Camera3D.ts:71


isShadowCamera

isShadowCamera: boolean = false

this camera is shadow camera

Defined in

src/core/Camera3D.ts:76


mainCamera

mainCamera: Camera3D

Defined in

src/core/Camera3D.ts:92


lookTarget

lookTarget: Vector3

camera look at from where point

Defined in

src/core/Camera3D.ts:105


type

type: CameraType = CameraType.perspective

camera type

Defined in

src/core/Camera3D.ts:110


csm

csm: FrustumCSM

Defined in

src/core/Camera3D.ts:112

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:40


transform

get transform(): Transform

Return the Transform component attached to the Object3D.

Returns

Transform

Inherited from

ComponentBase.transform

Defined in

src/components/ComponentBase.ts:47


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:68

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:54


enableCSM

get enableCSM(): boolean

Returns

boolean

Defined in

src/core/Camera3D.ts:119

set enableCSM(value): void

Parameters

NameType
valueboolean

Returns

void

Defined in

src/core/Camera3D.ts:122


viewMatrix

get viewMatrix(): Matrix4

view invert matrix

Returns

Matrix4

Defined in

src/core/Camera3D.ts:246


shadowViewMatrix

get shadowViewMatrix(): Matrix4

shadow camera view invert matrix

Returns

Matrix4

Defined in

src/core/Camera3D.ts:256


pvMatrix

get pvMatrix(): Matrix4

get project * view matrix

Returns

Matrix4

Defined in

src/core/Camera3D.ts:307


pvMatrix2

get pvMatrix2(): Matrix4

Returns

Matrix4

Defined in

src/core/Camera3D.ts:312


pvMatrixInv

get pvMatrixInv(): Matrix4

get (project * view) invert matrix

Returns

Matrix4

Defined in

src/core/Camera3D.ts:322


vMatrixInv

get vMatrixInv(): Matrix4

Returns

Matrix4

Defined in

src/core/Camera3D.ts:328


cameraToWorld

get cameraToWorld(): Matrix4

Returns

Matrix4

Defined in

src/core/Camera3D.ts:334


ndcToView

get ndcToView(): Matrix4

Returns

Matrix4

Defined in

src/core/Camera3D.ts:342


projectionMatrixInv

get projectionMatrixInv(): Matrix4

get project invert matrix

Returns

Matrix4

Defined in

src/core/Camera3D.ts:352


jitterFrameIndex

get jitterFrameIndex(): number

Returns

number

Defined in

src/core/Camera3D.ts:486


jitterX

get jitterX(): number

Returns

number

Defined in

src/core/Camera3D.ts:490


jitterY

get jitterY(): number

Returns

number

Defined in

src/core/Camera3D.ts:494

Methods

start

start(): void

Returns

void

Inherited from

ComponentBase.start

Defined in

src/components/ComponentBase.ts:113


stop

stop(): void

Returns

void

Inherited from

ComponentBase.stop

Defined in

src/components/ComponentBase.ts:114


onEnable

onEnable(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onEnable

Defined in

src/components/ComponentBase.ts:115


onDisable

onDisable(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onDisable

Defined in

src/components/ComponentBase.ts:116


onLateUpdate

onLateUpdate(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onLateUpdate

Defined in

src/components/ComponentBase.ts:118


onBeforeUpdate

onBeforeUpdate(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onBeforeUpdate

Defined in

src/components/ComponentBase.ts:119


onCompute

onCompute(view?, command?): any

Parameters

NameType
view?View3D
command?GPUCommandEncoder

Returns

any

Inherited from

ComponentBase.onCompute

Defined in

src/components/ComponentBase.ts:120


onGraphic

onGraphic(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onGraphic

Defined in

src/components/ComponentBase.ts:121


onParentChange

onParentChange(lastParent?, currentParent?): any

Parameters

NameType
lastParent?Object3D
currentParent?Object3D

Returns

any

Inherited from

ComponentBase.onParentChange

Defined in

src/components/ComponentBase.ts:122


onAddChild

onAddChild(child): any

Parameters

NameType
childObject3D

Returns

any

Inherited from

ComponentBase.onAddChild

Defined in

src/components/ComponentBase.ts:123


onRemoveChild

onRemoveChild(child): any

Parameters

NameType
childObject3D

Returns

any

Inherited from

ComponentBase.onRemoveChild

Defined in

src/components/ComponentBase.ts:124


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:131


copyComponent

copyComponent(from): this

Parameters

NameType
fromthis

Returns

this

Inherited from

ComponentBase.copyComponent

Defined in

src/components/ComponentBase.ts:133


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:200


destroy

destroy(force?): void

release this component

Parameters

NameType
force?boolean

Returns

void

Inherited from

ComponentBase.destroy

Defined in

src/components/ComponentBase.ts:207


init

init(): void

Returns

void

Overrides

ComponentBase.init

Defined in

src/core/Camera3D.ts:132


getShadowBias

getShadowBias(depthTexSize): number

Parameters

NameType
depthTexSizenumber

Returns

number

Defined in

src/core/Camera3D.ts:146


getShadowWorldExtents

getShadowWorldExtents(): number

Returns

number

Defined in

src/core/Camera3D.ts:152


getCSMShadowBiasScale

getCSMShadowBiasScale(shadowCamera): number

Parameters

NameType
shadowCameraCamera3D

Returns

number

Defined in

src/core/Camera3D.ts:168


getCSMShadowWorldExtents

getCSMShadowWorldExtents(index): number

Parameters

NameType
indexnumber

Returns

number

Defined in

src/core/Camera3D.ts:178


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:189


resetPerspective

resetPerspective(aspect): void

Parameters

NameType
aspectnumber

Returns

void

Defined in

src/core/Camera3D.ts:198


ortho

ortho(width, height, znear, zfar): void

Create an orthographic camera

Parameters

NameTypeDescription
widthnumberscreen width
heightnumberscreen height
znearnumbercamera near plane
zfarnumbercamera far plane

Returns

void

Defined in

src/core/Camera3D.ts:211


orthoOffCenter

orthoOffCenter(l, r, b, t, zn, zf): void

Create an orthographic camera

Parameters

NameTypeDescription
lnumber
rnumber
bnumber
tnumber
znnumbercamera near plane
zfnumbercamera far plane

Returns

void

Defined in

src/core/Camera3D.ts:228


orthoZo

orthoZo(l, r, b, t, zn, zf): void

Parameters

NameType
lnumber
rnumber
bnumber
tnumber
znnumber
zfnumber

Returns

void

Defined in

src/core/Camera3D.ts:235


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:268


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:288


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:366


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:405


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:426


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:438


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:449


enableJitterProjection

enableJitterProjection(value): void

Parameters

NameType
valueboolean

Returns

void

Defined in

src/core/Camera3D.ts:498


getWorldDirection

getWorldDirection(target?): Vector3

Parameters

NameType
target?Vector3

Returns

Vector3

Defined in

src/core/Camera3D.ts:603

Released under the MIT License