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.
Contains the default values used for RuntimeSettings.
Contains the default values used for StartupSettings.
Compiles a new renderer instance. There can multiple renderers on a single page.
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]);