Class MapNodeGeometry

Map node geometry is a geometry used to represent the map nodes.

Consists of a XZ plane with normals facing +Y.

The geometry points start in XZ plane that can be manipulated for example for height adjustment.

Geometry can also include skirts to mask off missalignments between tiles.

Hierarchy

  • BufferGeometry
    • MapNodeGeometry

Constructors

  • Map node geometry constructor.

    Parameters

    • width: number = 1.0

      Width of the node.

    • height: number = 1.0

      Height of the node.

    • widthSegments: number = 1.0

      Number of subdivisions along the width.

    • heightSegments: number = 1.0

      Number of subdivisions along the height.

    • skirt: boolean = false

      Skirt around the plane to mask gaps between tiles.

    • skirtDepth: number = 10.0

    Returns MapNodeGeometry

Properties

attributes: NormalBufferAttributes

This hashmap has as id the name of the attribute to be set and as value the THREE.BufferAttribute | buffer to set it to. Rather than accessing this property directly, use .setAttribute and .getAttribute to access attributes of this geometry.

Default Value

{}

boundingBox: Box3

Bounding box for the THREE.BufferGeometry | BufferGeometry, which can be calculated with .computeBoundingBox().

Remarks

Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are null.

Default Value

null

boundingSphere: Sphere

Bounding sphere for the THREE.BufferGeometry | BufferGeometry, which can be calculated with .computeBoundingSphere().

Remarks

bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are null.

Default Value

null

drawRange: {
    count: number;
    start: number;
}

Determines the part of the geometry to render. This should not be set directly, instead use .setDrawRange(...).

Remarks

For non-indexed THREE.BufferGeometry | BufferGeometry, count is the number of vertices to render.

Default Value

{ start: 0, count: Infinity }

Type declaration

  • count: number
  • start: number
groups: {
    count: number;
    materialIndex?: number;
    start: number;
}[]

Split the geometry into groups, each of which will be rendered in a separate WebGL draw call. This allows an array of materials to be used with the geometry.

Remarks

Every vertex and index must belong to exactly one group — groups must not share vertices or indices, and must not leave vertices or indices unused.

Default Value

[]

id: number

Unique number for this THREE.BufferGeometry | BufferGeometry instance.

Remarks

Expects a Integer

index: BufferAttribute

Allows for vertices to be re-used across multiple triangles; this is called using "indexed triangles". Each triangle is associated with the indices of three vertices. This attribute therefore stores the index of each vertex for each triangular face. If this attribute is not set, the THREE.WebGLRenderer | renderer assumes that each three contiguous positions represent a single triangle.

Default Value

null

isBufferGeometry: true

Read-only flag to check if a given object is of type BufferGeometry.

Remarks

This is a constant value

Default Value

true

morphAttributes: {
    [name: string]: (BufferAttribute | InterleavedBufferAttribute)[];
}

Hashmap of THREE.BufferAttribute | BufferAttributes holding details of the geometry's morph targets.

Remarks

Once the geometry has been rendered, the morph attribute data cannot be changed. You will have to call .dispose(), and create a new instance of THREE.BufferGeometry | BufferGeometry.

Default Value

{}

Type declaration

  • [name: string]: (BufferAttribute | InterleavedBufferAttribute)[]
morphTargetsRelative: boolean

Used to control the morph target behavior; when set to true, the morph target data is treated as relative offsets, rather than as absolute positions/normals.

Default Value

false

name: string

Optional name for this THREE.BufferGeometry | BufferGeometry instance.

Default Value

''

type: string

A Read-only string to check if this object type.

Remarks

Sub-classes will update this value.

Default Value

BufferGeometry

userData: Record<string, any>

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

Default Value

{}

uuid: string

UUID of this object instance.

Remarks

This gets automatically assigned and shouldn't be edited.

