Constructor
new Planet(optionsopt)
| Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | IPlanetParams | <optional> | {} | Planet configuration parameters. Properties
|
- Source
- event:draw - Triggered before globe frame begins to render.
- event:layeradd - Triggered when a layer is added to the planet.
- event:baselayerchange - Triggered when the base layer changes.
- event:layerremove - Triggered when a layer is removed from the planet.
- event:layervisibilitychange - Triggered when layer visibility changes.
- event:rendercompleted - Triggered when all data is loaded.
- event:terraincompleted - Triggered when terrain data is loaded.
- event:layerloadend - Triggered when layer data finishes loading.
Extends
Members
atmosphereControl
Returns atmosphere control instance bound to the planet.
- Source
atmosphereEnabled
Enables or disables atmosphere rendering and related programs.
- Source
atmosphereEnabled
Returns atmosphere activity flag.
- Source
atmosphereMaxMinOpacity
Gets atmosphere opacity range [max, min].
- Source
atmosphereMaxOpacity
Sets maximum atmosphere opacity.
- Source
atmosphereMaxOpacity
Gets maximum atmosphere opacity.
- Source
atmosphereMinOpacity
Sets minimum atmosphere opacity.
- Source
atmosphereMinOpacity
Gets minimum atmosphere opacity.
- Source
layers
Returns current layers snapshot.
- Source
maxGridSize
Returns max segment grid size used by the quadtree.
- Source
normalMapCreator
Returns normal-map generator used by the planet.
- Source
shadeMode
Returns active terrain shade mode.
- Source
shadeMode
Sets terrain shade mode.
- Source
sun
Returns Sun control instance if attached to the renderer.
- Source
sunPos
Returns current sun world position.
- Source
terrainReady
Returns true if current terrain data set is loaded
- Source
Methods
(protected) _applyAttribution()
Apply to render list of layer attributions
- Source
(protected) _clear()
Clear current node.
- Overrides
- Source
_clearLayerMaterial(layer)
Clears material resources related to a layer in quadtree segments.
| Name | Type | Description |
|---|---|---|
layer | Layer | Material layer. |
- Source
_onLayerVisibilityChanged(layer)
Dispatch layer visibility changing event.
| Name | Type | Description |
|---|---|---|
layer | Layer | Changed layer. |
- Source
_renderingOpaqueScreenNodes()
Drawing nodes
- Source
(protected) _sortLayers()
Sort visible layer - preparing for rendering.
- Source
addControl(control)
Add the given control to the renderer of the planet scene.
| Name | Type | Description |
|---|---|---|
control | Control | Control. |
- Source
addControls(cArr)
Add the given controls array to the renderer of the planet.
| Name | Type | Description |
|---|---|---|
cArr | Array.<Control> | Control array. |
- Source
addEntityCollection(entityCollection, isHiddenopt) → {Scene}
Adds entity collection.
| Name | Type | Attributes | Description |
|---|---|---|---|
entityCollection | EntityCollection | Entity collection. | |
isHidden | boolean | <optional> | If it's true that this collection has specific rendering. |
- Overrides
- Source
- Type:
- Scene
addLayer(layer)
Adds layer to the planet.
| Name | Type | Description |
|---|---|---|
layer | Layer | Layer object. |
- Source
addLayers(layers)
Adds the given layers array to the planet.
| Name | Type | Description |
|---|---|---|
layers | Array.<Layer> | Layers array. |
- Source
addNode()
Adds node to the current hierarchy.
- Overrides
- Source
assign(renderer)
Assign render node with renderer.
| Name | Type | Description |
|---|---|---|
renderer | Renderer | Render node's renderer. |
- Overrides
- Source
createDefaultTextures(param0, param1)
Creates default textures first for the North Pole and whole globe and second for the South Pole.
| Name | Type | Description |
|---|---|---|
param0 | IDefaultTextureParams | Default texture params for the first texture. |
param1 | IDefaultTextureParams | Default texture params for the second texture. |
- Source
destroy()
Destroy planet.
- Overrides
- Source
draw()
Calls render frame node's callback. Used in renderer.
- Overrides
- Source
drawPickingEntityCollections(ec)
Draw entity collections picking frame.
| Name | Type | Description |
|---|---|---|
ec | Array.<EntityCollection> | Entity collection array. |
- Overrides
- Source
flyCartesian(cartesian, params)
Fly camera to the point.
| Name | Type | Description |
|---|---|---|
cartesian | Vec3 | Fly cartesian coordinates. |
params | IPlanetFlyCartesianParams | Flight parameters. |
- Source
flyExtent(extent, heightopt, params)
Fly active camera to the view extent.
| Name | Type | Attributes | Description |
|---|---|---|---|
extent | Extent | Geographical extent. | |
height | Number | <optional> | Height on the end of the flight route. |
params | IPlanetFlyCartesianParams | Flight parameters. |
- Source
flyLonLat(lonlat, params)
Fly camera to the geodetic position.
| Name | Type | Description |
|---|---|---|
lonlat | LonLat | Fly geographical coordinates. |
params | IPlanetFlyCartesianParams | Flight parameters. |
- Source
getCartesianFromMouseTerrain() → {Vec3|undefined}
Returns mouse position cartesian coordinates on the current terrain.
- Source
- Type:
- Vec3 |
undefined
getCartesianFromPixelEllipsoid(px) → {Vec3|undefined}
Project screen coordinates to the planet ellipsoid.
| Name | Type | Description |
|---|---|---|
px | Vec2 | | Screen coordinates. |
- Source
- Cartesian coordinates.
- Type:
- Vec3 |
undefined
getCartesianFromPixelTerrain(px) → {Vec3|undefined}
Returns screen coordinates cartesian coordinates on the current terrain. position or null if input coordinates is outside the planet.
| Name | Type | Description |
|---|---|---|
px | Vec2 | | Pixel screen 2d coordinates. |
- Source
- Type:
- Vec3 |
undefined
getDistanceFromPixel(px) → {number}
Returns distance from active (screen) camera to the planet terrain by screen coordinates.
| Name | Type | Description |
|---|---|---|
px | Vec2 | | Screen coordinates. |
- Source
- Type:
- number
getDistanceFromPixelEllipsoid(px) → {number|undefined}
Returns distance from an active (screen) camera to the planet ellipsoid.
| Name | Type | Description |
|---|---|---|
px | Vec2 | | Screen coordinates. |
- Source
- Type:
- number |
undefined
getEntityTerrainPoint(entity, res) → {Vec3|undefined}
Finds terrain point under an entity in currently rendered segments.
- Source
- Terrain point if found.
- Type:
- Vec3 |
undefined
getExtent() → {Extent}
Gets current camera view extent.
- Source
- Type:
- Extent
getFrameRotation(cartesian) → {Quat}
Returns local frame rotation for a cartesian point.
| Name | Type | Description |
|---|---|---|
cartesian | Vec3 | Cartesian point. |
- Source
- Rotation from world frame to local frame.
- Type:
- Quat
(async) getHeightAboveELL(lonLat) → {Promise.<number>}
Returns terrain height above ellipsoid at the given coordinates.
| Name | Type | Description |
|---|---|---|
lonLat | LonLat | Geodetic coordinates. |
- Source
- Height above ellipsoid.
- Type:
- Promise.<number>
(async) getHeightDefault(lonLat) → {Promise.<number>}
Returns terrain height at the given coordinates in default terrain datum.
| Name | Type | Description |
|---|---|---|
lonLat | LonLat | Geodetic coordinates. |
- Source
- Height value.
- Type:
- Promise.<number>
getHeightFactor() → {number}
Gets elevation scale.
- Source
Terrain elevation scale
- Type:
- number
getLayerByName(name) → {Layer|undefined}
Returns a layer by name.
| Name | Type | Description |
|---|---|---|
name | string | Layer name. |
- Source
- Type:
- Layer |
undefined
getLonLatFromPixelEllipsoid(px) → {LonLat|undefined}
Project screen coordinates to the planet ellipsoid.
| Name | Type | Description |
|---|---|---|
px | Vec2 | Screen coordinates. |
- Source
- Geodetic coordinates.
- Type:
- LonLat |
undefined
getLonLatFromPixelTerrain(px) → {LonLat|undefined}
Returns geodetic coordinates on the current terrain planet by its screen coordinates. position or null if input coordinates is outside the planet.
| Name | Type | Description |
|---|---|---|
px | Vec2 | | Pixel screen 2d coordinates. |
- Source
- Type:
- LonLat |
undefined
getNorthFrameRotation(cartesian) → {Quat}
Returns local north frame rotation for a cartesian point.
| Name | Type | Description |
|---|---|---|
cartesian | Vec3 | Cartesian point. |
- Source
- Rotation from world frame to local north frame.
- Type:
- Quat
getPixelFromCartesian(coords) → {Vec2}
Project cartesian coordinates to screen space.
| Name | Type | Description |
|---|---|---|
coords | Vec3 | Cartesian coordinates. |
- Source
- Screen coordinates.
- Type:
- Vec2
getPixelFromLonLat(lonlat) → {Vec2|undefined}
Project geodetic coordinates to screen space.
| Name | Type | Description |
|---|---|---|
lonlat | LonLat | Geodetic coordinates. |
- Source
- Screen coordinates.
- Type:
- Vec2 |
undefined
getRayIntersectionEllipsoid(ray) → {Vec3|undefined}
Returns ray vector hit ellipsoid coordinates. If the ray doesn't hit ellipsoid it returns 'undefined'.
| Name | Type | Description |
|---|---|---|
ray | Ray | Ray. |
- Source
- Type:
- Vec3 |
undefined
getViewExtent() → {Extent}
Returns currently cached quadtree view extent.
- Source
- Cached view extent.
- Type:
- Extent
init()
Initializes render resources, workers, shaders, and layer state.
- Source
initAtmosphereShader(atmosParamsopt)
Reinitializes terrain forward/deferred shaders for atmosphere mode.
| Name | Type | Attributes | Description |
|---|---|---|---|
atmosParams | AtmosphereParameters | <optional> | Optional atmosphere shader parameters. |
- Source
initLayers()
Reattaches already registered layers to apply initialization logic.
- Source
isActive() → {Boolean}
Gets render node activity.
- Overrides
- Source
- Type:
- Boolean
lockQuadTree()
Pauses quadtree render-node collection and disables camera terrain collision checks.
- Source
memClear()
Starts clear memory thread.
- Source
onremove()
Handles node detachment and frees runtime terrain data.
- Source
preDraw()
Calls render frame node's callback. Used in renderer.
- Overrides
- Source
preFrame()
Render node callback.
- Source
removeEntityCollection(entityCollection)
Removes entity collection.
| Name | Type | Description |
|---|---|---|
entityCollection | EntityCollection | Entity collection for remove. |
- Overrides
- Source
removeLayer(layer)
Removes the given layer from the planet.
| Name | Type | Description |
|---|---|---|
layer | Layer | Layer to remove. |
- Source
renderDepthFramebuffer(cam, quadTreeStrategy)
Renders terrain depth and frustum id into the depth framebuffer.
| Name | Type | Description |
|---|---|---|
cam | PlanetCamera | Camera used for rendering. |
quadTreeStrategy | QuadTreeStrategy | Quadtree strategy with rendered node lists. |
- Source
setActive(isActive)
Rendering activation.
| Name | Type | Description |
|---|---|---|
isActive | boolean | Activation flag. |
- Overrides
- Source
setBaseLayer(layer)
Sets base layer coverage to the planet.
| Name | Type | Description |
|---|---|---|
layer | Layer | Layer object. |
- Source
setDrawMode(mode)
Sets draw mode
| Name | Type | Description |
|---|---|---|
mode | Number | Draw mode, such as gl.TRIANGLES, gl.TRIANGLE_STRIP, gl.LINES etc. |
- Overrides
- Source
setHeightFactor(factor)
Sets elevation scale. 1.0 is default.
| Name | Type | Description |
|---|---|---|
factor | number | Elevation scale. |
- Source
setLodSize(currentLodSize, minLodSizeopt, maxLodSizeopt)
Sets LOD thresholds for quadtree terrain rendering. Proxy to QuadTreeStrategy.setLodSize.
| Name | Type | Attributes | Description |
|---|---|---|---|
currentLodSize | number | Current LOD size target. | |
minLodSize | number | <optional> | Minimum LOD size. |
maxLodSize | number | <optional> | Maximum LOD size. |
- Source
setTerrain(terrain)
Sets terrain provider
| Name | Type | Description |
|---|---|---|
terrain | EmptyTerrain | Terrain provider. |
- Source
stopFlying()
Stop current flight.
- Source
unlockQuadTree()
Resumes quadtree render-node collection and enables camera terrain collision checks.
- Source
updateAttributionsList()
Updates attribution lists
- Source
updateBillboardsTexCoords()
Refreshes billboard texture coordinates for all visible entity collections.
- Source
updateVisibleLayers()
Schedules visible layers list refresh for the next frame.
- Source
viewExtent(extent)
Sets camera to the planet geographical extent.
| Name | Type | Description |
|---|---|---|
extent | Extent | Geographical extent. |
- Source
viewExtentArr(extentArr)
Fits camera position for the view 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. |
- Source
viewLonLat(lonlat, lookLonLatopt, upopt)
Sets camera to the planet geographical position.
| Name | Type | Attributes | Description |
|---|---|---|---|
lonlat | LonLat | Camera position. | |
lookLonLat | LonLat | <optional> | Viewpoint. |
up | Vec3 | <optional> | Camera up vector. |
- Source