Skip to content

@orillusion/core


Class: Camera3D ​

Defined in: src/core/Camera3D.ts:21

Camera components

Extends ​

Constructors ​

Constructor ​

new Camera3D(): Camera3D

Defined in: src/core/Camera3D.ts:176

Returns ​

Camera3D

Overrides ​

ComponentBase.constructor

Properties ​

object3D ​

object3D: Object3D = null

Defined in: src/components/ComponentBase.ts:29

owner object3D

Inherited from ​

ComponentBase.object3D


isDestroyed ​

isDestroyed: boolean = false

Defined in: src/components/ComponentBase.ts:77

Inherited from ​

ComponentBase.isDestroyed


mainCamera ​

static mainCamera: Camera3D

Defined in: src/core/Camera3D.ts:26

The primary camera used for rendering the main view.


_boundCtx ​

_boundCtx: Context3D = null

Defined in: src/core/Camera3D.ts:32

The graphics context this camera is bound to. Used for multi-engine setups; null until the camera is bound to a Context3D.


fov ​

fov: number = 60

Defined in: src/core/Camera3D.ts:37

camera Perspective


name ​

name: string

Defined in: src/core/Camera3D.ts:42

camera use name


aspect ​

aspect: number = 1

Defined in: src/core/Camera3D.ts:47

Viewport width and height Scale


near ​

near: number = 1

Defined in: src/core/Camera3D.ts:52

camera near plane


far ​

far: number = 5000

Defined in: src/core/Camera3D.ts:57

camera far plane


left ​

left: number = -100

Defined in: src/core/Camera3D.ts:62

orth camera right plane


right: number = 100

Defined in: src/core/Camera3D.ts:67

orth camera left plane


top ​

top: number = 100

Defined in: src/core/Camera3D.ts:72

orth camera top plane


bottom ​

bottom: number = -100

Defined in: src/core/Camera3D.ts:77

orth camera bottom plane


frustumSize ​

frustumSize: number = 0

Defined in: src/core/Camera3D.ts:82

orth view size


frustumDepth ​

frustumDepth: number = 0

Defined in: src/core/Camera3D.ts:87

orth view depth range


viewPort ​

viewPort: Rect

Defined in: src/core/Camera3D.ts:92

camera view port size


frustum ​

frustum: Frustum

Defined in: src/core/Camera3D.ts:97

camera frustum


sh ​

sh: Float32Array

Defined in: src/core/Camera3D.ts:114

Spherical-harmonics coefficients of the ambient/diffuse environment lighting.


isShadowCamera ​

isShadowCamera: boolean = false

Defined in: src/core/Camera3D.ts:119

this camera is shadow camera


shadowLight? ​

optional shadowLight?: ILight

Defined in: src/core/Camera3D.ts:124

The light this camera renders the shadow map for, when it is a shadow camera.


cullingMask ​

cullingMask: number = VisibleLayer.All

Defined in: src/core/Camera3D.ts:142

Layer-mask of layers this camera should see. Combined at pass execute time with node.visibleLayer and the active pass's layerMask via bitwise AND:

(node.visibleLayer & pass.layerMask & camera.cullingMask) !== 0

Defaults to VisibleLayer.All so untouched cameras keep the historical "see everything" behaviour. Sub-cameras (minimaps, reflection probes, picking-only views) can clear specific bits to suppress unwanted layers.

Camera-side filtering is layered on top of pass-side filtering: a layer must clear both masks AND the node's own membership to be drawn.


lookTarget ​

lookTarget: Vector3

Defined in: src/core/Camera3D.ts:169

camera look at from where point


type ​

type: CameraType = CameraType.perspective

Defined in: src/core/Camera3D.ts:174

camera type

Accessors ​

visibleLayer ​

Get Signature ​

get visibleLayer(): number

Defined in: src/components/ComponentBase.ts:46

Composition-layer membership bitmask. The pass / camera / collector filters via

(component.visibleLayer & pass.layerMask & camera.cullingMask) !== 0

