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 = LabelRenderPass.Sampling.Smooth1

Protected _aaStepScale

_aaStepScale: GLfloat

Protected _altered

_altered: ChangeLookup & object = Object.assign(new ChangeLookup(), {any: false,camera: false,geometry: false,labels: false,aaStepScale: false,aaSampling: false,})

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

Protected _camera

_camera: Camera
see

camera

Protected _context

_context: Context

Read-only access to the objects context, used to get context information and WebGL API access.

Protected _depthFunc

_depthFunc: GLenum
see

depthFunc

Protected _depthMask

_depthMask: boolean = false
see

depthMask

Protected _geometry

_geometry: LabelGeometry

Protected _labels

_labels: Label[] = new Array<Label>()

Protected _ndcOffset

_ndcOffset: GLfloat2 = [0.0, 0.0]
see

ndcOffset

Protected _program

_program: Program

Protected _ranges

_ranges: Object[] = new Array<GLsizei2>()

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

Protected _target

_target: Framebuffer
see

target

Protected _uAASampling

_uAASampling: WebGLUniformLocation | undefined

Protected _uAAStepScale

_uAAStepScale: WebGLUniformLocation | undefined

Protected _uColor

_uColor: WebGLUniformLocation | undefined

Protected _uDynamic

_uDynamic: WebGLUniformLocation | undefined

Protected _uNdcOffset

_uNdcOffset: WebGLUniformLocation | undefined

Protected _uTransform

_uTransform: WebGLUniformLocation | undefined

Protected _uViewProjection

_uViewProjection: WebGLUniformLocation | undefined

Protected _verticesPerLabel

_verticesPerLabel: (undefined | GlyphVertices)[] = new Array<GlyphVertices | undefined>()

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

Static Protected DEFAULT_AA_STEP_SCALE

DEFAULT_AA_STEP_SCALE: GLfloat = 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(): GLfloat
  • set aaStepScale(scale: GLfloat): 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 GLfloat

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

    Returns void

camera

  • set camera(camera: Camera): void

depthFunc

  • get depthFunc(): GLenum
  • set depthFunc(func: GLenum): 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

labels

  • get labels(): Array<Label>
  • set labels(labels: Array<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 Array<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 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.

    Returns void

Protected assertUninitialized

  • assertUninitialized(): undefined
  • 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.

    Returns undefined

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

    • Default value override: boolean = false

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

    Returns void

Static Protected assertInitializedFalse

Static Protected assertUninitializedFalse

Static assert_initialized

Static assert_uninitialized

Static initialize

  • 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

  • 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