Class MapHeightNodeShader

Map height node that uses GPU height calculation to generate the deformed plane mesh.

This solution is faster if no mesh interaction is required since all trasnformations are done in the GPU the transformed mesh cannot be accessed for CPU operations (e.g. raycasting).

Param

The parent node of this node.

Param

Map view object where this node is placed.

Param

Position in the node tree relative to the parent.

Param

Zoom level in the tile tree of the node.

Param

X position of the node in the tile tree.

Param

Y position of the node in the tile tree.

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

animations: AnimationClip[]

Array with animation clips.

Default

[]

castShadow: boolean

Gets rendered into shadow map.

Default

false

children: Object3D<Event>[]

Array with object's children.

Default

[]

childrenCache: Object3D<Event>[] = 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.

customDepthMaterial: Material

Custom depth material to be used when rendering to the depth map. Can only be used in context of meshes. When shadow-casting with a DirectionalLight or SpotLight, if you are (a) modifying vertex positions in the vertex shader, (b) using a displacement map, (c) using an alpha map with alphaTest, or (d) using a transparent texture with alphaTest, you must specify a customDepthMaterial for proper shadows.

customDistanceMaterial: Material

Same as customDepthMaterial, but used with PointLight.

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.

frustumCulled: boolean

When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object. If set to false the object gets rendered every frame even if it is not in the frustum of the camera.

Default

true

geometry: BufferGeometry
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.

id: number

Unique number of this object instance.

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.

isObject3D: true

Used to check whether this or derived classes are Object3Ds. Default is true. You should not change this, as it is used internally for optimisation.

layers: Layers

Default

new THREE.Layers()

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.

material: Material | Material[]
matrix: Matrix4

Local transform.

Default

new THREE.Matrix4()

matrixAutoUpdate: boolean

When this is set, it calculates the matrix of position, (rotation or quaternion) and scale every frame and also recalculates the matrixWorld property.

Default

THREE.Object3D.DefaultMatrixAutoUpdate

matrixWorld: Matrix4

The global transform of the object. If the Object3d has no parent, then it's identical to the local transform.

Default

new THREE.Matrix4()

matrixWorldAutoUpdate: boolean

When this is set, the renderer checks every frame if the object and its children need matrix updates. Otherwise, you have to maintain all matrices in the object and its children yourself.

Default

THREE.Object3D.DefaultMatrixWorldAutoUpdate

matrixWorldNeedsUpdate: boolean

When this is set, it calculates the matrixWorld in that frame and resets this property to false.

Default

false

modelViewMatrix: Matrix4

Default

new THREE.Matrix4()

morphTargetDictionary?: {
    [key: string]: number;
}

Type declaration

  • [key: string]: number
morphTargetInfluences?: number[]
name: string

