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(cartesianopt, paramsopt)

Flies to the cartesian coordinates.

Parameters:
NameTypeAttributesDescription
cartesianVec3<optional>

Finish cartesian coordinates.

paramsIFlyCartesianParams<optional>

Flight parameters

flyExtent(extent, heightopt, paramsopt)

Flies to the current extent.

Parameters:
NameTypeAttributesDescription
extentExtent

Current extent.

heightnumber<optional>

Destination height.

paramsIPlanetFlyCartesianParams<optional>

Flight parameters

flyLonLat(lonlat, paramsopt)

Flies to the geo coordinates.

Parameters:
NameTypeAttributesDescription
lonlatLonLat

Finish coordinates.

paramsIPlanetFlyCartesianParams<optional>

Flight parameters

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

getHeading()

should be yje same as getYaw

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

getProjectionViewRTEMatrix() → {Mat4}

Returns projection and model RTE matrix product.

Returns:
  • Projection-view matrix.
Type: 
Mat4

getRotation()

Returns camera quaternion

getViewAngle() → {number}

Gets camera view angle in degrees

Returns:

angle -

Type: 
number

getViewMatrix() → {NumberArray16}

Returns model matrix.

Returns:
  • View matrix.
Type: 
NumberArray16

getYaw()

should be the same as getHeading

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

project(x, y, z) → {Vec2}

Gets projected 3d point to the 2d screen coordinates

Parameters:
NameTypeDescription
xnumber

X coordinate

ynumber

Y coordinate

znumber

Z coordinate

Returns:
  • Screen point coordinates
Type: 
Vec2

project3v(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

rotateAround(angle, isArcopt, centeropt, upopt)

Rotates camera around center point

Parameters:
NameTypeAttributesDefaultDescription
anglenumber

Rotation angle in radians

isArcboolean<optional>
false

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.

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)

setPitch(angle)

Pitch the camera to the angle in radians

Parameters:
NameTypeDescription
anglenumber

Delta pitch angle in radians

setRoll(angle)

Roll the camera to the angle in radians

Parameters:
NameTypeDescription
anglenumber

Delta roll angle in radians

setViewAngle(angle)

Sets camera view angle in degrees

Parameters:
NameTypeDescription
anglenumber

View angle

setYaw(angle)

Yaw the camera to the angle in radians

Parameters:
NameTypeDescription
anglenumber

Delta yaw angle in radians

Overrides

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

unproject2v(pos) → {Vec3}

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

Parameters:
NameTypeDescription
posVec2

Screen X 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>