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]);
The returned renderer will only be able to draw to this canvas.
The descriptor of every single object (and light) that ever needs to be drawn by this renderer has to be given before compiling.
Sensible defaults are provided, but these can be overridden.
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.
The resolution of the end result.
A starting value can be 60
A starting value can be 0.125
Ignore WebGL2, even when its available.
Contains the default values used for RuntimeSettings.
Contains the default values used for StartupSettings.