Class: Planet

og/scene/Planet.Planet

Main class for rendering planet

new module:og/scene/Planet.Planet()

Name Type Default Description
options.name string "Earth" optional Planet name(Earth by default)
options.ellipsoid Ellipsoid optional Planet ellipsoid(WGS84 by default)
options.maxGridSize Number 128 optional Segment maximal grid size
options.maxEqualZoomAltitude Number 15000000.0 optional Maximal altitude since segments on the screen bacame the same zoom level
options.minEqualZoomAltitude Number 10000.0 optional Minimal altitude since segments on the screen bacame the same zoom level
options.minEqualZoomCameraSlope Number 0.8 optional Minimal camera slope above te globe where segments on the screen bacame the same zoom level
Fires:
  • - Triggered before globe frame begins to render.
  • - Triggered when layer has added to the planet.
  • - Triggered when base layer changed.
  • - Triggered when layer has removed from the planet.
  • - Triggered when some layer visibility changed.

Extends

Members

protected_createdNodesCount

protected_frustumEntityCollectionsArray.<EntityCollection>

Vector layers visible nodes with collections.

protected_geoImageCreator

GeoImage creator.

protected_heightFactornumber

Height scale factor. 1 - is normal elevation scale.

protected_heightPickingFramebufferObject

Framebuffer for relief. Is null when WEBGL_draw_buffers extension initialized.

protected_indexesCacheArray.<Array.<number>>

Precomputed indexes array for differrent grid size segments.

_lodSizenumber

Level of the visible segment detalization.

protected_nightTexture

Night glowing gl texture.

protected_planetRadius2number

Squared ellipsoid radius.

protected_quadTreequadTree.Node

Mercator grid tree.

protected_quadTreeNodesCacheMercquadTree.Node

Created nodes cache

protected_quadTreeNorthquadTree.Node

North grid tree.

protected_quadTreeSouthquadTree.Node

South grid tree.

protected_renderedNodesquadTree.Node

Planet's segments collected for rendering frame.

protected_specularTexture

Specular mask gl texture.

protected_tcolorArr

Layer's transparent colors.

protected_textureCoordsBufferCacheArray.<Array.<number>>

Precomputed texture coordinates buffers for differrent grid size segments.

protected_useNightTextureboolean

True for rendering night glowing texture.

protected_useSpecularTextureboolean

True for rendering specular mask texture.

protected_visibleNodesquadTree.Node

Current visible mercator segments tree nodes array.

protected_visibleNodesNorthquadTree.Node

Current visible north pole nodes tree nodes array.

protected_visibleNodesSouthquadTree.Node

Current visible south pole nodes tree nodes array.

baseLayerLayer

There is only one base layer on the globe when layer.isBaseLayer is true.

cameraPlanetCamera

Camera is this.renderer.activeCamera pointer.

ellipsoidEllipsoid

entityCollectionsArray.<EntityCollection>

Entity collection array.

layerLockidle.Lock

Layers activity lock.

layersArray.<Layer>

All layers array.

lightEnabledBoolean

maxCurrZoomnumber

Current visible maximal zoom index planet segment.

minCurrZoomnumber

Current visible minimal zoom index planet segment.

mousePositionOnEarthVec3

Screen mouse pointer projected to planet cartesian position.

rendererRenderer

Renderer that calls frame() callback.

show

Show rendering.

constantSLICE_SIZE

Segment multiple textures size.(4 - convinient value for the most devices)

terrainTerrain

Terrain provider.

terrainLockidle.Lock

Terrain providers activity lock.

visibleTileLayersArray.<Layer>

Current visible imagery tile layers array.

protectedvisibleVectorLayersArray.<layer.Vector>

Current visible vector layers array.

Methods

protected_clearLayerMaterial(layer)

Name Type Description
layer Layer Material layer.

protected_collectRenderNodes()

Collects visible quad nodes.

protected_frustumEntityCollectionPickingCallback()

Vector layers picking pass.

abstract,protected_initializeShaders()

protected_onLayerVisibilityChanged(layer)

Dispatch layer visibility changing event.
Name Type Description
layer Layer Changed layer.

