PlanetCamera#

Planet camera.

Constructor#

new PlanetCamera(planet, optionsopt)#

Parameters:
NameTypeAttributesDescription
planetPlanet

Planet render node.

optionsIPlanetCameraParams<optional>

Planet camera options:

Properties
NameTypeAttributesDescription
namestring<optional>

Camera name.

viewAnglenumber<optional>

Camera angle of view.

nearnumber<optional>

Camera near plane distance. Default is 1.0

farnumber<optional>

Camera far plane distance. Default is og.math.MAX

minAltitudenumber<optional>

Minimal altitude for the camera. Default is 5

maxAltitudenumber<optional>

Maximal altitude for the camera. Default is 20000000

eyeVec3<optional>

Camera eye position. Default (0,0,0)

lookVec3<optional>

Camera look position. Default (0,0,0)

upVec3<optional>

Camera eye position. Default (0,1,0)

Extends#

Methods#

_init(optionsopt)#

Camera initialization.

Parameters:
NameTypeAttributesDescription
optionsObject<optional>

Camera options:

Properties
NameTypeAttributesDescription
viewAnglenumber<optional>

Camera angle of view.

nearnumber<optional>

Camera near plane distance. Default is 1.0

farnumber<optional>

Camera far plane distance. Default is math.MAX

eyeVec3<optional>

Camera eye position. Default (0,0,0)

lookVec3<optional>

Camera look position. Default (0,0,0)

upVec3<optional>

Camera eye position. Default (0,1,0)

Overrides

_setProj(angle, aspect)#

Sets up camera projection

Parameters:
NameTypeDescription
anglenumber

Camera view angle

aspectnumber

Screen aspect ratio

checkFly()#

Prepare camera to the frame. Used in render node frame function.

flyCartesian(cartesian, lookopt, upopt, amplopt, completeCallbackopt, startCallbackopt, frameCallbackopt)#

Flies to the cartesian coordinates.

Parameters:
NameTypeAttributesDefaultDescription
cartesianVec3

Finish cartesian coordinates.

lookVec3<optional>

Camera LOOK in the end of flying. Default - (0,0,0)

upVec3<optional>

Camera UP vector in the end of flying. Default - (0,1,0)

amplNumber<optional>
1.0

Altitude amplitude factor.

completeCallbackfunction<optional>

Callback that calls after flying when flying is finished.

startCallbackfunction<optional>

Callback that calls before the flying begins.

frameCallbackfunction<optional>

Each frame callback

flyExtent(extent, heightopt, upopt, amplopt, completeCallbackopt, startCallbackopt, frameCallbackopt)#

Flies to the current extent.

Parameters:
NameTypeAttributesDescription
extentExtent

Current extent.

heightnumber<optional>

Destination height.

upVec3<optional>

Camera UP in the end of flying. Default - (0,1,0)

amplNumber<optional>

Altitude amplitude factor.

completeCallbackfunction<optional>

Callback that calls after flying when flying is finished.

startCallbackfunction<optional>

Callback that calls before the flying begins.

frameCallbackfunction<optional>

Each frame callback

flyLonLat(lonlat, lookopt, upopt, amplopt, completeCallbackopt, startCallbackopt, frameCallbackopt)#

Flies to the geo coordinates.

Parameters:
NameTypeAttributesDescription
lonlatLonLat

Finish coordinates.

lookVec3 | LonLat<optional>

Camera LOOK in the end of flying. Default - (0,0,0)

upVec3<optional>

Camera UP vector in the end of flying. Default - (0,1,0)

amplnumber<optional>

Altitude amplitude factor.

completeCallbackfunction<optional>

Callback that calls after flying when flying is finished.

startCallbackfunction<optional>

Callback that calls befor the flying begins.

frameCallbackfunction<optional>

each frame callback

getAltitude()#

Gets altitude over the terrain.

getAspectRatio() → {number}#

Returns aspect ratio

Returns:
  • Aspect ratio
Type: 
number

getExtentPosition(extent, height) → {Vec3}#

Gets position by viewable extent.

Parameters:
NameTypeDescription
extentExtent

Viewable extent.

heightNumber

Camera height

Returns:
Type: 
Vec3

getHeight() → {number}#

Returns camera height.

Returns:
Type: 
number

getInverseProjectionMatrix() → {Mat4}#

Returns inverse projection matrix.

Returns:
  • Inverse projection-view matrix.
Type: 
Mat4

getInverseProjectionViewMatrix() → {Mat4}#

Returns inverse projection and model matrix product.

Returns:
  • Inverse projection-view matrix.
Type: 
Mat4

getLonLat() → {LonLat}#

Returns camera geographical position.

Returns:
Type: 
LonLat

getNormalMatrix() → {NumberArray9}#

Returns normal matrix.

Returns:
  • Normal matrix.
Type: 
NumberArray9

getProjectionMatrix() → {Mat4}#

Returns projection matrix.

Returns:
  • Projection matrix.
Type: 
Mat4

getProjectionViewMatrix() → {Mat4}#

Returns projection and model matrix product.