Defaults to VisibleLayer.Default (bit 0) so a fresh subclass is visible to passes whose layerMask is VisibleLayer.All (which includes bit 0). Application code can assign project-specific bits (1..31) to organise the scene into composition layers.

Returns ​

number

Set Signature ​

set visibleLayer(value): void

Defined in: src/components/ComponentBase.ts:50

Parameters ​
value ​

number

Returns ​

void

Inherited from ​

ComponentBase.visibleLayer


eventDispatcher ​

Get Signature ​

get eventDispatcher(): CEventDispatcher

Defined in: src/components/ComponentBase.ts:63

Returns ​

CEventDispatcher

Set Signature ​

set eventDispatcher(value): void

Defined in: src/components/ComponentBase.ts:68

Parameters ​
value ​

CEventDispatcher

Returns ​

void

Inherited from ​

ComponentBase.eventDispatcher


isStart ​

Get Signature ​

get isStart(): boolean

Defined in: src/components/ComponentBase.ts:79

Returns ​

boolean

Inherited from ​

ComponentBase.isStart


transform ​

Get Signature ​

get transform(): Transform

Defined in: src/components/ComponentBase.ts:89

Return the Transform component attached to the Object3D. Null before the component is attached — addComponent assigns object3D only after construction — so constructor-time callers can probe safely via this.transform?..

Returns ​

Transform

Inherited from ​

ComponentBase.transform


enable ​

Get Signature ​

get enable(): boolean

Defined in: src/components/ComponentBase.ts:113

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

Returns ​

boolean

Set Signature ​

set enable(value): void

Defined in: src/components/ComponentBase.ts:96

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

Parameters ​
value ​

boolean

Returns ​

void

Inherited from ​

ComponentBase.enable


viewMatrix ​

Get Signature ​

get viewMatrix(): Matrix4

Defined in: src/core/Camera3D.ts:335

view invert matrix

Returns ​

Matrix4


shadowViewMatrix ​

Get Signature ​

get shadowViewMatrix(): Matrix4

Defined in: src/core/Camera3D.ts:345

shadow camera view invert matrix

Returns ​

Matrix4


pvMatrix ​

Get Signature ​

get pvMatrix(): Matrix4

Defined in: src/core/Camera3D.ts:396

get project * view matrix

Returns ​

Matrix4


pvMatrix2 ​

Get Signature ​

get pvMatrix2(): Matrix4

Defined in: src/core/Camera3D.ts:404

get the inverse of (projection * world) matrix

Returns ​

Matrix4


pvMatrixInv ​

Get Signature ​

get pvMatrixInv(): Matrix4

Defined in: src/core/Camera3D.ts:414

get (project * view) invert matrix

Returns ​

Matrix4


vMatrixInv ​

Get Signature ​

get vMatrixInv(): Matrix4

Defined in: src/core/Camera3D.ts:423

get the inverse of the view matrix

Returns ​

Matrix4


cameraToWorld ​

Get Signature ​

get cameraToWorld(): Matrix4

Defined in: src/core/Camera3D.ts:432

get the matrix transforming camera/clip space back to world space

Returns ​

Matrix4


ndcToView ​

Get Signature ​

get ndcToView(): Matrix4

Defined in: src/core/Camera3D.ts:443

get the matrix transforming NDC space to view space (inverse projection)

Returns ​

Matrix4


projectionMatrixInv ​

Get Signature ​

get projectionMatrixInv(): Matrix4

Defined in: src/core/Camera3D.ts:453

get project invert matrix

Returns ​

Matrix4


jitterFrameIndex ​

Get Signature ​

get jitterFrameIndex(): number

Defined in: src/core/Camera3D.ts:581

get the current TAA jitter frame index

Returns ​

number


jitterX ​

Get Signature ​

get jitterX(): number

Defined in: src/core/Camera3D.ts:588

get the current frame's TAA jitter offset on the X axis (in NDC)

Returns ​

number


jitterY ​

Get Signature ​

get jitterY(): number

Defined in: src/core/Camera3D.ts:595

get the current frame's TAA jitter offset on the Y axis (in NDC)

Returns ​

number

Methods ​

start() ​

start(): void

