Constructor
new Camera(optionsopt)
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | Object | <optional> | Camera options: Properties
|
- Source
- event:viewchange
- event:moveend
Members
depthZeroToOne
Returns active depth range mode.
- Source
focusDistance
Returns focus distance used for orthographic projection size.
- Source
focusDistance
Sets focus distance used for orthographic projection size.
- Source
frustum
Returns current active frustum.
- Source
height
Returns viewport height.
- Source
horizontalViewAngle
Returns camera horizontal view angle in degrees.
- Source
id
Returns camera identifier.
- Source
isOrthographic
Returns current projection mode.
- Source
isOrthographic
Enables or disables orthographic projection mode.
- Source
reverseDepth
Returns reverse depth flag.
- Source
reverseDepthActive
Returns active reverse depth state.
- Source
verticalViewAngle
Returns camera vertical view angle in degrees.
- Source
viewAngle
Returns camera vertical view angle in degrees.
- Source
width
Returns viewport width.
- Source
Methods
_init(optionsopt)
Camera initialization.
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | Object | <optional> | Camera options: Properties
|
- Source
_setProj(viewAngle, aspect)
Sets camera projection.
| Name | Type | Description |
|---|---|---|
viewAngle | number | Camera view angle. |
aspect | number | Screen aspect ratio. |
- Source
bindFrustumsPickingColors(renderer)
Binds picking colors for all frustums.
| Name | Type | Description |
|---|---|---|
renderer | Renderer | Renderer instance. |
- Source
checkFly()
Prepare camera to the frame. Used in render node frame function.
- Source
checkMoveEnd()
Checks whether the camera stopped moving and dispatches moveend.
- Source
containsSphere(sphere) → {boolean}
Checks whether sphere intersects any camera frustum.
| Name | Type | Description |
|---|---|---|
sphere | Sphere | Bounding sphere. |
- Source
true when visible in at least one frustum.
- Type:
- boolean
copy(cam)
Copies camera pose and projection settings from another camera.
| Name | Type | Description |
|---|---|---|
cam | Camera | Source camera. |
- Source
flyCartesian(cartesianopt, paramsopt)
Flies to the cartesian coordinates.
| Name | Type | Attributes | Description |
|---|---|---|---|
cartesian | Vec3 | <optional> | Finish cartesian coordinates. |
params | IFlyCartesianParams | <optional> | Flight parameters |
- Source
getAbsolutePitch() → {number}
Returns absolute pitch angle.
- Source
Absolute pitch angle in radians.
- Type:
- number
getAbsoluteRoll() → {number}
Returns absolute roll angle.
- Source
Absolute roll angle in radians.
- Type:
- number
getAbsoluteYaw() → {number}
Returns absolute yaw angle.
- Source
Absolute yaw angle in radians.
- Type:
- number
getAltitude() → {number}
Returns camera altitude value for base camera.
- Source
Camera y coordinate.
- Type:
- number
getAspectRatio() → {number}
Returns aspect ratio.
- Source
Aspect ratio.
- Type:
- number
getBackward() → {Vec3}
Returns backward direction vector.
- Source
Backward direction.
- Type:
- Vec3
getCurrentFrustum() → {number}
Returns current active frustum index.
- Source
Current frustum index.
- Type:
- number
getDown() → {Vec3}
Returns down direction vector.
- Source
Down direction.
- Type:
- Vec3
getForward() → {Vec3}
Returns forward direction vector.
- Source
Forward direction.
- Type:
- Vec3
getInverseProjectionMatrix() → {NumberArray16}
Returns inverse projection matrix.
- Source
Inverse projection matrix.
- Type:
- NumberArray16
getInverseProjectionViewMatrix() → {NumberArray16}
Returns inverse projection-view matrix.
- Source
Inverse projection-view matrix.
- Type:
- NumberArray16
getLeft() → {Vec3}
Returns left direction vector.
- Source
Left direction.
- Type:
- Vec3
getNormalMatrix() → {NumberArray9}
Returns normal matrix.
- Source
- Normal matrix.
- Type:
- NumberArray9
getPitch() → {number}
Returns pitch angle.
- Source
Pitch angle in radians.
- Type:
- number
getProjectionMatrix() → {NumberArray16}
Returns projection matrix.
- Source
Projection matrix.
- Type:
- NumberArray16
getProjectionViewMatrix() → {NumberArray16}
Returns projection-view matrix.
- Source
Projection-view matrix.
- Type:
- NumberArray16
getProjectionViewRTEMatrix() → {NumberArray16}
Returns projection-view RTE matrix.
- Source
Projection-view RTE matrix.
- Type:
- NumberArray16
getRight() → {Vec3}
Returns right direction vector.
- Source
Right direction.
- Type:
- Vec3
getRoll() → {number}
Returns roll angle.
- Source
Roll angle in radians.
- Type:
- number
getRotation() → {Quat}
Returns camera rotation quaternion.
- Source
Camera rotation quaternion.
- Type:
- Quat
getUp() → {Vec3}
Returns up direction vector.
- Source
Up direction.
- Type:
- Vec3
getViewAngle() → {number}
Returns camera vertical view angle in degrees.
- Source
View angle in degrees.
- Type:
- number
getViewMatrix() → {NumberArray16}
Returns model matrix.
- Source
- View matrix.
- Type:
- NumberArray16
getYaw() → {number}
Returns yaw angle.
- Source
Yaw angle in radians.
- Type:
- number
isFlying() → {boolean}
Returns camera is flying.
- Source
- Type:
- boolean
look(look, upopt)
Sets camera look point
| Name | Type | Attributes | Description |
|---|---|---|---|
look | Vec3 | Look point | |
up | Vec3 | <optional> | Camera up vector otherwise camera current up vector(this._u) |
- Source
project(x, y, z) → {Vec2}
Gets projected 3d point to the 2d screen coordinates
| Name | Type | Description |
|---|---|---|
x | number | X coordinate |
y | number | Y coordinate |
z | number | Z coordinate |
- Source
- Screen point coordinates
- Type:
- Vec2
project3v(v) → {Vec2}
Gets projected 3d point to the 2d screen coordinates
| Name | Type | Description |
|---|---|---|
v | Vec3 | Cartesian 3d coordinates |
- Source
- Screen point coordinates
- Type:
- Vec2
projectedSize(p, r) → {number}
Gets 3d size factor. Uses in LOD distance calculation. It is very important function used in Node.ts
- Source
- Size factor.
- Type:
- number
refresh()
Refresh camera matrices
- Source
rotate(rot)
Rotates current camera basis by quaternion.
| Name | Type | Description |
|---|---|---|
rot | Quat | Rotation quaternion. |
- Source
rotateAround(angle, isArcopt, centeropt, upopt)
Rotates camera around center point
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
angle | number | Rotation angle in radians | ||
isArc | boolean | <optional> | false | If true camera up vector gets from current up vector every frame, otherwise up is always input parameter. |
center | Vec3 | <optional> | Point that the camera rotates around | |
up | Vec3 | <optional> | Camera up vector |
- Source
rotateHorizontal(angle, isArcopt, centeropt, upopt)
Rotates camera around center point by horizontal.
| Name | Type | Attributes | Description |
|---|---|---|---|
angle | number | Rotation angle in radians. | |
isArc | boolean | <optional> | If true camera up vector gets from current up vector every frame, otherwise up is always input parameter. |
center | Vec3 | <optional> | Point that the camera rotates around. |
up | Vec3 | <optional> | Camera up vector. |
- Source
rotateVertical(angle, centeropt)
Rotates camera around center point by vertical.
| Name | Type | Attributes | Description |
|---|---|---|---|
angle | number | Rotation angle in radians. | |
center | Vec3 | <optional> | Point that the camera rotates around. |
- Source
set(eye, look, up) → {Camera}
Sets camera to eye position
- Source
- This camera
- Type:
- Camera
setCurrentFrustum(k)
Sets current active frustum index.
| Name | Type | Description |
|---|---|---|
k | number | Frustum index. |
- Source
setDepthZeroToOne(enabled)
Enables or disables ZERO_TO_ONE depth range mode.
| Name | Type | Description |
|---|---|---|
enabled | boolean | Depth range mode flag. |
- Source
setFrustums(frustums)
Replaces camera frustum ranges.
| Name | Type | Description |
|---|---|---|
frustums | Array.<NumberArray2> | Array of |
- Source
setNearFar(near, faropt, frustumIndexopt)
Updates near/far planes for one frustum.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
near | number | Near clipping plane distance. | ||
far | number | <optional> | Far clipping plane distance. | |
frustumIndex | number | <optional> | 0 | Frustum index. |
- Source
setPitch(angle)
Pitch the camera to the angle in radians
| Name | Type | Description |
|---|---|---|
angle | number | Delta pitch angle in radians |
- Source
setPitchYawRoll(pitch, yaw, roll)
Sets camera orientation from Euler angles.
| Name | Type | Description |
|---|---|---|
pitch | number | Pitch angle in radians. |
yaw | number | Yaw angle in radians. |
roll | number | Roll angle in radians. |
- Source
setRoll(angle)
Roll the camera to the angle in radians
| Name | Type | Description |
|---|---|---|
angle | number | Delta roll angle in radians |
- Source
setRotation(rot, upopt, rightopt, backopt)
Sets camera orientation from a quaternion.
| Name | Type | Attributes | Description |
|---|---|---|---|
rot | Quat | Rotation quaternion. | |
up | Vec3 | <optional> | Base up vector. |
right | Vec3 | <optional> | Base right vector. |
back | Vec3 | <optional> | Base backward vector. |
- Source
setViewAngle(angle)
Sets camera view angle in degrees
| Name | Type | Description |
|---|---|---|
angle | number | View angle |
- Source
setViewportSize(width, height)
Sets viewport size and updates projection.
| Name | Type | Description |
|---|---|---|
width | number | Viewport width in pixels. |
height | number | Viewport height in pixels. |
- Source
setYaw(angle)
Yaw the camera to the angle in radians
| Name | Type | Description |
|---|---|---|
angle | number | Delta yaw angle in radians |
- Source
slide(du, dv, dn)
Slides camera to vector d - (du, dv, dn)
| Name | Type | Description |
|---|---|---|
du | number | delta X |
dv | number | delta Y |
dn | number | delta Z |
- Source
stopFlying()
Breaks the flight.
- Source
unproject(x, y, distopt, outPosopt) → {Vec3}
Returns normal vector direction to the unprojected screen point from camera eye
| Name | Type | Attributes | Description |
|---|---|---|---|
x | number | Screen X coordinate in pixels. | |
y | number | Screen Y coordinate in pixels. | |
dist | number | <optional> | Optional projection distance for orthographic mode. |
outPos | Vec3 | <optional> | Optional output world position for orthographic mode. |
- Source
- Direction vector.
- Type:
- Vec3
unproject2v(pos, distopt, outPosopt) → {Vec3}
Returns normal vector direction to the unprojected screen point from camera eye
| Name | Type | Attributes | Description |
|---|---|---|---|
pos | Vec2 | Screen coordinates in pixels. | |
dist | number | <optional> | Optional projection distance for orthographic mode. |
outPos | Vec3 | <optional> | Optional output world position for orthographic mode. |
- Source
- Direction vector.
- Type:
- Vec3
(abstract) update()
Updates camera view space
- Source
viewDistance(cartesian, distanceopt)
Places camera at a fixed distance from a point and looks at it.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
cartesian | Vec3 | Target cartesian point. | ||
distance | number | <optional> | 10000.0 | Distance from the target. |
- Source