protected_renderColorPickingFramebufferPASS()

protected_renderDepthFramebufferPASS()

protected_renderHeightPickingFramebufferPASS()

protected_renderScreenNodesPASS()

protected_sortLayers()

Sort visible layer - preparing for rendering.

addControl(control)

Add the given control to the renderer of the planet scene.
Name Type Description
control control.Control Control.

addControls(cArr)

Add the given controls array to the renderer of the planet.
Name Type Description
cArr Array.<control.Control> Control array.

inherited addEntityCollection(entityCollection, isHidden){RenderNode}

Adds entity collection.
Name Type Description
entityCollection EntityCollection Entity collection.
isHidden boolean optional If it's true that this collection has specific rendering.
Returns:
Type Description
RenderNode -

addLayer(layer)

Adds the given layer to the planet.
Name Type Description
layer Layer Layer object.

addLayers(layers)

Adds the given layers array to the planet.
Name Type Description
layers Array.<Layer> Layers array.
Adds point light source.
Name Type Description
light LightSource Light source.
Returns:
Type Description
RenderNode
Adds node to the current hierarchy.
Assign render node with renderer.
Name Type Description
renderer Renderer Redner node's renderer.

createDefaultTextures()

Creates default textures first for nirth pole and whole globe and second for south pole.
Calls render frame node's callback. Used in renderer.

inherited drawPickingEntityCollections(ec)

Draw entity collections picking frame.
Name Type Description
ec Array.<og.EntityCollection> Entity collection array.

flyCartesian(cartesian, look, up, ampl, completeCallback, startCallback, frameCallback)

Fly camera to the new point.
Name Type Description
cartesian Vec3 Fly coordiantes.
look Vec3 optional Camera "look at" point.
up Vec3 optional Camera UP vector on the end of a flying.
ampl Number optional Altitude amplitude factor.
completeCallback optional
startCallback optional
frameCallback optional

flyExtent(extent, height, up, ampl, startCallback, completeCallback)

Fly camera to the planet geographical extent.
Name Type Description
extent Extent Geographical extent.
height Number optional Height on the end of the flight route.
up Vec3 optional Camera UP vector on the end of a flying.
ampl Number optional Altitude amplitude factor.
startCallback cameraCallback optional Callback that calls after flying when flying is finished.
completeCallback cameraCallback optional Callback that calls befor the flying begins.

flyLonLat(lonlat, look, up, ampl, completeCallback, startCallback, frameCallback)

Fly camera to the new geographical position.
Name Type Description
lonlat LonLat Fly geographical coordiantes.
look Vec3 optional Camera "look at" point on the end of a flying.
up Vec3 optional Camera UP vector on the end of a flying.
ampl Number optional Altitude amplitude factor.
completeCallback optional
startCallback optional
frameCallback optional
Render node callback.

getCartesianFromMouseTerrain(){Vec3}

Returns 3d cartesian coordinates on the relief planet by mouse cursor position or null if mouse cursor is outside the planet.
Returns:
Type Description
Vec3 -

getCartesianFromPixelEllipsoid(px){Vec3}

Returns 2d screen coordanates projection point to the planet ellipsoid 3d coordinates.
Name Type Description
px math.Pixel 2D sreen coordinates.
Returns:
Type Description
Vec3 -

getCartesianFromPixelTerrain(px, force){Vec3}

Returns 3d cartesian coordinates on the relief planet by 2d screen coordinates. position or null if input coordinates is outside the planet.
Name Type Default Description
px Vec2 Pixel screen 2d coordinates.
force Boolean false optional Force framebuffer rendering.
Returns:
Type Description
Vec3 -

getDistanceFromPixel(px, force){number}

Returns distance from active camera to the the relief planet coordiantes unprojected by 2d screen coordiantes, or null if screen coordinates outside the planet. If screen coordinates inside the planet but relief is not exists in the point than function returns distance to the planet ellipsoid.
Name Type Default Description
px Vec2 Screen coordinates.
force Boolean false optional Force framebuffer rendering.
Returns:
Type Description
number -

getDistanceFromPixelEllipsoid(px){number}