Returns:
  • Projection-view matrix.
Type: 
Mat4

getViewAngle() → {number}#

Gets camera view angle in degrees

Returns:

angle -

Type: 
number

getViewMatrix() → {NumberArray16}#

Returns model matrix.

Returns:
  • View matrix.
Type: 
NumberArray16

isFlying() → {boolean}#

Returns camera is flying.

Returns:
Type: 
boolean

look(look, upopt)#

Sets camera look point

Parameters:
NameTypeAttributesDescription
lookVec3

Look point

upVec3<optional>

Camera up vector otherwise camera current up vector(this._u)

Overrides

pitch(angle)#

Pitch the camera to the angle in degrees

Parameters:
NameTypeDescription
anglenumber

Delta pitch angle in degrees

Overrides

project(v) → {Vec2}#

Gets projected 3d point to the 2d screen coordinates

Parameters:
NameTypeDescription
vVec3

Cartesian 3d coordinates

Returns:
  • Screen point coordinates
Type: 
Vec2

projectedSize(p, r) → {number}#

Gets 3d size factor. Uses in LOD distance calculation.

Parameters:
NameTypeDescription
pVec3

Far point.

rVec3

Far point.

Returns:
  • Size factor.
Type: 
number

refresh()#

Refresh camera matrices

roll(angle)#

Roll the camera to the angle in degrees

Parameters:
NameTypeDescription
anglenumber

Delta roll angle in degrees

Overrides

rotateAround(angle, isArcopt, centeropt, upopt)#

Rotates camera around center point

Parameters:
NameTypeAttributesDescription
anglenumber

Rotation angle in radians

isArcboolean<optional>

If true camera up vector gets from current up vector every frame, otherwise up is always input parameter.

centerVec3<optional>

Point that the camera rotates around

upVec3<optional>

Camera up vector

rotateDown(angle)#

Rotates around planet to the South Pole.

Parameters:
NameTypeDescription
anglenumber

Rotation angle.

rotateHorizontal(angle, isArcopt, centeropt, upopt)#

Rotates camera around center point by horizontal.

Parameters:
NameTypeAttributesDescription
anglenumber

Rotation angle in radians.

isArcboolean<optional>

If true camera up vector gets from current up vector every frame, otherwise up is always input parameter.

centerVec3<optional>

Point that the camera rotates around.

upVec3<optional>

Camera up vector.

rotateLeft(angle, spinopt)#

Rotates around planet to the left.

Parameters:
NameTypeAttributesDescription
anglenumber

Rotation angle.

spinboolean<optional>

If its true rotates around globe spin.

rotateRight(angle, spinopt)#

Rotates around planet to the right.

Parameters:
NameTypeAttributesDescription
anglenumber

Rotation angle.

spinboolean<optional>

If its true rotates around globe spin.

rotateUp(angle)#

Rotates around planet to the North Pole.

Parameters:
NameTypeDescription
anglenumber

Rotation angle.

rotateVertical(angle, centeropt)#

Rotates camera around center point by vertical.

Parameters:
NameTypeAttributesDescription
anglenumber

Rotation angle in radians.

centerVec3<optional>

Point that the camera rotates around.

set(eye, look, up) → {Camera}#

Sets camera to eye position

Parameters:
NameTypeDescription
eyeVec3

Camera position

lookVec3

Look point

upVec3

Camera up vector

Overrides
Returns:
  • This camera
Type: 
Camera

setAltitude(alt)#

Sets altitude over the terrain.

Parameters:
NameTypeDescription
altnumber

Altitude over the terrain.

setAspectRatio(aspect)#

Sets aspect ratio

Parameters:
NameTypeDescription
aspectNumber

Camera aspect ratio

setLonLat(lonlat, lookLonLatopt, upopt)#

Places camera to view to the geographical point.

Parameters:
NameTypeAttributesDescription
lonlatLonLat

New camera and camera view position.

lookLonLatLonLat<optional>

Look up coordinates.

upVec3<optional>

Camera UP vector. Default (0,1,0)

setViewAngle(angle)#

Sets camera view angle in degrees

Parameters:
NameTypeDescription
anglenumber

View angle

slide(du, dv, dn)#

Slides camera to vector d - (du, dv, dn)

Parameters:
NameTypeDescription
dunumber

delta X

dvnumber

delta Y

dnnumber

delta Z

Overrides

stopFlying()#

Breaks the flight.

unproject(x, y) → {Vec3}#

Returns normal vector direction to the unprojected screen point from camera eye

Parameters:
NameTypeDescription
xnumber

Screen X coordinate

ynumber

Screen Y coordinate

Returns:
  • Direction vector
Type: 
Vec3

(abstract) update()#

Updates camera view space.

Overrides

viewExtent(extent, heightopt)#

View current extent.

Parameters:
NameTypeAttributesDescription
extentExtent

Current extent.

heightnumber<optional>

yaw(angle)#

Yaw the camera to the angle in degrees

Parameters:
NameTypeDescription
anglenumber

Delta yaw angle in degrees

Overrides