<<<<<<< HEAD ======= Renderer | SDF-2D - v0.7.6 >>>>>>> 2454f2f37d581c69f5d0c844a028712ddbc0a1cc

The main interface through which rendering can be achieved.

Multiple renderers are permitted on a single page.

### Hierarchy

- Renderer

## Index

### Properties

- canvasSize
- insights
- viewAreaSize

### Methods

- addDrawable
- destroy
- displayToWorldCoordinates
- renderDrawables
- setRuntimeSettings
- setViewArea
- worldToDisplayCoordinates

## Properties

### Readonly canvasSize

canvasSize: ReadonlyVec2

<<<<<<< HEAD
- Defined in graphics/rendering/renderer/renderer.ts:17
=======
- Defined in graphics/rendering/renderer/renderer.ts:17
>>>>>>> 2454f2f37d581c69f5d0c844a028712ddbc0a1cc

Get the actual resolution of the canvas without triggering a reflow.

A ResizeObserver is utilised fot achieving this.

### Readonly insights

insights: RendererInfo | null

<<<<<<< HEAD
- Defined in graphics/rendering/renderer/renderer.ts:96
=======
- Defined in graphics/rendering/renderer/renderer.ts:96
>>>>>>> 2454f2f37d581c69f5d0c844a028712ddbc0a1cc

Get useful information about the hardware and the SDF2D renderer.

Its scheme is subject to change.

During context lost it might be null.

### Readonly viewAreaSize

viewAreaSize: ReadonlyVec2

<<<<<<< HEAD
- Defined in graphics/rendering/renderer/renderer.ts:24
=======
- Defined in graphics/rendering/renderer/renderer.ts:24
>>>>>>> 2454f2f37d581c69f5d0c844a028712ddbc0a1cc

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

- <<<<<<< HEAD
  - Defined in graphics/rendering/renderer/renderer.ts:71
  =======
  - Defined in graphics/rendering/renderer/renderer.ts:71
  >>>>>>> 2454f2f37d581c69f5d0c844a028712ddbc0a1cc

  Schedule a drawable to be rendered during the next `renderDrawables` call.

  #### Type parameters

  - #### T: Drawable

  #### Parameters

  - ##### drawable: T

    Must be a subclass of drawable and its class must contain a static descriptor property of type DrawableDescriptor.

  #### Returns void

### destroy

- destroy(): void

- <<<<<<< HEAD
  - Defined in graphics/rendering/renderer/renderer.ts:87
  =======
  - Defined in graphics/rendering/renderer/renderer.ts:87
  >>>>>>> 2454f2f37d581c69f5d0c844a028712ddbc0a1cc

  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

### displayToWorldCoordinates

- displayToWorldCoordinates(displayCoordinates: ReadonlyVec2): vec2

- <<<<<<< HEAD
  - Defined in graphics/rendering/renderer/renderer.ts:46
  =======
  - Defined in graphics/rendering/renderer/renderer.ts:46
  >>>>>>> 2454f2f37d581c69f5d0c844a028712ddbc0a1cc

  The inverse of `worldToDisplayCoordinates`, returns the world coordinates from a pixel's position.

  The view area coordinates are also given in world coordinates.

  Useful for picking.

  #### Parameters

  - ##### displayCoordinates: ReadonlyVec2

    The origin is in the display's top left corner. Just as in mouse events' clientX and clientY.

  #### Returns vec2

### renderDrawables

- renderDrawables(): void

- <<<<<<< HEAD
  - Defined in graphics/rendering/renderer/renderer.ts:79
  =======
  - Defined in graphics/rendering/renderer/renderer.ts:79
  >>>>>>> 2454f2f37d581c69f5d0c844a028712ddbc0a1cc

  Render every drawable added since the last `renderDrawables` call.

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

  #### Returns void

### setRuntimeSettings

- setRuntimeSettings(overrides: Partial<RuntimeSettings>): void

- <<<<<<< HEAD
  - Defined in graphics/rendering/renderer/renderer.ts:63
  =======
  - Defined in graphics/rendering/renderer/renderer.ts:63
  >>>>>>> 2454f2f37d581c69f5d0c844a028712ddbc0a1cc

  Patch the current runtime settings with new values.

  #### Parameters

  - ##### overrides: Partial<RuntimeSettings>

  #### Returns void

### setViewArea

- setViewArea(topLeft: ReadonlyVec2, size: ReadonlyVec2): void

- <<<<<<< HEAD
  - Defined in graphics/rendering/renderer/renderer.ts:33
  =======
  - Defined in graphics/rendering/renderer/renderer.ts:33
  >>>>>>> 2454f2f37d581c69f5d0c844a028712ddbc0a1cc

  Set the camera transformation.

  #### Parameters

  - ##### topLeft: ReadonlyVec2

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

  - ##### size: ReadonlyVec2

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

  #### Returns void

### worldToDisplayCoordinates

- worldToDisplayCoordinates(worldCoordinates: ReadonlyVec2): vec2

- <<<<<<< HEAD
  - Defined in graphics/rendering/renderer/renderer.ts:57
  =======
  - Defined in graphics/rendering/renderer/renderer.ts:57
  >>>>>>> 2454f2f37d581c69f5d0c844a028712ddbc0a1cc

  The inverse of `displayToWorldCoordinates`, returns the screen space position of a point given in world space coordinates.

  While the origin for worldCoordinates resides in the bottom-left corner, the origin of the returned display coordinates is placed in the top left.

  #### Parameters

  - ##### worldCoordinates: ReadonlyVec2

    Coordinates used when drawing objects.

  #### Returns vec2