Returns distance from active camera to the the planet ellipsoid coordiantes unprojected by 2d screen coordiantes, or null if screen coordinates outside the planet.
Name Type Description
px Vec2 Screen coordinates.
Returns:
Type Description
number -

getHeightFactor(){number}

Gets elevation scale.
Returns:
Type Description
number Terrain elevation scale

getLayerByName(name){Layer}

Return layer by it name
Name Type Description
name string Name of the layer. og.Layer.prototype.name
Returns:
Type Description
Layer -

getLayers(){Array.<Layer>}

Get the collection of layers associated with this planet.
Returns:
Type Description
Array.<Layer> Layers array.

inherited getLightByName(name){LightSource}

Gets light object by its name.
Name Type Description
name string Point light name.
Returns:
Type Description
LightSource

getLonLatFromPixelEllipsoid(px){LonLat}

Returns 2d screen coordanates projection point to the planet ellipsoid geographical coordinates.
Name Type Description
px math.Pixel 2D screen coordinates.
Returns:
Type Description
LonLat -

getLonLatFromPixelTerrain(px, force){LonLat}

Returns geographical coordinates on the relief planet by 2d screen coordinates. position or null if input coordinates is outside the planet.
Name Type Default Description
px Vec2 Pixel screen 2d coordinates.
force Boolean false optional Force framebuffer rendering.
Returns:
Type Description
LonLat -

getPixelFromCartesian(coords){Vec2}

Returns projected 2d screen coordinates by 3d cartesian coordiantes.
Name Type Description
coords Vec3 Cartesian coordinates.
Returns:
Type Description
Vec2 -

getPixelFromLonLat(lonlat){Vec2}

Returns projected 2d screen coordinates by geographical coordinates.
Name Type Description
lonlat LonLat Geographical coordinates.
Returns:
Type Description
Vec2 -

getRayIntersectionEllipsoid(ray){Vec3}

Returns ray vector hit ellipsoid coordinates. If the ray doesn't hit ellipsoit returns null.
Name Type Description
ray Ray Ray 3d.
Returns:
Type Description
Vec3 -

getViewExtent(){Extent}

Gets current viewing geographical extent.
Returns:
Type Description
Extent -

abstractinit()

Gets render node activity.
Returns:
Type Description
Boolean -
Starts clear memory thread.

inherited removeEntityCollection(entityCollection)

Removes entity collection.
Name Type Description
entityCollection EntityCollection Entity collection for remove.

removeLayer(layer){Layer|undefined}

Removes the given layer from the planet.
Name Type Description
layer Layer Layer to remove.
Returns:
Type Description
Layer | undefined The removed layer or undefined if the layer was not found.
Removes light source.
Name Type Description
light LightSource Light source object.
Rendering activation.
Name Type Description
isActive boolean Activation flag.

setBaseLayer(layer)

Sets base layer coverage to the planet.
Name Type Description
layer Layer Layer object.
Sets draw mode
Name Type Description
mode Number Draw mode, such as gl.TRIANGLES, gl.TRIANGLE_STRIP, gl.LINES etc.

setHeightFactor(factor)

Sets elevation scale. 1.0 is default.
Name Type Description
factor number Elevation scale.

setTerrain(terrain)

Sets terrain provider
Name Type Description
terrain Terrain Terrain provider.
Breaks the flight.
IMPORTANT: This function have to be called manualy in each render node frame callback, before drawing scene geometry.

updateAttributionsList()

Updates attribution lists

updateVisibleLayers()

Updates visible layers.

viewExtent(extent)

Sets camera to the planet geographical extent.
Name Type Description
extent Extent Geographical extent.

viewExtentArr(extentArr)

Sets camera to the planet geographical extent.
Name Type Description
extentArr Array.<number> Geographical extent array, (exactly 4 entries) where index 0 - southwest longitude, 1 - latitude southwest, 2 - longitude northeast, 3 - latitude northeast.

viewLonLat(lonlat, up)

Sets camera to the planet geographical position.
Name Type Description
lonlat LonLat New geographical position.
up Vec3 optional Camera UP vector.