## Index

### Enumerations

- FilteringOptions
- WrapOptions

### Drawable Classes

- Circle
- CircleLight
- Droplet
- Flashlight
- MetaCircle
- RotatedRectangle

### Drawable Providing a noise texture is required for this drawable. Classes

- InvertedTunnel

### Other Classes

- Drawable

### Interfaces

- DrawableDescriptor
- Renderer
- RuntimeSettings
- StartupSettings
- TextureOptions

### Type aliases

- TextureWithOptions

### Drawable Functions

- PolygonFactory

### Other Functions

- compile
- renderNoise

### Object literals

- defaultRuntimeSettings
- defaultStartupSettings

## Type aliases

### TextureWithOptions

TextureWithOptions: { overrides: Partial<TextureOptions>; source: TexImageSource }

- Defined in graphics/graphics-library/texture/texture-options.ts:19

#### Type declaration

- ##### overrides: Partial<TextureOptions>

- ##### source: TexImageSource

## Drawable Functions

### Const PolygonFactory

- PolygonFactory(vertexCount: number): { constructor: any; descriptor: DrawableDescriptor }

- - Defined in drawables/shapes/polygon-factory.ts:9

  #### Parameters

  - ##### vertexCount: number

  #### Returns { constructor: any; descriptor: DrawableDescriptor }

  - ##### constructor: function

    - new __type(vertices: Array<vec2>): Drawable
    - - Defined in drawables/shapes/polygon-factory.ts:11

      #### Parameters

      - ##### vertices: Array<vec2>

      #### Returns Drawable

  - ##### descriptor: DrawableDescriptor

## Other Functions

### compile

- compile(canvas: HTMLCanvasElement, descriptors: Array<DrawableDescriptor>, settingsOverrides?: Partial<StartupSettings>): Promise<Renderer>

- - Defined in main.ts:54

  Compiles a new renderer instance. There can multiple renderers on a single page.

  > Asynchronous behaviour is required for parallel shader compiling. Trying to draw before the returned promise resolves, results in no action taken. Settings can be set before promise resolution and they will be applied later.

  The descriptors of every to-be-drawn objects are required before creating the renderer, allowing the compiler to only create the shaders that will actually be used.

  Example usage:

       import { compile, Circle, CircleLight } from 'sdf-2d';

       const canvas = document.querySelector('canvas');
       const renderer = await compile(canvas, [Circle.descriptor, CircleLight.descriptor]);

  #### Parameters

  - ##### canvas: HTMLCanvasElement

    The returned renderer will only be able to draw to this canvas.

  - ##### descriptors: Array<DrawableDescriptor>

    The descriptor of every single object (and light) that ever needs to be drawn by this renderer has to be given before compiling.

  - ##### Default value settingsOverrides: Partial<StartupSettings> = {}

    Sensible defaults are provided, but these can be overridden.

  #### Returns Promise<Renderer>

### Const renderNoise

- renderNoise(textureSize: vec2, scale: number, amplitude: number, ignoreWebGL2?: boolean): Promise<HTMLCanvasElement>

- - Defined in graphics/rendering/renderer/noise-renderer.ts:20

  Create a renderer, draw a (1D) noise texture with it, then destroy the used resources, while returning the generated texture in the form of a canvas.

  #### Parameters

  - ##### textureSize: vec2

    The resolution of the end result.

  - ##### scale: number

    A starting value can be 60

  - ##### amplitude: number

    A starting value can be 0.125

  - ##### Default value ignoreWebGL2: boolean = false

    Ignore WebGL2, even when its available.

  #### Returns Promise<HTMLCanvasElement>

## Object literals

### Const defaultRuntimeSettings

defaultRuntimeSettings: object

- Defined in graphics/rendering/settings/default-runtime-settings.ts:7

Contains the default values used for RuntimeSettings.

### ambientLight

ambientLight: vec3 = vec3.fromValues(0.25, 0.15, 0.25)

- Defined in graphics/rendering/settings/default-runtime-settings.ts:14

### backgroundColor

backgroundColor: vec4 = vec4.fromValues(1, 1, 1, 1)

- Defined in graphics/rendering/settings/default-runtime-settings.ts:12

### colorPalette

colorPalette: never[] = []

- Defined in graphics/rendering/settings/default-runtime-settings.ts:13

### enableHighDpiRendering

enableHighDpiRendering: false = false

- Defined in graphics/rendering/settings/default-runtime-settings.ts:8

### isWorldInverted

isWorldInverted: false = false

- Defined in graphics/rendering/settings/default-runtime-settings.ts:10

### lightCutoffDistance

lightCutoffDistance: number = 400

- Defined in graphics/rendering/settings/default-runtime-settings.ts:11

### textures

textures: {}

- Defined in graphics/rendering/settings/default-runtime-settings.ts:15

#### Type declaration

### tileMultiplier

tileMultiplier: number = 8

- Defined in graphics/rendering/settings/default-runtime-settings.ts:9

### Const defaultStartupSettings

defaultStartupSettings: object

- Defined in graphics/rendering/settings/default-startup-settings.ts:6

Contains the default values used for StartupSettings.

### enableStopwatch

enableStopwatch: false = false

- Defined in graphics/rendering/settings/default-startup-settings.ts:10

### ignoreWebGL2

ignoreWebGL2: false = false

- Defined in graphics/rendering/settings/default-startup-settings.ts:9

### paletteSize

paletteSize: number = 256

- Defined in graphics/rendering/settings/default-startup-settings.ts:8

### shadowTraceCount

shadowTraceCount: number = 16

- Defined in graphics/rendering/settings/default-startup-settings.ts:7