Methods

  • Adds a listener to an event type.

    Type Parameters

    • T extends "dispose"

    Parameters

    • type: T

      The type of event to listen to.

    • listener: EventListener<{
          dispose: {};
      }[T], T, MapNodeGeometry>

      The function that gets called when the event is fired.

    Returns void

  • Type Parameters

    • T extends string

    Parameters

    Returns void

  • Adds a group to this geometry

    See

    the BufferGeometry.groups | groups property for details.

    Parameters

    • start: number
    • count: number
    • Optional materialIndex: number

    Returns void

  • Applies the matrix transform to the geometry.

    Parameters

    • matrix: Matrix4

    Returns MapNodeGeometry

  • Applies the rotation represented by the quaternion to the geometry.

    Parameters

    • quaternion: Quaternion

    Returns MapNodeGeometry

  • Center the geometry based on the bounding box.

    Returns MapNodeGeometry

  • Clears all groups.

    Returns void

  • Creates a clone of this BufferGeometry

    Returns MapNodeGeometry

  • Computes bounding box of the geometry, updating .boundingBox attribute.

    Remarks

    Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are null.

    Returns void

  • Computes bounding sphere of the geometry, updating .boundingSphere attribute.

    Remarks

    bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are null.

    Returns void

  • Calculates and adds a tangent attribute to this geometry. The computation is only supported for indexed geometries and if position, normal, and uv attributes are defined

    Remarks

    When using a tangent space normal map, prefer the MikkTSpace algorithm provided by BufferGeometryUtils.computeMikkTSpaceTangents instead.

    Returns void

  • Computes vertex normals for the given vertex data. For indexed geometries, the method sets each vertex normal to be the average of the face normals of the faces that share that vertex. For non-indexed geometries, vertices are not shared, and the method sets each vertex normal to be the same as the face normal.

    Returns void

  • Copies another BufferGeometry to this BufferGeometry.

    Parameters

    • source: BufferGeometry<NormalBufferAttributes>

    Returns MapNodeGeometry

  • Deletes the attribute with the specified name.

    Parameters

    • name: string

    Returns MapNodeGeometry

  • Fire an event type.

    Type Parameters

    • T extends "dispose"

    Parameters

    • event: BaseEvent<T> & {
          dispose: {};
      }[T]

      The event that gets fired.

    Returns void

  • Frees the GPU-related resources allocated by this instance.

    Remarks

    Call this method whenever this instance is no longer used in your app.

    Returns void

  • Returns the attribute with the specified name.

    Type Parameters

    • K extends string

    Parameters

    • name: K

    Returns BufferAttribute | InterleavedBufferAttribute

  • Return the .index buffer.

    Returns BufferAttribute

  • Returns true if the attribute with the specified name exists.

    Parameters

    • name: string

    Returns boolean

  • Checks if listener is added to an event type.

    Type Parameters

    • T extends "dispose"

    Parameters

    • type: T

      The type of event to listen to.

    • listener: EventListener<{
          dispose: {};
      }[T], T, MapNodeGeometry>

      The function that gets called when the event is fired.

    Returns boolean

  • Type Parameters

    • T extends string

    Parameters

    Returns boolean

  • Rotates the geometry to face a point in space.

    Remarks

    This is typically done as a one time operation, and not during a loop.

    Parameters

    • vector: Vector3

      A world vector to look at.

    Returns MapNodeGeometry

  • Every normal vector in a geometry will have a magnitude of 1

    Remarks

    This will correct lighting on the geometry surfaces.

    Returns void

  • Removes a listener from an event type.

    Type Parameters

    • T extends "dispose"

    Parameters

    • type: T

      The type of the listener that gets removed.

    • listener: EventListener<{
          dispose: {};
      }[T], T, MapNodeGeometry>

      The listener function that gets removed.

    Returns void

  • Type Parameters

    • T extends string

    Parameters

    Returns void

  • Rotate the geometry about the X axis. This is typically done as a one time operation, and not during a loop.

    Remarks

    Use THREE.Object3D.rotation | Object3D.rotation for typical real-time mesh rotation.

    Parameters

    • angle: number

      radians. Expects a Float

    Returns MapNodeGeometry

  • Rotate the geometry about the Y axis.

    Remarks

    This is typically done as a one time operation, and not during a loop.

    Parameters

    • angle: number

      radians. Expects a Float

    Returns MapNodeGeometry

  • Rotate the geometry about the Z axis.

    Remarks

    This is typically done as a one time operation, and not during a loop.

    Parameters

    • angle: number

      radians. Expects a Float

    Returns MapNodeGeometry

  • Scale the geometry data.

    Remarks

    This is typically done as a one time operation, and not during a loop.

    Parameters

    • x: number

      Expects a Float

    • y: number

      Expects a Float

    • z: number

      Expects a Float

    Returns MapNodeGeometry

  • Sets an attribute to this geometry with the specified name.

    Remarks

    Use this rather than the attributes property, because an internal hashmap of .attributes is maintained to speed up iterating over attributes.

    Type Parameters

    • K extends string

    Parameters

    • name: K
    • attribute: BufferAttribute | InterleavedBufferAttribute

    Returns MapNodeGeometry

  • Set the .drawRange property

    Remarks

    For non-indexed BufferGeometry, count is the number of vertices to render

    Parameters

    • start: number
    • count: number

      is the number of vertices or indices to render. Expects a Integer

    Returns void

  • Sets the attributes for this BufferGeometry from an array of points.

    Parameters

    • points: Vector3[] | Vector2[]

    Returns MapNodeGeometry

  • Set the THREE.BufferGeometry.index | .index buffer.

    Parameters

    • index: number[] | BufferAttribute

    Returns MapNodeGeometry

  • Convert the buffer geometry to three.js JSON Object/Scene format.

    Returns {}

    • Return a non-index version of an indexed BufferGeometry.

      Returns BufferGeometry<NormalBufferAttributes>

    • Translate the geometry.

      Remarks

      This is typically done as a one time operation, and not during a loop.

      Parameters

      • x: number

        Expects a Float

      • y: number

        Expects a Float

      • z: number

        Expects a Float

      Returns MapNodeGeometry

    • Parameters

      • width: number = 1.0
      • height: number = 1.0
      • widthSegments: number = 1.0
      • heightSegments: number = 1.0
      • indices: number[]
      • vertices: number[]
      • normals: number[]
      • uvs: number[]

      Returns void

    • Parameters

      • width: number = 1.0
      • height: number = 1.0
      • widthSegments: number = 1.0
      • heightSegments: number = 1.0
      • skirtDepth: number
      • indices: number[]
      • vertices: number[]
      • normals: number[]
      • uvs: number[]

      Returns void

    Generated using TypeDoc