Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LabelRenderPass

This class allows rendering of multiple dynamic as well as static labels. While preparing for frame, all label geometry is packed into single buffers for the GPU and drawing is done with as few draw calls as possible. The preparation tries to reduce state changes when labels of same color and same font are provided consecutively. It might be beneficial to not render labels of large static texts and some often changing dynamic texts using the same label render pass object. Often changing texts should be out into separate passed for better performance.

Hierarchy

Index

Constructors

constructor

Properties

Protected _aaSampling

_aaSampling: Sampling = ...

Protected _aaStepScale

_aaStepScale: number

Protected Readonly _altered

_altered: ChangeLookup & { aaSampling: boolean; aaStepScale: boolean; any: boolean; camera: boolean; geometry: boolean; labels: boolean } = ...

Alterable auxiliary object for tracking changes on render pass inputs and lazy updates.

Protected _camera

_camera: Camera
see

camera

Protected _context

_context: Context

Context, used to get context information and WebGL API access.

Protected _depthFunc

_depthFunc: number
see

depthFunc

Protected _depthMask

_depthMask: boolean = false
see

depthMask

Protected _geometry

_geometry: LabelGeometry

Protected _labels

_labels: Label[] = ...

Protected _ndcOffset

_ndcOffset: GLfloat2 = ...
see

ndcOffset

Protected _program

_program: Program

Protected _ranges

_ranges: GLsizei2[] = ...

Stores for each label (same index in _labels) the range within the geometry.

Protected _target

_target: Framebuffer
see

target

Protected _uAASampling

_uAASampling: undefined | WebGLUniformLocation

Protected _uAAStepScale

_uAAStepScale: undefined | WebGLUniformLocation

Protected _uColor

_uColor: undefined | WebGLUniformLocation

Protected _uDynamic

_uDynamic: undefined | WebGLUniformLocation

Protected _uNdcOffset

_uNdcOffset: undefined | WebGLUniformLocation

Protected _uTransform

_uTransform: undefined | WebGLUniformLocation

Protected _uViewProjection

_uViewProjection: undefined | WebGLUniformLocation

Protected _verticesPerLabel

_verticesPerLabel: (undefined | GlyphVertices)[] = ...

Stores typeset glyph vertices data per label and is used as cache to avoid unnecessary typesetting.

Protected assertInitialized

assertInitialized: () => void = ...

Asserts the objects initialization status to be true. Note that the implementation is cached and forwarded to either an empty function when initialized and to an acutal assert(false) otherwise.

Type declaration

    • (): void
    • Returns void

Protected assertUninitialized

assertUninitialized: () => void = ...

Asserts the objects initialization status to be false. Note that the implementation is cached and forwarded to either an empty function when uninitialized and to an acutal assert(false) otherwise.

Type declaration

    • (): void
    • Returns void

Static Protected Readonly DEFAULT_AA_STEP_SCALE

DEFAULT_AA_STEP_SCALE: number = 0.6666

Default AA step scale: more crisp text rendering (the value is optimized for multi-frame sampling).

Accessors

aaSampling

  • Specify the sampling pattern/mode (anti-aliasing / no anti-aliasing) for glyph rendering. The sampling should be increased when rendering small text, e.g., starting at font size of 16px or less. With larger text, there is no perceptual benefit with more than one derivative sample, i.e., LabelRenderPass.Sampling.Smooth1.

    Returns Sampling

  • Specify the sampling pattern/mode (anti-aliasing / no anti-aliasing) for glyph rendering. The sampling should be increased when rendering small text, e.g., starting at font size of 16px or less. With larger text, there is no perceptual benefit with more than one derivative sample, i.e., LabelRenderPass.Sampling.Smooth1.

    Parameters

    Returns void

aaStepScale

  • get aaStepScale(): number
  • set aaStepScale(scale: number): void
  • Allows to specify the basic AA step scale which is more of a hack to provide seemingly smoother (e.g., >= 1.0) or crisper (e.g., between 0.0 and 1.0) contours without specific multi sampling. Its just scaling the outcome of the derivatives.

    Returns number

  • Allows to specify the basic AA step scale which is more of a hack to provide seemingly smoother (e.g., >= 1.0) or crisper (e.g., between 0.0 and 1.0) contours without specific multi sampling. Its just scaling the outcome of the derivatives.

    Parameters

    • scale: number

    Returns void

