Class: Camera3D
Camera components
Hierarchy
↳
Camera3D
Table of contents
Constructors
Properties
- object3D
- isDestroyed
- fov
- name
- aspect
- near
- far
- left
- right
- top
- bottom
- frustumSize
- frustumDepth
- viewPort
- frustum
- sh
- isShadowCamera
- mainCamera
- lookTarget
- type
- csm
Accessors
- eventDispatcher
- isStart
- transform
- enable
- enableCSM
- viewMatrix
- shadowViewMatrix
- pvMatrix
- pvMatrix2
- pvMatrixInv
- vMatrixInv
- cameraToWorld
- ndcToView
- projectionMatrixInv
- jitterFrameIndex
- jitterX
- jitterY
Methods
- start
- stop
- onEnable
- onDisable
- onLateUpdate
- onBeforeUpdate
- onCompute
- onGraphic
- onParentChange
- onAddChild
- onRemoveChild
- cloneTo
- copyComponent
- beforeDestroy
- destroy
- init
- updateProjection
- getShadowBias
- getShadowWorldExtents
- getCSMShadowBiasScale
- getCSMShadowWorldExtents
- perspective
- ortho
- ortho2
- orthoOffCenter
- object3DToScreenRay
- screenRayToObject3D
- unProject
- screenPointToRay
- screenPointToWorld
- worldToScreenPoint
- lookAt
- enableJitterProjection
- getWorldDirection
Constructors
constructor
• new Camera3D(): Camera3D
Returns
Overrides
Defined in
Properties
object3D
• object3D: Object3D
= null
owner object3D
Inherited from
Defined in
src/components/ComponentBase.ts:17
isDestroyed
• isDestroyed: boolean
= false
Inherited from
Defined in
src/components/ComponentBase.ts:37
fov
• fov: number
= 60
camera Perspective
Defined in
name
• name: string
camera use name
Defined in
aspect
• aspect: number
= 1
Viewport width and height Scale
Defined in
near
• near: number
= 1
camera near plane
Defined in
far
• far: number
= 5000
camera far plane
Defined in
left
• left: number
= -100
orth camera right plane
Defined in
right
• right: number
= 100
orth camera left plane
Defined in
top
• top: number
= 100
orth camera top plane
Defined in
bottom
• bottom: number
= -100
orth camera bottom plane
Defined in
frustumSize
• frustumSize: number
= 0
orth view size
Defined in
frustumDepth
• frustumDepth: number
= 0
Defined in
viewPort
• viewPort: Rect
camera view port size
Defined in
frustum
• frustum: Frustum
camera frustum
Defined in
sh
• sh: Float32Array
Defined in
isShadowCamera
• isShadowCamera: boolean
= false
this camera is shadow camera
Defined in
mainCamera
• mainCamera: Camera3D
Defined in
lookTarget
• lookTarget: Vector3
camera look at from where point
Defined in
type
• type: CameraType
= CameraType.perspective
camera type
Defined in
csm
• csm: FrustumCSM
Defined in
Accessors
eventDispatcher
• get
eventDispatcher(): CEventDispatcher
Returns
Inherited from
ComponentBase.eventDispatcher
Defined in
src/components/ComponentBase.ts:23
• set
eventDispatcher(value
): void
Parameters
Name | Type |
---|---|
value | CEventDispatcher |
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
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
Name | Type |
---|---|
value | boolean |
Returns
void
Inherited from
ComponentBase.enable
Defined in
src/components/ComponentBase.ts:53
enableCSM
• get
enableCSM(): boolean
Returns
boolean
Defined in
• set
enableCSM(value
): void
Parameters
Name | Type |
---|---|
value | boolean |
Returns
void
Defined in
viewMatrix
• get
viewMatrix(): Matrix4
view invert matrix
Returns
Defined in
shadowViewMatrix
• get
shadowViewMatrix(): Matrix4
shadow camera view invert matrix
Returns
Defined in
pvMatrix
• get
pvMatrix(): Matrix4
get project * view matrix
Returns
Defined in
pvMatrix2
• get
pvMatrix2(): Matrix4
Returns
Defined in
pvMatrixInv
• get
pvMatrixInv(): Matrix4
get (project * view) invert matrix
Returns
Defined in
vMatrixInv
• get
vMatrixInv(): Matrix4
Returns
Defined in
cameraToWorld
• get
cameraToWorld(): Matrix4
Returns
Defined in
ndcToView
• get
ndcToView(): Matrix4
Returns
Defined in
projectionMatrixInv
• get
projectionMatrixInv(): Matrix4
get project invert matrix
Returns
Defined in
jitterFrameIndex
• get
jitterFrameIndex(): number
Returns
number
Defined in
jitterX
• get
jitterX(): number
Returns
number
Defined in
jitterY
• get
jitterY(): number
Returns
number
Defined in
Methods
start
▸ start(): void
Returns
void
Inherited from
Defined in
src/components/ComponentBase.ts:112
stop
▸ stop(): void
Returns
void
Inherited from
Defined in
src/components/ComponentBase.ts:113
onEnable
▸ onEnable(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:114
onDisable
▸ onDisable(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:115
onLateUpdate
▸ onLateUpdate(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:117
onBeforeUpdate
▸ onBeforeUpdate(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:118
onCompute
▸ onCompute(view?
, command?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
command? | GPUCommandEncoder |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:119
onGraphic
▸ onGraphic(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:120
onParentChange
▸ onParentChange(lastParent?
, currentParent?
): any
Parameters
Name | Type |
---|---|
lastParent? | Object3D |
currentParent? | Object3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:121
onAddChild
▸ onAddChild(child
): any
Parameters
Name | Type |
---|---|
child | Object3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:122
onRemoveChild
▸ onRemoveChild(child
): any
Parameters
Name | Type |
---|---|
child | Object3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:123
cloneTo
▸ cloneTo(obj
): void
clone component data to target object3D
Parameters
Name | Type | Description |
---|---|---|
obj | Object3D | target object3D |
Returns
void
Inherited from
Defined in
src/components/ComponentBase.ts:130
copyComponent
▸ copyComponent(from
): this
Parameters
Name | Type |
---|---|
from | this |
Returns
this
Inherited from
Defined in
src/components/ComponentBase.ts:132
beforeDestroy
▸ beforeDestroy(force?
): void
before release this component, object refrences are not be set null now.
Parameters
Name | Type |
---|---|
force? | boolean |
Returns
void
Inherited from
Defined in
src/components/ComponentBase.ts:199
destroy
▸ destroy(force?
): void
release this component
Parameters
Name | Type |
---|---|
force? | boolean |
Returns
void
Inherited from
Defined in
src/components/ComponentBase.ts:206
init
▸ init(): void
Returns
void
Overrides
Defined in
updateProjection
▸ updateProjection(): void
Returns
void
Defined in
getShadowBias
▸ getShadowBias(depthTexSize
): number
Parameters
Name | Type |
---|---|
depthTexSize | number |
Returns
number
Defined in
getShadowWorldExtents
▸ getShadowWorldExtents(): number
Returns
number
Defined in
getCSMShadowBiasScale
▸ getCSMShadowBiasScale(shadowCamera
): number
Parameters
Name | Type |
---|---|
shadowCamera | Camera3D |
Returns
number
Defined in
getCSMShadowWorldExtents
▸ getCSMShadowWorldExtents(index
): number
Parameters
Name | Type |
---|---|
index | number |
Returns
number
Defined in
perspective
▸ perspective(fov
, aspect
, near
, far
): void
Create a perspective camera
Parameters
Name | Type |
---|---|
fov | number |
aspect | number |
near | number |
far | number |
Returns
void
Defined in
ortho
▸ ortho(frustumSize
, frustumDepth
): void
set an orthographic camera with a frustumSize(viewHeight) and frustumSizeDepth
Parameters
Name | Type | Description |
---|---|---|
frustumSize | number | the frustum view height |
frustumDepth | number | - |
Returns
void
Defined in
ortho2
▸ ortho2(frustumSize
, near
, far
): void
set an orthographic camera with a frustumSize(viewHeight) and specific near & far
Parameters
Name | Type | Description |
---|---|---|
frustumSize | number | the frustum view height |
near | number | camera near plane |
far | number | camera far plane |
Returns
void
Defined in
orthoOffCenter
▸ orthoOffCenter(left
, right
, bottom
, top
, near
, far
): void
set an orthographic camera with specified frustum space
Parameters
Name | Type | Description |
---|---|---|
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
Defined in
object3DToScreenRay
▸ object3DToScreenRay(n
, target?
): Vector3
world space object to screen
Parameters
Name | Type | Default value | Description |
---|---|---|---|
n | Vector3 | undefined | world space |
target | Vector3 | null | Creating an orthogonal camera with 2D screen coordinates that default to null will return a new object |
Returns
Defined in
screenRayToObject3D
▸ screenRayToObject3D(n
, target?
): Vector3
Convert 2D screen coordinates to 3D coordinates as world space
Parameters
Name | Type | Default value | Description |
---|---|---|---|
n | Vector3 | undefined | 2D screen coordinates |
target | Vector3 | null | 3D coordinates as world space |
Returns
Defined in
unProject
▸ unProject(nX
, nY
, sZ
, target?
): Vector3
Enter a 3D coordinate point to obtain the projected coordinate point
Parameters
Name | Type | Description |
---|---|---|
nX | number | 3D x |
nY | number | 3D y |
sZ | number | 3D z |
target? | Vector3 | The projected coordinate point can be empty |
Returns
Coordinates after projection
Defined in
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
Name | Type | Description |
---|---|---|
viewPortPosX | number | Screen x coordinate |
viewPortPosY | number | Screen y coordinate |
Returns
ray
Defined in
screenPointToWorld
▸ screenPointToWorld(viewPortPosX
, viewPortPosY
, z
): Vector3
Convert screen coordinates to world coordinates
Parameters
Name | Type | Description |
---|---|---|
viewPortPosX | number | Screen x coordinate |
viewPortPosY | number | Screen y coordinate |
z | number | Screen z coordinate |
Returns
World coordinates
Defined in
worldToScreenPoint
▸ worldToScreenPoint(point
, target?
): Vector3
Convert world coordinates to screen coordinates
Parameters
Name | Type |
---|---|
point | Vector3 |
target? | Vector3 |
Returns
World coordinates
Defined in
lookAt
▸ lookAt(pos
, target
, up?
): void
Current object's gaze position (global) (modified by its own global transformation)
Parameters
Name | Type | Default value | Description |
---|---|---|---|
pos | Vector3 | undefined | Own position (global) |
target | Vector3 | undefined | Location of the target (global) |
up | Vector3 | Vector3.Y_AXIS | Upward direction |
Returns
void
Defined in
enableJitterProjection
▸ enableJitterProjection(value
): void
Parameters
Name | Type |
---|---|
value | boolean |
Returns
void
Defined in
getWorldDirection
▸ getWorldDirection(target?
): Vector3
Parameters
Name | Type |
---|---|
target? | Vector3 |