geo.viewport
9 functions / 16 types
Modules
| Module |
|---|
geo.viewport.camera |
Index
| Function | Description |
|---|---|
| getAutoExposure | Read a viewport’s automatic exposure and what its last frame’s metering found. |
| getRendering | Read the parts of the rendering a viewport draws. |
| getSunlight | Read the light a viewport’s view is lit by and the rules it follows. |
| getViewMode | Read whether a viewport shows the globe or the flat map. While a switch is under way, the view it heads for. |
| setAutoExposure | Set a viewport’s exposure from the light on the ground it shows, every frame. |
| setRendering | Turn parts of a viewport’s rendering of the maps on or off. Each field left out keeps its value. |
| setSunlight | Light a viewport’s view of every map by sun rules, at an illuminance. |
| setViewMode | Show the map as a globe in perspective, or straight down on the flat map. |
| toggleViewMode | Switch viewports from the globe to the flat map, or back, the way geo.viewport.set_view_mode switches them. |
| Type | Description |
|---|---|
| AmbientLight | A light every map’s ground and air take evenly from all directions, the way the ground takes the sky’s light, whatever the sun does. It belongs to the viewport rather than to any one body. |
| AutoExposure | A viewport’s automatic exposure, as geo.viewport.get_auto_exposure reads it. |
| CameraSun | A light at angles off the camera’s view. Azimuth 0 and elevation 0 is straight behind the camera, a positive azimuth is to its left, and elevation 90 is the camera’s up: square to its view, on the side of the local up at the ground under the camera, so the angles never roll with the camera. A level camera’s up is the local up. It works the same on a flat map, where the local up is the plane’s normal. |
| CurvePoint | One point of an exposure curve: the light on level ground and how bright it should look. |
| Deadzone | How far the place a rule measures at may trail the place under the camera before it is dragged along: share of the view’s ground span, but at least least body radii. |
| ExposureCurve | How bright each amount of light on level ground should look. |
| ExposureMetering | What one frame’s metering found, as geo.viewport.get_auto_exposure reads it. |
| Rendering | The parts of the rendering a viewport draws, as geo.viewport.get_rendering reads them. |
| SceneSun | A light from one fixed direction. On a flat map it lights the whole map from that direction, so there is no day and night across it; a flat map is usually lit with camera or solarTime instead. |
| SolarTimeSun | The sun as it stands at a set local solar time over the ground under the camera, for the declination of towardSun over the equator of the camera’s body. |
| SpaceExposure | The exposure for open space, and the disc spans the view moves to it between. |
| SunBlend | A light share of the way from rule near’s light to rule far’s. |
| SunRule | One sun rule. Exactly one kind is set. |
| Sunlight | The light a viewport’s view is lit by, as geo.viewport.get_sunlight reads it. |
| SunlitExposureFloor | The floor sunlit ground in view puts under the exposure, so a sunlit crescent or disc does not burn out. |
| ViewMeasure | How a blend measures how much of the body the view shows. Both measure as if the camera looked straight down at the place under it. |
getAutoExposure
getAutoExposure(args?: { viewport?: string }, transactionId?: string): Promise<GeoViewportAutoExposure>Read a viewport’s automatic exposure and what its last frame’s metering found.
Fails with InvalidArgument unless exactly one viewport matches viewport.
Returns: A viewport’s automatic exposure, as geo.viewport.get_auto_exposure reads it.
Returns Promise<GeoViewportAutoExposure>.
viewport optional : string
Label of the viewport to read. Absent, the only viewport.
transactionId optional : string
getRendering
getRendering(args?: { viewport?: string }, transactionId?: string): Promise<GeoViewportRendering>Read the parts of the rendering a viewport draws.
Fails with InvalidArgument unless exactly one viewport matches viewport.
Returns: The parts of the rendering a viewport draws, as geo.viewport.get_rendering reads them.
Returns Promise<GeoViewportRendering>.
viewport optional : string
Label of the viewport to read. Absent, the only viewport.
transactionId optional : string
getSunlight
getSunlight(args?: { viewport?: string }, transactionId?: string): Promise<GeoViewportSunlight>Read the light a viewport’s view is lit by and the rules it follows.
Fails with InvalidArgument unless exactly one viewport matches viewport.
Returns: The light a viewport’s view is lit by, as geo.viewport.get_sunlight reads it.
Returns Promise<GeoViewportSunlight>.
viewport optional : string
Label of the viewport to read. Absent, the only viewport.
transactionId optional : string
getViewMode
getViewMode(args?: { viewport?: string }, transactionId?: string): Promise<GeoMapViewMode | undefined>Read whether a viewport shows the globe or the flat map. While a switch is under way, the view it heads for.
Returns nothing when the viewport’s camera is not on the map yet. Fails unless exactly one
viewport matches viewport.
Returns Promise<GeoMapViewMode | undefined>.
viewport optional : string
Label of the viewport to read. Absent, the only viewport is read.
transactionId optional : string
setAutoExposure
setAutoExposure(args?: { albedo?: number; brightestEv100?: number; brightestSkyShare?: number; curve?: GeoViewportExposureCurve; darkestEv100?: number; easeSeconds?: number; enabled?: boolean; space?: GeoViewportSpaceExposure; sunlitFloor?: GeoViewportSunlitExposureFloor; viewport?: string }, transactionId?: string): Promise<void>Set a viewport’s exposure from the light on the ground it shows, every frame.
Each frame the engine measures the light on level ground at a reference point of each body in
view: under the camera close in, and toward the point the view looks at as the body’s disc
comes into view. The light is the sun’s through that body’s air, the sky’s and the viewport’s
ambient light, as the map draws the ground with them. curve says how bright that light should
look, and the exposure draws ground of albedo under it at that share of white. A body’s disc
shrinking toward space.space_span moves the exposure to space.ev100, and sunlit ground in
view keeps the exposure from going so low that it burns out. On the map the camera stands on,
the exposure moves to that ground’s own as the map flattens.
With the camera inside a body’s drawn air, the engine also measures the luminance of the sky
and of the haze over the ground across the view, and keeps the exposure from going so low that
the brightest twentieth of the view is drawn over brightestSkyShare of white. This only ever
darkens the view, such as a view toward a low sun or a twilight glow over darkening ground.
A change the view causes, a camera move or a flight, eases over easeSeconds. A change the
light causes, such as the clock moving the sun, lands on the frame it happens.
Each field left out keeps its value. A viewport starts with automatic exposure off, a curve
drawing every light at 18% of white, an albedo of 0.18, an ease of 0.3 seconds, exposures from
-6 to 20, open space at 1 between spans of 0.6 and 0.1, a sunlit floor from 0.2% of the screen
falling 2 stops a halving, and the sky left out, a brightestSkyShare of 0. While it is on,
viewport.set_exposure is overwritten on the next frame; turn it off for a fixed exposure.
Fails with InvalidArgument when no viewport matches viewport, the curve is empty, a point’s
lux or share is not a finite number above zero, the lux do not rise strictly, albedo,
easeSeconds or brightestSkyShare is negative or not finite, darkestEv100 is above
brightestEv100, or the spans are not finite with spaceSpan above zero and under
bodySpan.
Returns Promise<void>.
albedo optional : number
The albedo of the reference ground the curve’s shares are for.
brightestEv100 optional : number
The brightest exposure, as an EV100.
brightestSkyShare optional : number
The share of white, before tone mapping, the brightest twentieth of the sky and haze in view is drawn at most. 0 leaves the sky out.
curve optional : GeoViewportExposureCurve
How bright each amount of light should look.
darkestEv100 optional : number
The darkest exposure, as an EV100.
easeSeconds optional : number
Seconds a change caused by the view takes to settle.
enabled optional : boolean
Whether the exposure is set from the metering. Absent, it is turned on.
space optional : GeoViewportSpaceExposure
Open space.
sunlitFloor optional : GeoViewportSunlitExposureFloor
The floor sunlit ground in view puts under the exposure.
viewport optional : string
Label of the viewports to change. Absent, every viewport.
transactionId optional : string
setRendering
setRendering(args?: { ambient?: GeoViewportAmbientLight; atmosphere?: boolean; groundShadows?: boolean; sunDisc?: boolean; terrainEyeDome?: boolean; unlitImagery?: boolean; viewport?: string; volumetricShadows?: boolean }, transactionId?: string): Promise<void>Turn parts of a viewport’s rendering of the maps on or off. Each field left out keeps its value.
A viewport never set draws the atmosphere and the sun’s disc, and draws no terrain shadows, no eye dome lighting on the terrain, no unlit imagery and no ambient light.
Fails with InvalidArgument when no viewport matches viewport, or when the ambient light’s
illuminance is negative or not finite.
Returns Promise<void>.
ambient optional : GeoViewportAmbientLight
A light the ground and the air of every map the viewport shows take evenly from all directions, added to the sun and the sky, such as moonlight after dusk. The air scatters it evenly every way in its own color, so the night air and the ground share one tint. Models are not lit by it. With none, the air has no light once the sun and its twilight have gone.
atmosphere optional : boolean
Draw the sky and the haze of each map’s air, and light the ground through the same air. Ignored for a body without air, and on a GPU that cannot draw it.
groundShadows optional : boolean
Let terrain shade the ground behind it from the light. Ignored on a GPU without compute shaders, such as WebGL2.
sunDisc optional : boolean
Draw the sun’s disc, the one each map’s air draws included.
terrainEyeDome optional : boolean
Shade the terrain with eye dome lighting as well as the meshes, point clouds and block models. Off, each model is outlined on its own edge where it meets the terrain. Ignored on a GPU that cannot keep a depth only models write, such as WebGL2, where it reads as on.
unlitImagery optional : boolean
Draw the ground in its imagery’s own colors, with no light, sky light, terrain shadows, haze of the air or camera exposure, so a viewport with no tone mapping shows the imagery’s own pixels. Lines drawn on the ground still draw over it. Models and the sky stay lit.
viewport optional : string
Label of the viewports to change. Absent, every viewport.
volumetricShadows optional : boolean
Let terrain cast volumetric shadows: shafts of shade in the air behind it.
transactionId optional : string
setSunlight
setSunlight(args: { illuminance: number; rules?: Array<GeoViewportSunRule>; sun?: SceneNode; transitionSeconds?: number; viewport?: string }, transactionId?: string): Promise<void>Light a viewport’s view of every map by sun rules, at an illuminance.
The engine evaluates the rules every frame from that frame’s camera, so the light follows the
camera with no round trip. rules[0] gives the light; a blend names two later rules by their
index. A camera that stands on no map keeps the light the rules last gave where they need the
ground under it.
A solarTime rule with no towardSun lights from the sun node: each frame the engine
reads where the node and the map the camera stands on are in the scene, so moving the node
with scene.transform.set moves the light on the same frame, and the camera moving does not.
Where the node is despawned, the light keeps its last direction.
The light drives that viewport’s lighting of the ground, the sky, the haze and the scattering of each map’s air, terrain shadows, and the sun’s disc. Every map seen in one viewport is lit by that viewport’s light, and each viewport keeps its own. A viewport never given rules is lit from overhead along the scene’s up axis, z, at 130,000 lux.
Fails with InvalidArgument when rules is empty or holds more than 64 rules, a rule is out
of its domain, a rule needs the sun node and none is given, illuminance is negative or not
finite, transitionSeconds is negative or not finite, or no viewport matches viewport, and
with WrongNodeKind when sun is not a scene node.
Returns Promise<void>.
illuminance : number
Lux on a surface facing the light, before any air.
rules optional : Array<GeoViewportSunRule>
The rules, the first of which gives the light.
sun optional : SceneNode
The node the sun stands at, such as one from scene.spawn.
transitionSeconds optional : number
Seconds the light takes to turn from the light shown to the new rules’ light. Absent or 0, the new light shows at once, unless a transition is under way, which keeps running toward the new rules.
viewport optional : string
Label of the viewports to light. Absent, every viewport.
transactionId optional : string
setViewMode
setViewMode(args: { durationSeconds?: number; mode: GeoMapViewMode; viewport?: string }, transactionId?: string): Promise<void>Show the map as a globe in perspective, or straight down on the flat map.
The camera swings between the two while the map morphs between the globe and the flat map, so the ground in the middle of the view stays there. A switch already running finishes first, and asking for the view already shown does nothing. The flat view only pans and zooms.
Returns Promise<void>.
durationSeconds optional : number
Transition duration in seconds. Absent, 1.2 seconds. Zero changes immediately.
mode : GeoMapViewMode
viewport optional : string
Label of the viewports to change. Absent, exactly one viewport must exist.
transactionId optional : string
toggleViewMode
toggleViewMode(args?: { durationSeconds?: number; viewport?: string }, transactionId?: string): Promise<void>Switch viewports from the globe to the flat map, or back, the way
geo.viewport.set_view_mode switches them.
Returns Promise<void>.
durationSeconds optional : number
Transition duration in seconds. Absent, 1.2 seconds. Zero changes immediately.
viewport optional : string
Label of the viewports to change. Absent, exactly one viewport must exist.
transactionId optional : string
AmbientLight
A light every map’s ground and air take evenly from all directions, the way the ground takes the sky’s light, whatever the sun does. It belongs to the viewport rather than to any one body.
color : ColorColorRgb
sRGB color with 8-bit channels (0 to 255). It tints the light and leaves its brightness to
illuminance.
illuminance : number
Lux on a surface from all directions together. 0 turns the light off.
AutoExposure
A viewport’s automatic exposure, as geo.viewport.get_auto_exposure reads it.
albedo : number
The albedo of the reference ground the curve’s shares are for.
brightestEv100 : number
The brightest exposure, as an EV100.
brightestSkyShare : number
The share of white the brightest twentieth of the sky and haze in view is drawn at most, or 0 with the sky left out.
curve optional : Array<GeoViewportCurvePoint>
How bright each amount of light should look, with the lux rising.
darkestEv100 : number
The darkest exposure, as an EV100.
easeSeconds : number
Seconds a change caused by the view takes to settle.
enabled : boolean
Whether the exposure is set from the metering.
metering optional : GeoViewportExposureMetering
The last frame’s metering, absent before the first.
space : GeoViewportSpaceExposure
Open space.
sunlitFloor : GeoViewportSunlitExposureFloor
The floor sunlit ground in view puts under the exposure.
CameraSun
A light at angles off the camera’s view. Azimuth 0 and elevation 0 is straight behind the camera, a positive azimuth is to its left, and elevation 90 is the camera’s up: square to its view, on the side of the local up at the ground under the camera, so the angles never roll with the camera. A level camera’s up is the local up. It works the same on a flat map, where the local up is the plane’s normal.
azimuth : number
Degrees round from behind the camera, positive to its left.
deadzone optional : GeoViewportDeadzone
Absent, the angles are measured at the place under the camera.
elevation : number
Degrees from the back of the view toward the camera’s up, from -90 to 90.
CurvePoint
One point of an exposure curve: the light on level ground and how bright it should look.
lux : number
The light on level ground, in lux. Above zero.
shareOfWhite : number
The share of white, before tone mapping, ground of the reference albedo is drawn at under that light. Above zero.
Deadzone
How far the place a rule measures at may trail the place under the camera before it is
dragged along: share of the view’s ground span, but at least least body radii.
least : number
The least radius, in body radii.
share : number
The radius as a share of the view’s ground span.
ExposureCurve
How bright each amount of light on level ground should look.
points optional : Array<GeoViewportCurvePoint>
The points, with the lux rising strictly. The share is read in the log of both between points and held past either end.
ExposureMetering
What one frame’s metering found, as geo.viewport.get_auto_exposure reads it.
ev100 : number
The exposure shown, as an EV100.
lux : number
The light on the reference ground of the body the view takes its exposure from, in lux.
map optional : SceneNode
That body’s map.
shareOfWhite : number
The share of white the curve draws that light at.
skyLuminance : number
The luminance the brightest twentieth of the sky and haze in view shows, in cd/m2, or 0 with the camera out of any drawn air.
sunElevation : number
The sun’s elevation over the reference ground, in degrees.
targetEv100 : number
The exposure the view calls for, before the ease, as an EV100.
Rendering
The parts of the rendering a viewport draws, as geo.viewport.get_rendering reads them.
ambient : GeoViewportAmbientLight
The light the ground and the air take evenly from all directions, whatever the sun does.
atmosphere : boolean
Whether the sky and the haze of each map’s air are drawn, and the ground lit through them.
groundShadows : boolean
Whether terrain shades the ground behind it from the light.
sunDisc : boolean
Whether the sun’s disc is drawn.
terrainEyeDome : boolean
Whether eye dome lighting shades the terrain as well as the models.
unlitImagery : boolean
Whether the ground is drawn in its imagery’s own colors.
volumetricShadows : boolean
Whether terrain casts volumetric shadows: shafts of shade in the air behind it.
SceneSun
A light from one fixed direction. On a flat map it lights the whole map from that direction,
so there is no day and night across it; a flat map is usually lit with camera or
solarTime instead.
direction : MathVec3
The direction toward the light, in scene axes. Any length but zero.
SolarTimeSun
The sun as it stands at a set local solar time over the ground under the camera, for the
declination of towardSun over the equator of the camera’s body.
On the globe the sun is fixed to the body. On a flat map it keeps its east, north and up parts wherever the camera is. Between the two, the morph mixes them.
deadzone optional : GeoViewportDeadzone
Absent, the sun stands over the place under the camera.
hourAngle optional : number
Degrees from the local meridian, positive in the afternoon: 30 is two in the afternoon. Absent, the hour angle the sun has at that place, so on the globe the light points toward the sun wherever the camera moves.
leastElevation optional : number
Degrees above the horizon the sun never stands below; where it would, it keeps its azimuth at this elevation. Absent, -90.
towardSun optional : MathVec3
The direction toward the sun, in scene axes. Any length but zero. Absent, the direction
from the center of the map the camera stands on toward the sunlight’s sun node, worked
out every frame.
SpaceExposure
The exposure for open space, and the disc spans the view moves to it between.
bodySpan : number
The share of the view’s height a body’s disc spans from which the view takes the body’s own exposure.
ev100 : number
The exposure the view takes with no body large in it, as an EV100.
spaceSpan : number
The share of the view’s height at which the view takes ev100. Under bodySpan.
SunBlend
A light share of the way from rule near’s light to rule far’s.
The share rises from from to to in measure, on a log scale with eased ends for the spans
and in step with the morph for the morph. The light
turns about the spin axis of the camera’s body, its hour angle the way it turned last frame
and its declination evenly; on a flat map about the plane’s normal, its azimuth round and its
elevation evenly; and during the morph about the two mixed.
far : number
The index in rules of the light far out. It comes after this blend.
from : number
Where the blend starts, in measure’s units: wholly near’s light.
measure : GeoViewportViewMeasure
near : number
The index in rules of the light close in. It comes after this blend.
to : number
Where the blend ends: wholly far’s light.
SunRule
type GeoViewportSunRule = { kind: "scene"; value: GeoViewportSceneSun } | { kind: "camera"; value: GeoViewportCameraSun } | { kind: "solarTime"; value: GeoViewportSolarTimeSun } | { kind: "blend"; value: GeoViewportSunBlend }One sun rule. Exactly one kind is set.
Sunlight
The light a viewport’s view is lit by, as geo.viewport.get_sunlight reads it.
direction : MathVec3
The unit direction toward the light the rules gave on the last frame, in scene axes.
illuminance : number
Lux on a surface facing the light, before any air.
rules optional : Array<GeoViewportSunRule>
The rules the light follows. The first gives the light.
sun optional : SceneNode
The node the sun stands at.
SunlitExposureFloor
The floor sunlit ground in view puts under the exposure, so a sunlit crescent or disc does not burn out.
share : number
The share of the screen sunlit ground covers, from 0 to 1, from which the floor is the exposure for the most steeply lit point in view.
stopsPerHalving : number
How many stops the floor drops for each halving of the sunlit share under share.
ViewMeasure
Enum
How a blend measures how much of the body the view shows. Both measure as if the camera looked straight down at the place under it.
DiscSpan = 1
The share of the view’s height the body’s disc spans, above 1 where the disc overfills the
view. A flat map has no disc, so there the blend runs between the ground spans a flat map
shows from the heights at which the globe’s disc spans from and to.
GroundSpan = 0
How much ground the view’s height covers, in body radii. On the globe, the arc of ground the view’s height covers, or the whole cap the camera sees once the disc fits in the view; on the flat map, the view’s height at the ground over the body’s radius.
Morph = 2
How far the map the camera stands on is from the globe, at 0, toward the flat map, at 1.
The share keeps step with the morph, with no easing, so the light turns with the surface
through a switch between the globe and the flat map. from and to lie from 0 to 1.