Defined in: src/components/ComponentBase.ts:162

Returns ​

void

Inherited from ​

ComponentBase.start


stop() ​

stop(): void

Defined in: src/components/ComponentBase.ts:163

Returns ​

void

Inherited from ​

ComponentBase.stop


onEnable()? ​

optional onEnable(view?): any

Defined in: src/components/ComponentBase.ts:164

Parameters ​

view? ​

View3D

Returns ​

any

Inherited from ​

ComponentBase.onEnable


onDisable()? ​

optional onDisable(view?): any

Defined in: src/components/ComponentBase.ts:165

Parameters ​

view? ​

View3D

Returns ​

any

Inherited from ​

ComponentBase.onDisable


onLateUpdate()? ​

optional onLateUpdate(view?): any

Defined in: src/components/ComponentBase.ts:167

Parameters ​

view? ​

View3D

Returns ​

any

Inherited from ​

ComponentBase.onLateUpdate


onBeforeUpdate()? ​

optional onBeforeUpdate(view?): any

Defined in: src/components/ComponentBase.ts:168

Parameters ​

view? ​

View3D

Returns ​

any

Inherited from ​

ComponentBase.onBeforeUpdate


onCompute()? ​

optional onCompute(view?, command?): any

Defined in: src/components/ComponentBase.ts:169

Parameters ​

view? ​

View3D

command? ​

GPUCommandEncoder

Returns ​

any

Inherited from ​

ComponentBase.onCompute


onGraphic()? ​

optional onGraphic(view?): any

Defined in: src/components/ComponentBase.ts:170

Parameters ​

view? ​

View3D

Returns ​

any

Inherited from ​

ComponentBase.onGraphic


onParentChange()? ​

optional onParentChange(lastParent?, currentParent?): any

Defined in: src/components/ComponentBase.ts:171

Parameters ​

lastParent? ​

Object3D

currentParent? ​

Object3D

Returns ​

any

Inherited from ​

ComponentBase.onParentChange


onAddChild()? ​

optional onAddChild(child): any

Defined in: src/components/ComponentBase.ts:172

Parameters ​

child ​

Object3D

Returns ​

any

Inherited from ​

ComponentBase.onAddChild


onRemoveChild()? ​

optional onRemoveChild(child): any

Defined in: src/components/ComponentBase.ts:173

Parameters ​

child ​

Object3D

Returns ​

any

Inherited from ​

ComponentBase.onRemoveChild


cloneTo() ​

cloneTo(obj): void

Defined in: src/components/ComponentBase.ts:180

clone component data to target object3D

Parameters ​

obj ​

Object3D

target object3D

Returns ​

void

Inherited from ​

ComponentBase.cloneTo


copyComponent() ​

copyComponent(from): this

Defined in: src/components/ComponentBase.ts:182

Parameters ​

from ​

this

Returns ​

this

Inherited from ​

ComponentBase.copyComponent


beforeDestroy() ​

beforeDestroy(force?): void

Defined in: src/components/ComponentBase.ts:249

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

Parameters ​

force? ​

boolean

Returns ​

void

Inherited from ​

ComponentBase.beforeDestroy


init() ​

init(): void

Defined in: src/core/Camera3D.ts:180

Returns ​

void

Overrides ​

ComponentBase.init


updateProjection() ​

updateProjection(): void

Defined in: src/core/Camera3D.ts:210

Returns ​

void


getShadowBias() ​

getShadowBias(depthTexSize): number

Defined in: src/core/Camera3D.ts:236

Compute a legacy auto shadow-bias baseline for the given depth texture size.

Legacy auto baseline used by DDGI / GodRay compute paths. Real-time shadow now derives bias per-light via ShadowBiasCalculator.

Parameters ​

depthTexSize ​

number

the side length of the shadow depth texture

Returns ​

number

the computed shadow bias


getShadowWorldExtents() ​

getShadowWorldExtents(): number

Defined in: src/core/Camera3D.ts:246

Get the rounded world-space extent of the camera frustum, used to scale shadow bias.

Returns ​

number

the world-space extent value


