Return a color contained in a vec3.
Should be between 0 and 360
Should be between 0 and 100
Should be between 0 and 100
source: https://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion
Return a color contained in a vec3.
Should be between 0 and 1
Should be between 0 and 1
Should be between 0 and 1
Return a color contained in a vec3.
Should be between 0 and 255
Should be between 0 and 255
Should be between 0 and 255
Return a color with transparency contained in a vec4.
Should be between 0 and 1
Should be between 0 and 1
Should be between 0 and 1
Should be between 0 and 1
Return a color with transparency contained in a vec4.
Should be between 0 and 255
Should be between 0 and 255
Should be between 0 and 255
Should be between 0 and 255
Providing a noise texture is required for this drawable.
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, hsl, CircleFactory, CircleLight } from 'sdf-2d';
const canvas = document.querySelector('canvas');
const Circle = CircleFactory(hsl(30, 66, 50));
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 2D 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 15
A starting value can be 1
Ignore WebGL2, even when its available.
Contains the default values used for RuntimeSettings.
Contains the default values used for StartupSettings.
Return a color given in a hexadecimal form as a vec3.
A hexadecimal color with (#ff0000) or without (ff0000) a leading hashmark.
source: https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb