Constructor
new PlanetCamera(planet, optionsopt)
| Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
planet | Planet | Planet render node. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options | IPlanetCameraParams | <optional> | Planet camera options: Properties
|
- Source
- event:viewchange
- event:moveend
- event:flystart
- event:flyend
- event:flystop
Extends
Members
depthZeroToOne
Returns active depth range mode.
- Overrides
- Source
focusDistance
Returns focus distance used for orthographic projection size.
- Overrides
- Source
frustum
Returns current active frustum.
- Overrides
- Source
height
Returns viewport height.
- Overrides
- Source
horizontalViewAngle
Returns camera horizontal view angle in degrees.
- Overrides
- Source
id
Returns camera identifier.
- Overrides
- Source
isOrthographic
Returns current projection mode.
- Overrides
- Source
reverseDepth
Returns reverse depth flag.
- Overrides
- Source
reverseDepthActive
Returns active reverse depth state.
- Overrides
- Source
verticalViewAngle
Returns camera vertical view angle in degrees.
- Overrides
- Source
viewAngle
Returns camera vertical view angle in degrees.
- Overrides
- Source
width
Returns viewport width.
- Overrides
- Source
Methods
_init(optionsopt)
Camera initialization.
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | Object | <optional> | Camera options: Properties
|
- Overrides
- Source
_setProj(viewAngle, aspect)
Sets camera projection.
| Name | Type | Description |
|---|---|---|
viewAngle | number | Camera view angle. |
aspect | number | Screen aspect ratio. |
- Overrides
- Source
bindFrustumsPickingColors(renderer)
Binds picking colors for all frustums.
| Name | Type | Description |
|---|---|---|
renderer | Renderer | Renderer instance. |
- Overrides
- Source
checkFly()
Prepare camera to the frame. Used in render node frame function.
- Overrides
- Source
checkMoveEnd()
Checks whether the camera stopped moving and dispatches moveend.
- Overrides
- Source
checkTerrainCollision() → {Vec3|undefined}
Updates terrain altitude and keeps camera above minimum altitude.
- Source
Terrain point under camera when available.
- Type:
- Vec3 |
undefined
containsPoint(point) → {boolean}
Checks whether a point is inside any camera frustum.
| Name | Type | Description |
|---|---|---|
point | Vec3 | Cartesian point. |
- Overrides
- Source
true when visible in at least one frustum.
- Type:
- boolean
containsSphere(sphere) → {boolean}
Checks whether the sphere intersects any camera frustum.
| Name | Type | Description |
|---|---|---|
sphere | Sphere | Bounding sphere. |
- Overrides
- 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. |
- Overrides
- Source
flyCartesian(cartesianopt, paramsopt)
Flies to the cartesian coordinates.
| Name | Type | Attributes | Description |
|---|---|---|---|
cartesian | Vec3 | <optional> | Finish cartesian coordinates. |
params | IFlyCartesianParams | <optional> | Flight parameters |
- Overrides
- Source
flyDistance(cartesian, distanceopt, paramsopt)
Flies camera to a position at a fixed distance from the target point.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
cartesian | Vec3 | Target cartesian point. | ||
distance | number | <optional> | 10000.0 | Distance from the target. |
params | IPlanetFlyCartesianParams | <optional> | Flight parameters. |
- Source
flyExtent(extent, heightopt, paramsopt)
Flies to the current extent.
| Name | Type | Attributes | Description |
|---|---|---|---|
extent | Extent | Current extent. | |
height | number | <optional> | Destination height. |
params | IPlanetFlyCartesianParams | <optional> | Flight parameters |
- Source
flyLonLat(lonlat, paramsopt)
Flies to the geo coordinates.
| Name | Type | Attributes | Description |
|---|---|---|---|
lonlat | LonLat | Finish coordinates. | |
params | IPlanetFlyCartesianParams | <optional> | Flight parameters |
- Source
getAbsolutePitch() → {number}
Returns absolute pitch angle.
- Overrides
- Source
Absolute pitch angle in radians.
- Type:
- number
getAbsoluteRoll() → {number}
Returns absolute roll angle.
- Overrides
- Source
Absolute roll angle in radians.
- Type:
- number
getAbsoluteYaw() → {number}
Returns absolute yaw angle.
- Overrides
- Source
Absolute yaw angle in radians.
- Type:
- number
getAltitude()
Gets altitude over the terrain.
- Overrides
- Source
getAspectRatio() → {number}
Returns aspect ratio.
- Overrides
- Source
Aspect ratio.
- Type:
- number
getBackward() → {Vec3}
Returns backward direction vector.
- Overrides
- Source
Backward direction.
- Type:
- Vec3
getCurrentFrustum() → {number}
Returns current active frustum index.
- Overrides
- Source
Current frustum index.
- Type:
- number
getDown() → {Vec3}
Returns down direction vector.
- Overrides
- Source
Down direction.
- Type:
- Vec3
getExtentPosition(extent, height) → {Vec3}
Gets position by viewable extent.
| Name | Type | Description |
|---|---|---|
extent | Extent | Viewable extent. |
height | Number | Camera height |
- Source
- Type:
- Vec3
getForward() → {Vec3}
Returns forward direction vector.
- Overrides
- Source
Forward direction.
- Type:
- Vec3
getHeading() → {number}
Returns heading angle in degrees. Should match getYaw() in most cases.
- Source
Heading in [0, 360) degrees.
- Type:
- number
getHeight() → {number}
Returns camera height.
- Source
- Type:
- number
getInverseProjectionMatrix() → {NumberArray16}
Returns inverse projection matrix.
- Overrides
- 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.
- Overrides
- Source
Left direction.
- Type:
- Vec3
getLonLat() → {LonLat}
Returns camera geographical position.
- Source
- Type:
- LonLat
getNormalMatrix() → {NumberArray9}
Returns camera normal matrix.
- Overrides
- Source
- Type:
- NumberArray9
getPitch() → {number}
Returns pitch angle in local planet frame.
- Overrides
- Source
Pitch angle in radians.
- Type:
- number
getProjectionMatrix() → {NumberArray16}
Returns projection matrix.
- Overrides
- Source
Projection matrix.
- Type:
- NumberArray16
getProjectionViewMatrix() → {NumberArray16}
Returns projection-view matrix.
- Overrides
- Source
Projection-view matrix.
- Type:
- NumberArray16
getProjectionViewRTEMatrix() → {NumberArray16}
Returns projection-view RTE matrix.
- Overrides
- Source
Projection-view RTE matrix.
- Type:
- NumberArray16
getRay(x, y) → {Ray}
Returns a world-space ray corresponding to the given screen point. For perspective camera the ray shares camera eye as origin. For orthographic camera the origin is offset across the view plane, and the direction equals the camera forward vector.
| Name | Type | Description |
|---|---|---|
x | number | Screen X coordinate in pixels. |
y | number | Screen Y coordinate in pixels. |
- Overrides
- Source
- Type:
- Ray
getRay2v(pos) → {Ray}
Returns a world-space ray corresponding to the given screen point.
| Name | Type | Description |
|---|---|---|
pos | Vec2 | Screen coordinates in pixels. |
- Overrides
- Source
- Type:
- Ray
getRight() → {Vec3}
Returns right direction vector.
- Overrides
- Source
Right direction.
- Type:
- Vec3
getRoll() → {number}
Returns roll angle in local planet frame.
- Overrides
- Source
Roll angle in radians.
- Type:
- number
getRotation() → {Quat}
Returns camera rotation quaternion.
- Overrides
- Source
Camera rotation quaternion.
- Type:
- Quat
getSurfaceVisibleDistance(d) → {number}
Returns visible surface arc distance from current altitude.
| Name | Type | Description |
|---|---|---|
d | number | Additional height offset. |
- Source
Visible surface distance.
- Type:
- number
getUp() → {Vec3}
Returns up direction vector.
- Overrides
- Source
Up direction.
- Type:
- Vec3
getViewAngle() → {number}
Returns camera vertical view angle in degrees.
- Overrides
- Source
View angle in degrees.
- Type:
- number
getViewMatrix() → {NumberArray16}
Returns model matrix.
- Overrides
- Source
- View matrix.
- Type:
- NumberArray16
getYaw() → {number}
Returns yaw angle in local planet frame. Should match getHeading() in most cases.
- Overrides
- Source
Yaw angle in radians.
- Type:
- number
isFlying() → {boolean}
Returns camera is flying.
- Overrides
- Source
- Type:
- boolean
isVisible(poi) → {boolean}
Checks whether a cartesian point is visible above the horizon.
| Name | Type | Description |
|---|---|---|
poi | Vec3 | Point in cartesian coordinates. |
- Source
true when the point is visible.
- 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) |
- Overrides
- 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 |
- Overrides
- 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 |
- Overrides
- Source
- Screen point coordinates
- Type:
- Vec2
projectedSize(p, r) → {number}
Gets 3d size factor. Uses in LOD distance calculation. It is a very important function used in Node.ts
- Overrides
- Source
- Size factor.
- Type:
- number
refresh()
Refresh camera matrices
- Overrides
- Source
rotate(rot)
Rotates current camera basis by quaternion.
| Name | Type | Description |
|---|---|---|
rot | Quat | Rotation quaternion. |
- Overrides
- 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 |
- Overrides
- Source
rotateDown(angle)
Rotates around planet to the South Pole.
| Name | Type | Description |
|---|---|---|
angle | number | Rotation angle. |
- Source
rotateHorizontal(angle, isArcopt, centeropt, upopt)
Rotates camera around the 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. |
- Overrides
- Source
rotateLeft(angle, spinopt)
Rotates around planet to the left.
| Name | Type | Attributes | Description |
|---|---|---|---|
angle | number | Rotation angle. | |
spin | boolean | <optional> | If its true rotates around globe spin. |
- Source
rotateRight(angle, spinopt)
Rotates around planet to the right.
| Name | Type | Attributes | Description |
|---|---|---|---|
angle | number | Rotation angle. | |
spin | boolean | <optional> | If its true rotates around globe spin. |
- Source
rotateUp(angle)
Rotates around planet to the North Pole.
| Name | Type | Description |
|---|---|---|
angle | number | Rotation angle. |
- Source
rotateVertical(angle, center, minSlopeopt)
Rotates camera vertically around the given center.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
angle | number | Rotation angle in radians. | ||
center | Vec3 | Rotation center. | ||
minSlope | number | <optional> | 0 | Minimum allowed slope limit. |
- Overrides
- Source
set(eye, look, up) → {Camera}
Sets camera to eye position
- Overrides
- Source
- This camera
- Type:
- Camera
setAltitude(alt)
Sets altitude over the terrain.
| Name | Type | Description |
|---|---|---|
alt | number | Altitude over the terrain. |
- Source
setCurrentFrustum(k)
Sets current active frustum index.
| Name | Type | Description |
|---|---|---|
k | number | Frustum index. |
- Overrides
- Source
setDepthZeroToOne(enabled)
Enables or disables ZERO_TO_ONE depth range mode.
| Name | Type | Description |
|---|---|---|
enabled | boolean | Depth range mode flag. |
- Overrides
- Source
setFrustums(frustums)
Replaces camera frustum ranges.
| Name | Type | Description |
|---|---|---|
frustums | Array.<NumberArray2> | Array of |
- Overrides
- Source
setHorizontalViewAngle(angle)
Sets camera horizontal view angle in degrees.
| Name | Type | Description |
|---|---|---|
angle | number | Horizontal view angle. |
- Overrides
- Source
setLonLat(lonlat, lookLonLatopt, upopt)
Places camera to view to the geographical point.
| Name | Type | Attributes | Description |
|---|---|---|---|
lonlat | LonLat | New camera and camera view position. | |
lookLonLat | LonLat | <optional> | Look up coordinates. |
up | Vec3 | <optional> | Camera UP vector. Default (0,1,0) |
- 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. |
- Overrides
- Source
setPitch(a)
Sets pitch angle in local planet frame.
| Name | Type | Description |
|---|---|---|
a | number | Pitch angle in radians. |
- Overrides
- Source
setPitchYawRoll(pitch, yaw, roll)
Sets orientation from pitch, yaw and roll in local planet frame.
| Name | Type | Description |
|---|---|---|
pitch | number | Pitch angle in radians. |
yaw | number | Yaw angle in radians. |
roll | number | Roll angle in radians. |
- Overrides
- Source
setRoll(a)
Sets roll angle in local planet frame.
| Name | Type | Description |
|---|---|---|
a | number | Roll angle in radians. |
- Overrides
- 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. |
- Overrides
- Source
setTerrainCollisionActivity(isActive)
Enables or disables terrain collision checks.
| Name | Type | Description |
|---|---|---|
isActive | boolean | Terrain collision flag. |
- Source
setViewAngle(angle)
Sets camera view angle in degrees
| Name | Type | Description |
|---|---|---|
angle | number | View angle |
- Overrides
- 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. |
- Overrides
- Source
setYaw(a)
Sets yaw angle in local planet frame.
| Name | Type | Description |
|---|---|---|
a | number | Yaw angle in radians. |
- Overrides
- 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 |
- Overrides
- Source
stopFlying()
Breaks the flight.
- Overrides
- 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. |
- Overrides
- 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. |
- Overrides
- Source
- Direction vector.
- Type:
- Vec3
(abstract) update()
Updates camera view space.
- Overrides
- Source
updateGeodeticPosition()
Updates camera geographic coordinates from current cartesian position.
- Source
viewDistance(cartesian, distanceopt)
Places camera at a fixed distance from a target point and looks at it.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
cartesian | Vec3 | Target cartesian point. | ||
distance | number | <optional> | 10000.0 | Distance from the target. |
- Overrides
- Source
viewExtent(extent, heightopt)
View current extent.
| Name | Type | Attributes | Description |
|---|---|---|---|
extent | Extent | Current extent. | |
height | number | <optional> |
- Source