perspective() ​

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

Defined in: src/core/Camera3D.ts:258

Create a perspective camera

Parameters ​

fov ​

number

aspect ​

number

near ​

number

far ​

number

Returns ​

void


ortho() ​

ortho(frustumSize, frustumDepth): void

Defined in: src/core/Camera3D.ts:274

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

Parameters ​

frustumSize ​

number

the frustum view height

frustumDepth ​

number

Returns ​

void


ortho2() ​

ortho2(frustumSize, near, far): void

Defined in: src/core/Camera3D.ts:297

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

Parameters ​

frustumSize ​

number

the frustum view height

near ​

number

camera near plane

far ​

number

camera far plane

Returns ​

void


orthoOffCenter() ​

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

Defined in: src/core/Camera3D.ts:318

set an orthographic camera with specified frustum space

Parameters ​

left ​

number

camera left plane

right ​

number

camera right plane

bottom ​

number

camera bottom plane

top ​

number

camera top plane

near ​

number

camera near plane

far ​

number

camera far plane

Returns ​

void


object3DToScreenRay() ​

object3DToScreenRay(n, target?): Vector3

Defined in: src/core/Camera3D.ts:357

world space object to screen

Parameters ​

n ​

Vector3

world space

target? ​

Vector3 = null

Creating an orthogonal camera with 2D screen coordinates that default to null will return a new object

Returns ​

Vector3


screenRayToObject3D() ​

screenRayToObject3D(n, target?): Vector3

Defined in: src/core/Camera3D.ts:377

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

Parameters ​

n ​

Vector3

2D screen coordinates

target? ​

Vector3 = null

3D coordinates as world space

Returns ​

Vector3


unProject() ​

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

Defined in: src/core/Camera3D.ts:467

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

Parameters ​

nX ​

number

3D x

nY ​

number

3D y

sZ ​

number

3D z

target? ​

Vector3

The projected coordinate point can be empty

Returns ​

Vector3

Coordinates after projection


screenPointToRay() ​

screenPointToRay(viewPortPosX, viewPortPosY): Ray

Defined in: src/core/Camera3D.ts:506

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 ​

viewPortPosX ​

number

Screen x coordinate

viewPortPosY ​

number

Screen y coordinate

Returns ​

Ray

ray


screenPointToWorld() ​

screenPointToWorld(viewPortPosX, viewPortPosY, z): Vector3

Defined in: src/core/Camera3D.ts:527

Convert screen coordinates to world coordinates

Parameters ​

viewPortPosX ​

number

Screen x coordinate

viewPortPosY ​

number

Screen y coordinate

z ​

number

Screen z coordinate

Returns ​

Vector3

World coordinates


worldToScreenPoint() ​

worldToScreenPoint(point, target?): Vector3

Defined in: src/core/Camera3D.ts:539

Convert world coordinates to screen coordinates

Parameters ​

point ​

Vector3

target? ​

Vector3

Returns ​

Vector3

World coordinates


lookAt() ​

lookAt(pos, target, up?): void

Defined in: src/core/Camera3D.ts:550

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

Parameters ​

pos ​

Vector3

Own position (global)

target ​

Vector3

Location of the target (global)

up? ​

Vector3 = Vector3.Y_AXIS

Upward direction

Returns ​

void


enableJitterProjection() ​

enableJitterProjection(value): void

Defined in: src/core/Camera3D.ts:603

Enable or disable TAA jitter on the projection matrix.

Parameters ​

value ​

boolean

whether jitter projection should be applied each frame

Returns ​

void


getWorldDirection() ​

getWorldDirection(target?): Vector3

Defined in: src/core/Camera3D.ts:683

Get the camera's forward direction in world space.

Parameters ​

target? ​

Vector3

optional vector to store the result

Returns ​

Vector3

the normalized world-space forward direction


destroy() ​

destroy(force?): void

Defined in: src/core/Camera3D.ts:694

Release the matrix slots held by this camera and destroy the component.

Parameters ​

force? ​

boolean

whether to force-destroy

Returns ​

void

Overrides ​

ComponentBase.destroy