Class: Camera3D
Camera components
Hierarchy
↳
Camera3D
Constructors
Properties
- object3D
- isDestroyed
- fov
- name
- aspect
- near
- far
- viewPort
- frustum
- sh_bak
- 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
- getShadowBias
- getShadowWorldExtents
- getCSMShadowBiasScale
- getCSMShadowWorldExtents
- perspective
- resetPerspective
- ortho
- orthoOffCenter
- orthoZo
- 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
• Optional
isDestroyed: boolean
Inherited from
Defined in
src/components/ComponentBase.ts:38
fov
• fov: number
= 1
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
viewPort
• viewPort: Rect
camera view port size
Defined in
frustum
• frustum: Frustum
camera frustum
Defined in
sh_bak
• sh_bak: Float32Array
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:40
transform
• get
transform(): Transform
Return the Transform component attached to the Object3D.
Returns
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
Name | Type |
---|---|
value | boolean |
Returns
void
Inherited from
ComponentBase.enable
Defined in
src/components/ComponentBase.ts:54
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:113
stop
▸ stop(): void
Returns
void
Inherited from
Defined in
src/components/ComponentBase.ts:114
onEnable
▸ onEnable(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:115
onDisable
▸ onDisable(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:116
onLateUpdate
▸ onLateUpdate(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:118
onBeforeUpdate
▸ onBeforeUpdate(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:119
onCompute
▸ onCompute(view?
, command?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
command? | GPUCommandEncoder |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:120
onGraphic
▸ onGraphic(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:121
onParentChange
▸ onParentChange(lastParent?
, currentParent?
): any
Parameters
Name | Type |
---|---|
lastParent? | Object3D |
currentParent? | Object3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:122
onAddChild
▸ onAddChild(child
): any
Parameters
Name | Type |
---|---|
child | Object3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:123
onRemoveChild
▸ onRemoveChild(child
): any
Parameters
Name | Type |
---|---|
child | Object3D |
Returns
any
Inherited from
Defined in
src/components/ComponentBase.ts:124
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:131
copyComponent
▸ copyComponent(from
): this
Parameters
Name | Type |
---|---|
from | this |
Returns
this
Inherited from
Defined in
src/components/ComponentBase.ts:133
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:200
destroy
▸ destroy(force?
): void
release this component
Parameters
Name | Type |
---|---|
force? | boolean |
Returns
void
Inherited from
Defined in
src/components/ComponentBase.ts:207
init
▸ init(): void
Returns
void
Overrides
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
resetPerspective
▸ resetPerspective(aspect
): void
Parameters
Name | Type |
---|---|
aspect | number |
Returns
void
Defined in
ortho
▸ ortho(width
, height
, znear
, zfar
): void
Create an orthographic camera
Parameters
Name | Type | Description |
---|---|---|
width | number | screen width |
height | number | screen height |
znear | number | camera near plane |
zfar | number | camera far plane |
Returns
void
Defined in
orthoOffCenter
▸ orthoOffCenter(l
, r
, b
, t
, zn
, zf
): void
Create an orthographic camera
Parameters
Name | Type | Description |
---|---|---|
l | number | |
r | number | |
b | number | |
t | number | |
zn | number | camera near plane |
zf | number | camera far plane |
Returns
void
Defined in
orthoZo
▸ orthoZo(l
, r
, b
, t
, zn
, zf
): void
Parameters
Name | Type |
---|---|
l | number |
r | number |
b | number |
t | number |
zn | number |
zf | number |
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 |