Options
All
  • Public
  • Public/Protected
  • All
Menu

Procedural geometry that holds vertex attribute data for all glyphs in a TextCanvas.

Hierarchy

  • TextGeometry

Index

Constructors

constructor

  • new TextGeometry(scene: Scene, material: Material, backgroundMaterial: Material, initialSize: number, capacity: number): TextGeometry
  • Creates a new TextGeometry.

    Parameters

    • scene: Scene
    • material: Material

      Material used to render foreground glyphs.

    • backgroundMaterial: Material

      Material used to render background glyphs.

    • initialSize: number

      Initial amount of glyphs that can be stored.

    • capacity: number

      Maximum glyph capacity.

    Returns TextGeometry

    New TextGeometry.

Properties

Readonly capacity

capacity: number

Maximum glyph capacity.

Readonly scene

scene: Scene

Accessors

backgroundMesh

  • get backgroundMesh(): Mesh

drawCount

  • get drawCount(): number

mesh

  • get mesh(): Mesh

Methods

add

  • add(glyphData: GlyphData, corners: Vector3[], weight: number, bgWeight: number, mirrored: boolean, style: TextRenderStyle): boolean

addPickingData

  • addPickingData(startIdx: number, endIdx: number, pickingData: any): boolean
  • Adds picking data for glyphs from the specified start until the last glyph added.

    Parameters

    • startIdx: number

      First glyph index that this picking data is associated to.

    • endIdx: number

      Last glyph index that this picking data is associated to.

    • pickingData: any

      Picking data to be added.

    Returns boolean

addTextBufferObject

  • addTextBufferObject(textBufferObject: TextBufferObject, position?: THREE.Vector3, scale?: undefined | number, rotation?: undefined | number, color?: THREE.Color, opacity?: undefined | number, bgColor?: THREE.Color, bgOpacity?: undefined | number): boolean
  • Add a previously computed TextBufferObject to the TextGeometry. Extra parameters can be passed to override the passed attribute data.

    Parameters

    • textBufferObject: TextBufferObject

      TextBufferObject containing computed glyphs.

    • Optional position: THREE.Vector3

      Override position value.

    • Optional scale: undefined | number

      Override scale value.

    • Optional rotation: undefined | number

      Override rotation value.

    • Optional color: THREE.Color

      Override color value.

    • Optional opacity: undefined | number

      Override opacity value.

    • Optional bgColor: THREE.Color

      Override background color value.

    • Optional bgOpacity: undefined | number

      Override background opacity value.

    Returns boolean

    Result of the addition.

addToBuffer

  • addToBuffer(buffer: Float32Array, offset: number, glyphData: GlyphData, corners: Vector3[], weight: number, bgWeight: number, mirrored: boolean, style: TextRenderStyle): void
  • Add a new glyph to a text buffer.

    Parameters

    • buffer: Float32Array

      Target buffer where glyph attributes will be stored.

    • offset: number

      Offset of the target buffer.

    • glyphData: GlyphData

      GlyphData holding the glyph description.

    • corners: Vector3[]

      Transformed glyph corners.

    • weight: number

      Foreground glyph sampling weight.

    • bgWeight: number

      Foreground glyph sampling weight.

    • mirrored: boolean

      If true, UVs will be mirrored (needed for RTL punctuation).

    • style: TextRenderStyle

      Currently set TextRenderStyle.

    Returns void

clear

  • clear(): void

dispose

  • dispose(): void

pick

  • pick(screenPosition: Vector2, pickCallback: (pickData: any | undefined) => void): void
  • Fill the picking results for the pixel with the given screen coordinate. If multiple glyphs are found, the order of the results is unspecified.

    Parameters

    • screenPosition: Vector2

      Screen coordinate of picking position.

    • pickCallback: (pickData: any | undefined) => void

      Callback to be called for every picked element.

        • (pickData: any | undefined): void
        • Parameters

          • pickData: any | undefined

          Returns void

    Returns void

update

  • update(): void

updateMemoryUsage

Generated using TypeDoc