Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Renderer

The main interface through which rendering can be achieved.

Multiple renderers are permitted on a single page.

Hierarchy

  • Renderer

Index

Properties

Readonly canvasSize

canvasSize: vec2

Get the actual resolution of the canvas.

Readonly insights

insights: any
experimental

Debug information updated on each renderDrawables call. Its scheme is not yet defined. The main purpose of this is human debugging.

Readonly viewAreaSize

viewAreaSize: vec2

Get the viewArea size set by the last setViewArea.

By default, canvasSize is used for the view area size.

Methods

addDrawable

  • addDrawable<T>(drawable: T): void

autoscaleQuality

  • autoscaleQuality(deltaTime: DOMHighResTimeStamp): void
  • experimental

    Scale the render scale for both the canvas and the SDF memoization based on the current and historical FPS values.

    Parameters

    • deltaTime: DOMHighResTimeStamp

      since the last frame, in milliseconds.

    Returns void

destroy

  • destroy(): void
  • Let go of every GPU resource held by the renderer.

    It's up to the browser and driver whether these resources are actually freed. Nonetheless, when a renderer is no longer needed, this method should be called.

    Returns void

renderDrawables

  • renderDrawables(): void
  • Render every drawable added since the last renderDrawables call.

    Resizing of framebuffers and the canvas also takes effect when calling renderDrawables.

    Returns void

setRuntimeSettings

setViewArea

  • setViewArea(topLeft: vec2, size: vec2): void
  • Set the camera transformation.

    Parameters

    • topLeft: vec2

      top (!) left. By default, equals to [0, canvasHeight].

    • size: vec2

      need not be equal to the canvas size, though their aspect ratio should be the same to avoid stretching.

    Returns void