TileProviderByLevel

Inherits TileProvider

This tile provider will switch between different tile providers specified within based on the level of detail that is requested by the Globe. All other things being equal, this corresponds to the distance of the camera to the planet, with a closer distance resulting in a higher lever. Due to technical reasons, the available levels are in the range [2, 22] and each increase in levels corresponds to a doubling in the effective resolution. For a given requested level, the tile provider that has the largest MaxLevel that is not greater than the requested level will be used.

Members

Name

Documentation

Type

Description

Optional

LayerGroupID

The layer needs to know about the LayerGroupID this but we don’t want it to be part of the parameters struct as that would mean it would be visible to the end user, which we don’t want since this value just comes from whoever creates it, not the user.

Integer

Value of type ‘Integer’

No

LevelTileProviders

The list of all tile providers that are used by this TileProviderByLevel.

Table

Table parameters

No

Table parameters for LevelTileProviders

The list of all tile providers that are used by this TileProviderByLevel.

  • Optional: No

Name

Documentation

Type

Description

Optional

*

Each collection describes a distinct layer which can be toggled at a specified max level at which it is requested.

Table

Table parameters

Yes

Table parameters for *

Each collection describes a distinct layer which can be toggled at a specified max level at which it is requested.

  • Optional: Yes

Name

Documentation

Type

Description

Optional

MaxLevel

The maximum level until which the tile provider is used. This number is inclusive, meaning that a value of 4 causes the tile provider to be used at level 4 but not at level 5.

Integer

Greater or equal to: 0

No

TileProvider

The tile provider that should be used at this stage.

Table

Layer

No

Asset Examples

Basic

This example file adds two layers to a globe. The first layer being used is showing a cloud layer and at higher levels a Blue Marble image is used instead. Recommended reading for this example is the documentation on the DefaultTileProvider.

 1-- Download some example images that we can use
 2local images = asset.resource({
 3  Name = "Earth Textures",
 4  Type = "HttpSynchronization",
 5  Identifier = "earth_textures",
 6  Version = 3
 7})
 8
 9-- Define the TileProvider
10local TileProvider = {
11  Identifier = "Example",
12  Type = "TileProviderByLevel",
13  Enabled = true,
14  LevelTileProviders = {
15    {
16      -- Show only a cloud layer for the first 3 layers (2, 3, 4)
17      MaxLevel = 4,
18      TileProvider = {
19        Identifier = "Blue_Marble_Clouds",
20        FilePath = images .. "earth_clouds.jpg"
21      }
22    },
23    {
24      -- Then transition fade into the Blue Marble image representation
25      MaxLevel = 22,
26      TileProvider = {
27        Identifier = "Blue_Marble",
28        FilePath = images .. "earth_bluemarble.jpg"
29      }
30    }
31  }
32}
33
34-- Define the scene graph node
35local Node = {
36  Identifier = "TileProviderByLevel_Example",
37  Renderable = {
38    Type = "RenderableGlobe",
39    Layers = {
40      -- The globe has exactly one layer, which is the one we defined above
41      ColorLayers = { TileProvider }
42    }
43  },
44  GUI = {
45    Name = "TileProviderByLevel - Basic",
46    Path = "/Examples"
47  }
48}
49
50asset.onInitialize(function()
51  openspace.addSceneGraphNode(Node)
52end)
53
54asset.onDeinitialize(function()
55  openspace.removeSceneGraphNode(Node)
56end)