Optional name of the object (doesn't need to be unique).

Default

''

nodesLoaded: number = 0

Indicates how many children nodes are loaded.

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

normalMatrix: Matrix3

Default

new THREE.Matrix3()

onAfterRender: ((renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Group) => void)

Type declaration

    • (renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Group): void
    • Calls after rendering object

      Parameters

      • renderer: WebGLRenderer
      • scene: Scene
      • camera: Camera
      • geometry: BufferGeometry
      • material: Material
      • group: Group

      Returns void

onBeforeRender: ((renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Group) => void)

Type declaration

    • (renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Group): void
    • Calls before rendering object

      Parameters

      • renderer: WebGLRenderer
      • scene: Scene
      • camera: Camera
      • geometry: BufferGeometry
      • material: Material
      • group: Group

      Returns void

parent: Object3D<Event>

Object's parent in the scene graph.

Default

null

parentNode: MapNode = null

Parent node (from an upper tile level).

position: Vector3

Object's local position.

Default

new THREE.Vector3()

quaternion: Quaternion

Object's local rotation as a Quaternion.

Default

new THREE.Quaternion()

receiveShadow: boolean

Material gets baked in shadow receiving.

Default

false

renderOrder: number

Overrides the default rendering order of scene graph objects, from lowest to highest renderOrder. Opaque and transparent objects remain sorted independently though. When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.

Default

0

rotation: Euler

Object's local rotation (Euler angles), in radians.

Default

new THREE.Euler()

scale: Vector3

Object's local scale.

Default

new THREE.Vector3()

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.

type: string
up: Vector3

Up direction.

Default

THREE.Object3D.DefaultUp.clone()

userData: {
    [key: string]: any;
}

An object that can be used to store custom data about the Object3d. It should not hold references to functions as these will not be cloned.

Default

Type declaration

  • [key: string]: any
uuid: string
visible: boolean

Object gets rendered if true.

Default

true

x: number

Tile x position.

y: number

Tile y position.

DefaultMatrixAutoUpdate: boolean
DefaultMatrixWorldAutoUpdate: boolean
DefaultUp: Vector3
baseGeometry: BufferGeometry = MapPlaneNode.geometry

Base geometry of the map node.

baseScale: Vector3 = ...

Base scale of the map node.

childrens: number = 4

How many children each branch of the tree has.

For a quad-tree this value is 4.

defaultHeightTexture: Texture = ...

Default height texture applied when tile load fails.

This tile sets the height to sea level where it is common for the data sources to be missing height data.

defaultTexture: Texture = ...

Default texture used when texture fails to load.

geometry: BufferGeometry = ...

Map node plane geometry.

geometrySize: number = 256

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

tileSize: number = 256

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

Methods

  • Adds a listener to an event type.

    Type Parameters

    • T extends string

    Parameters

    • type: T

      The type of event to listen to.

    • listener: EventListener<Event, T, MapHeightNodeShader>

      The function that gets called when the event is fired.

    Returns void

  • Applies the matrix transform to the object and updates the object's position, rotation and scale.

    Parameters

    • matrix: Matrix4

    Returns void

  • Adds object as a child of this, while maintaining the object's world transform.

    Parameters

    • object: Object3D<Event>

    Returns MapHeightNodeShader

  • Fire an event type.

    Parameters

    • event: Event

    Returns void

  • Searches through the object's children and returns the first with a matching id.

    Parameters

    • id: number

      Unique number of the object instance

    Returns Object3D<Event>

  • Searches through the object's children and returns the first with a matching name.

    Parameters

    • name: string

      String to match to the children's Object3d.name property.

    Returns Object3D<Event>

  • Parameters

    • name: string
    • value: any

    Returns Object3D<Event>

  • Parameters

    • target: Vector3

    Returns Vector3

  • Parameters

    • target: Vector3

    Returns Vector3

  • Parameters

    • target: Quaternion

    Returns Quaternion

  • Parameters

    • target: Vector3

    Returns Vector3

  • Checks if listener is added to an event type.

    Type Parameters

    • T extends string

    Parameters

    • type: T

      The type of event to listen to.

    • listener: EventListener<Event, T, MapHeightNodeShader>

      The function that gets called when the event is fired.

    Returns boolean

  • 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>

  • Updates the vector from local space to world space.

    Parameters

    • vector: Vector3

      A local vector.

    Returns Vector3

  • Optionally, the x, y and z components of the world space position. Rotates the object to face a point in world space. This method does not support objects having non-uniformly-scaled parent(s).

    Parameters

    • vector: Vector3

      A world vector to look at.

    Returns void

  • Parameters

    • x: number
    • y: number
    • z: number

    Returns void

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

    Switches the geometry for a simpler one for faster raycasting.

    Parameters

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

    Returns void

  • Removes a listener from an event type.

    Type Parameters

    • T extends string

    Parameters

    • type: T

      The type of the listener that gets removed.

    • listener: EventListener<Event, T, MapHeightNodeShader>

      The listener function that gets removed.

    Returns void

  • Rotate an object along an axis in object space. The axis is assumed to be normalized.

    Parameters

    • axis: Vector3

      A normalized vector in object space.

    • angle: number

      The angle in radians.

    Returns MapHeightNodeShader

  • Rotate an object along an axis in world space. The axis is assumed to be normalized. Method Assumes no rotated parent.

    Parameters

    • axis: Vector3

      A normalized vector in object space.

    • angle: number

      The angle in radians.

    Returns MapHeightNodeShader

  • axis -- A normalized vector in object space. angle -- angle in radians

    Parameters

    • axis: Vector3

      A normalized vector in object space.

    • angle: number

      angle in radians

    Returns void

  • Calls setRotationFromEuler(euler) on the .quaternion.

    Parameters

    • euler: Euler

      Euler angle specifying rotation amount.

    Returns void

  • Calls setFromRotationMatrix(m) on the .quaternion.

    Note that this assumes that the upper 3x3 of m is a pure rotation matrix (i.e, unscaled).

    Parameters

    • m: Matrix4

      rotate the quaternion by the rotation component of the matrix.

    Returns void

  • Copy the given quaternion into .quaternion.

    Parameters

    • q: Quaternion

      normalized Quaternion

    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

  • Parameters

    • Optional meta: {
          geometries: any;
          images: any;
          materials: any;
          textures: any;
      }
      • geometries: any
      • images: any
      • materials: any
      • textures: any

    Returns any

  • Translate an object by distance along an axis in object space. The axis is assumed to be normalized.

    Parameters

    • axis: Vector3

      A normalized vector in object space.

    • distance: number

      The distance to translate.

    Returns MapHeightNodeShader

  • Parameters

    • callback: ((object: Object3D<Event>) => any)
        • (object: Object3D<Event>): any
        • Parameters

          • object: Object3D<Event>

          Returns any

    Returns void

  • Parameters

    • callback: ((object: Object3D<Event>) => any)
        • (object: Object3D<Event>): any
        • Parameters

          • object: Object3D<Event>

          Returns any

    Returns void

  • Parameters

    • callback: ((object: Object3D<Event>) => any)
        • (object: Object3D<Event>): any
        • Parameters

          • object: Object3D<Event>

          Returns any

    Returns void

  • Updates local transform.

    Returns void

  • Updates global transform of the object and its children.

    Parameters

    • Optional force: boolean

    Returns void

  • Updates the global transform of the object.

    Parameters

    • updateParents: boolean

      recursively updates global transform of ancestors.

    • updateChildren: boolean

      recursively updates global transform of descendants.

    Returns void

  • Updates the vector from world space to local space.

    Parameters

    • vector: Vector3

      A world vector.

    Returns Vector3

  • Prepare the three.js material to be used in the map tile.

    Parameters

    • material: Material

      Material to be transformed.

    Returns Material

Generated using TypeDoc