Class MapHeightNode

Represents a height map tile node that can be subdivided into other height nodes.

Its important to update match the height of the tile with the neighbors nodes edge heights to ensure proper continuity of the surface.

The height node is designed to use MapBox elevation tile encoded data as described in https://www.mapbox.com/help/access-elevation-data/

Hierarchy (view full)

Constructors

  • Map height node constructor.

    Parameters

    • parentNode: MapHeightNode = null

      The parent node of this node.

    • mapView: MapView = null

      Map view object where this node is placed.

    • location: number = QuadTreePosition.root

      Position in the node tree relative to the parent.

    • level: number = 0

      Zoom level in the tile tree of the node.

    • x: number = 0

      X position of the node in the tile tree.

    • y: number = 0

      Y position of the node in the tile tree.

    • geometry: BufferGeometry<NormalBufferAttributes> = MapHeightNode.geometry

      Geometry used to render this height node.

    • material: Material = ...

      Material used to render this height node.

    Returns MapHeightNode

Properties

childrenCache: Object3D<Object3DEventMap>[] = null

Cache with the children objects created from subdivision.

Used to avoid recreate object after simplification and subdivision.

The default value is null. Only used if "cacheTiles" is set to true.

disposed: boolean = false

Flag to indicate if the map node was disposed.

When a map node is disposed its resources are dealocated to save memory.

geometryNormals: boolean = false

If true the tiles will compute their normals.

geometrySize: number = 16

Size of the grid of the geometry displayed on the scene for each tile.

heightLoaded: boolean = false

Flag indicating if the tile height data was loaded.

isMesh: true = true

Flag to check if the node is a mesh by the renderer.

Used to toggle the visibility of the node. The renderer skips the node rendering if this is set false.

level: number

Tile level of this node.

location: number

Index of the map node in the quad-tree parent node.

Position in the tree parent, can be topLeft, topRight, bottomLeft or bottomRight.

mapView: MapView = null

The map view object where the node is placed.

nodesLoaded: number = 0

Indicates how many children nodes are loaded.

The child on become visible once all of them are loaded.

parentNode: MapNode = null

Parent node (from an upper tile level).

subdivided: boolean = false

Variable to check if the node is subdivided.

To avoid bad visibility changes on node load.

textureLoaded: boolean = false

Flag indicating if the tile texture was loaded.

x: number

Tile x position.

y: number

Tile y position.

baseGeometry: BufferGeometry<NormalBufferAttributes> = MapPlaneNode.geometry

Base geometry shared across all the nodes.

childrens: number = 4

How many children each branch of the tree has.

For a quad-tree this value is 4.

defaultTexture: Texture = ...

Default texture used when texture fails to load.

defaultTransparentTexture: Texture = ...
geometry: BufferGeometry<NormalBufferAttributes> = ...

Map node plane geometry.

tileSize: number = 256

Original tile size of the images retrieved from the height provider.

Methods

  • Create the child nodes to represent the next tree level.

    These nodes should be added to the object, and their transformations matrix should be updated.

    Returns void

  • Dispose the map node and its resources.

    Should cancel all pending processing for the node.

    Returns void

  • Initialize resources that require access to data from the MapView.

    Called automatically by the constructor for child nodes and MapView when a root node is attached to it.

    Returns Promise<void>

  • Load tile texture from the server.

    Aditionally in this height node it loads elevation data from the height provider and generate the appropiate maps.

    Returns Promise<void>

  • Load height texture from the server and create a geometry to match it.

    Returns Promise<any>

    Returns a promise indicating when the geometry generation has finished.

  • Increment the child loaded counter.

    Should be called after a map node is ready for display.

    Returns void

  • Overrides normal raycasting, to avoid raycasting when isMesh is set to false.

    Parameters

    • raycaster: Raycaster
    • intersects: Intersection<Object3D<Object3DEventMap>>[]

    Returns void

  • Simplify node, remove all children from node, store them in cache.

    Reset the subdivided flag and restore the visibility.

    This base method assumes that the node implementation is based off Mesh and that the isMesh property is used to toggle visibility.

    Returns void

  • Subdivide node,check the maximum depth allowed for the tile provider.

    Uses the createChildNodes() method to actually create the child nodes that represent the next tree level.

    Returns void