camera

  • set camera(camera: Camera): void

depthFunc

  • get depthFunc(): number
  • set depthFunc(func: number): void

depthMask

  • get depthMask(): boolean
  • set depthMask(flag: boolean): void
  • Allows to restrict writing into the depth buffer. If the mask is set to true, labels might affect the depth buffer and apply fragment-based discard in order to reduce blank glyph areas to override depth values. If this mode is used, labels should be the last or one of the later rendering passes. If the mask is set to false, the common transparency/blending etc issues might occur when several labels overlap or other, e.g., transparent areas are rendered afterwards... However, if only labels of the same color can overlap and no other objects can interfere, this might be the better choice. By default, writing to the depth buffer is disabled (depth mask is false).

    Returns boolean

  • Allows to restrict writing into the depth buffer. If the mask is set to true, labels might affect the depth buffer and apply fragment-based discard in order to reduce blank glyph areas to override depth values. If this mode is used, labels should be the last or one of the later rendering passes. If the mask is set to false, the common transparency/blending etc issues might occur when several labels overlap or other, e.g., transparent areas are rendered afterwards... However, if only labels of the same color can overlap and no other objects can interfere, this might be the better choice. By default, writing to the depth buffer is disabled (depth mask is false).

    Parameters

    • flag: boolean

    Returns void

geometry

initialized

  • get initialized(): boolean
  • Property getter for readonly access to the initialization status of an initializable instance.

    Returns boolean

labels

  • get labels(): Label[]
  • set labels(labels: Label[]): void
  • Access to the labels that should be rendered. Note that label preparation is currently done per label-render pass instance, so drawing the same label with multiple renderers should be avoided. Label preparation will be invoked on update, iff the labels or the font face have changed.

    Returns Label[]

  • Access to the labels that should be rendered. Note that label preparation is currently done per label-render pass instance, so drawing the same label with multiple renderers should be avoided. Label preparation will be invoked on update, iff the labels or the font face have changed.

    Parameters

    Returns void

ndcOffset

  • The NDC offset is used for vertex displacement within subpixel space for anti-aliasing over multiple intermediate frames (multi-frame sampling).

    Parameters

    • offset: GLfloat2

      Subpixel offset used for vertex displacement (multi-frame anti-aliasing).

    Returns void

program

target

Methods

Protected draw

  • draw(): void

frame

  • frame(): void
  • This invokes draw calls on all labels. Thereby it aims to avoid unnecessary binds when texture or color does not change and accumulate draw calls as long as both remain unchanged. Further more, draw calls will be accumulated as much as possible (static labels only).

    Returns void

initialize

  • initialize(): boolean

Protected prepare

  • prepare(): void

unbind

  • unbind(): void

uninitialize

  • uninitialize(): void

update

  • update(override?: boolean): void
  • Parameters

    • override: boolean = false

      If enabled, everything will be updated, regardless of tracked alterations.

    Returns void

Static Protected Readonly assertInitializedFalse

Static Protected Readonly assertUninitializedFalse

Static assert_initialized

  • assert_initialized(): MethodDecorator

Static assert_uninitialized

  • assert_uninitialized(): MethodDecorator

Static discard

  • discard(): MethodDecorator
  • Method decorator for discarding of Initializable inheritors. This decorator asserts the initialization status of the instance that is to be discarded, invokes its uninitialization, and falsifies the initialization status. In order to encourage the use of assertInitialized and assertUninitialized they are dynamically bound to a static, always-failing assert and an empty/undefined function respectively.

    Returns MethodDecorator

Static initialize

  • initialize(): MethodDecorator
  • Method decorator for initialization of Initializable inheritors. This decorator asserts the initialization status of the instance that is to be initialized, invokes its initialization with arbitrary number of parameters, and sets the initialization status to the initialization success (either false or true). In order to encourage the use of assertInitialized and assertUninitialized they are dynamically bound to either a static, always-failing assert or an empty/undefined function.

    Returns MethodDecorator

Static uninitialize

  • uninitialize(): MethodDecorator
  • Method decorator for uninitialization of Initializable inheritors. This decorator asserts the initialization status of the instance that is to be uninitialized, invokes its uninitialization, and falsifies the initialization status. In order to encourage the use of assertInitialized and assertUninitialized they are dynamically bound to a static, always-failing assert and an empty/undefined function respectively.

    Returns MethodDecorator