three-text-geometry
    Preparing search index...

    Class TextGeometryAlpha

    The class that generates THREE.BufferGeometry from BMFont data.

    import * as THREE from 'three'
    import TextGeometry from 'three-text-geometry'

    const text: string = '.....text to layout.....'
    const option: TextGeometryOption = {
    font: font, // BMFont data
    }
    const geometry = new TextGeometry(text, option)
    const material = new THREE.MeshBasicMaterial({
    map: texture, // THREE.Texture data
    side: THREE.DoubleSide,
    transparent: true,
    color: 0x666666,
    })
    const mesh = new THREE.Mesh(geometry, material)

    TextGeometry

    Hierarchy

    • BufferGeometry
      • TextGeometry
    Index

    Constructors

    Properties

    attributes: Attributes

    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.

    {}

    boundingBox: null | Box3

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

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

    null

    boundingSphere: null | Sphere

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

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

    null

    drawRange: { count: number; start: number }

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

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

    { start: 0, count: Infinity }

    groups: GeometryGroup[]

    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.

    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.

    []

    id: number

    Unique number for this THREE.BufferGeometry | BufferGeometry instance.

    Expects a Integer

    index: null | 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.

    null

    indirect: null | IndirectStorageBufferAttribute
    isBufferGeometry: true

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

    This is a constant value

    true

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

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

    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.

    {}

    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.

    false

    name: string

    Optional name for this THREE.BufferGeometry | BufferGeometry instance.

    ''

    type: string

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

    Sub-classes will update this 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.

    {}

    uuid: string

    UUID of this object instance.

    This gets automatically assigned and shouldn't be edited.

    Accessors

    • get text(): string
      Alpha

      The text to layout.

      Returns string

      TextGeometry

    • set text(value: string): void
      Alpha

      Sets the text to layout.

      Parameters

      • value: string

        The text to layout.

      Returns void

    Methods

    • Alpha

      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, TextGeometry>

        The function that gets called when the event is fired.

      Returns void

    • Alpha

      Adds a group to this geometry

      Parameters

      • start: number
      • count: number
      • OptionalmaterialIndex: number

      Returns void

      the groups property for details.

    • Alpha

      Applies the matrix transform to the geometry.

      Parameters

      • matrix: Matrix4

      Returns this

    • Alpha

      Applies the rotation represented by the quaternion to the geometry.

      Parameters

      • quaternion: Quaternion

      Returns this

    • Alpha

      Center the geometry based on the bounding box.

      Returns this

    • Alpha

      Clears all groups.

      Returns void

    • Alpha

      Creates a clone of this BufferGeometry

      Returns this

    • Alpha

      The function that computes the bounding box of the geometry.

      Returns void

      TextGeometry

    • Alpha

      The function that computes the bounding sphere of the geometry.

      Returns void

      TextGeometry

    • Alpha

      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

      Returns void

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

    • Alpha

      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

    • Alpha

      The function to copy the source geometry.

      Parameters

      Returns this

      The copied geometry.

      TextGeometry

    • Alpha

      Deletes the attribute with the specified name.

      Parameters

      • name: string

      Returns this

    • Alpha

      Fire an event type.

      Type Parameters

      • T extends "dispose"

      Parameters

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

        The event that gets fired.

      Returns void

    • Alpha

      Frees the GPU-related resources allocated by this instance.

      Returns void

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

    • Alpha

      Returns the attribute with the specified name.

      Type Parameters

      • K extends string

      Parameters

      • name: K

      Returns BufferAttribute | InterleavedBufferAttribute

    • Alpha

      Return the .index buffer.

      Returns null | BufferAttribute

    • Alpha

      Returns null | IndirectStorageBufferAttribute

    • Alpha

      Returns true if the attribute with the specified name exists.

      Parameters

      • name: string

      Returns boolean

    • Alpha

      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, TextGeometry>

        The function that gets called when the event is fired.

      Returns boolean

    • Alpha

      Rotates the geometry to face a point in space.

      Parameters

      • vector: Vector3

        A world vector to look at.

      Returns this

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

    • Alpha

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

      Returns void

      This will correct lighting on the geometry surfaces.

    • Alpha

      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, TextGeometry>

        The listener function that gets removed.

      Returns void

    • Alpha

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

      Parameters

      • angle: number

        radians. Expects a Float

      Returns this

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

    • Alpha

      Rotate the geometry about the Y axis.

      Parameters

      • angle: number

        radians. Expects a Float

      Returns this

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

    • Alpha

      Rotate the geometry about the Z axis.

      Parameters

      • angle: number

        radians. Expects a Float

      Returns this

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

    • Alpha

      Scale the geometry data.

      Parameters

      • x: number

        Expects a Float

      • y: number

        Expects a Float

      • z: number

        Expects a Float

      Returns this

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

    • Alpha

      Sets an attribute to this geometry with the specified name.

      Type Parameters

      • K extends string

      Parameters

      • name: K
      • attribute: BufferAttribute | InterleavedBufferAttribute

      Returns this

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

    • Alpha

      Set the .drawRange property

      Parameters

      • start: number
      • count: number

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

      Returns void

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

    • Alpha

      Defines a geometry by creating a position attribute based on the given array of points. The array can hold instances of Vector2 or Vector3. When using two-dimensional data, the z coordinate for all vertices is set to 0.

      If the method is used with an existing position attribute, the vertex data are overwritten with the data from the array. The length of the array must match the vertex count.

      Parameters

      • points: Vector3[] | Vector2[]

      Returns this

    • Alpha

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

      Parameters

      • index: null | number[] | BufferAttribute

      Returns this

    • Alpha

      Parameters

      • indirect: null | IndirectStorageBufferAttribute

      Returns this

    • Alpha

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

      Returns BufferGeometryJSON

    • Alpha

      Return a non-index version of an indexed BufferGeometry.

      Returns BufferGeometry

    • Alpha

      Translate the geometry.

      Parameters

      • x: number

        Expects a Float

      • y: number

        Expects a Float

      • z: number

        Expects a Float

      Returns this

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