A few color constants and wgsl methods to work with colors.

These are wgsl functions, not js functions. The function is enclosed in a js string constant, to be appended into the code to reference it in the string shader.

Source:
core/color.js, line 1

Members

staticconstantBLACK vec4f

BLACK color;

Source:
core/color.js, line 136
Example
import { BLACK } from 'points/color';

// wgsl string
${BLACK}
let value = BLACK * vec4f(.5);
js

staticconstantBLUE vec4f

BLUE color;

Source:
core/color.js, line 55
Example
import { BLUE } from 'points/color';

// wgsl string
${BLUE}
let value = BLUE * vec4f(.5);
js

staticconstantCYAN vec4f

CYAN color;

Source:
core/color.js, line 87
Example
import { CYAN } from 'points/color';

// wgsl string
${CYAN}
let value = CYAN * vec4f(.5);
js

staticconstantGREEN vec4f

GREEN color;

Source:
core/color.js, line 39
Example
import { GREEN } from 'points/color';

// wgsl string
${GREEN}
let value = GREEN * vec4f(.5);
js

staticconstantMAGENTA vec4f

MAGENTA color;

Source:
core/color.js, line 103
Example
import { MAGENTA } from 'points/color';

// wgsl string
${MAGENTA}
let value = MAGENTA * vec4f(.5);
js

staticconstantRED vec4f

RED color;

Source:
core/color.js, line 23
Example
import { RED } from 'points/color';

// wgsl string
${RED}
let value = RED * vec4f(.5);
js

staticconstantRGBAFromHSV string

Creates a rgba vec4f from an hsv color value

Source:
core/color.js, line 219
Example
import { RGBAFromHSV } from 'points/color';

// wgsl string
${RGBAFromHSV}
let value = RGBAFromHSV(h,s,v,n);
js

staticconstantWHITE vec4f

WHITE color;

Source:
core/color.js, line 119
Example
import { WHITE } from 'points/color';

// wgsl string
${WHITE}
let value = WHITE * vec4f(.5);
js

staticconstantYELLOW vec4f

YELLOW color;

Source:
core/color.js, line 71
Example
import { YELLOW } from 'points/color';

// wgsl string
${YELLOW}
let value = YELLOW * vec4f(.5);
js

staticconstantbloom String

Compute the FFT (Fast Fourier Transform)

Source:
core/color.js, line 246
Example
import { bloom } from 'points/color';

// wgsl string
${bloom}
let value = bloom(input, iterations, intensity);
js

staticconstantbrightness String

Returns the perceived brightness of a color by the eye.
// Standard
LuminanceA = (0.2126*R) + (0.7152*G) + (0.0722*B)

Source:
core/color.js, line 277
Example
import { brightness } from 'points/color';

// wgsl string
${brightness}
let value = brightness(rgba);
js

staticconstantbrightnessB String

Returns the perceived brightness of a color by the eye.
// Percieved A
LuminanceB = (0.299*R + 0.587*G + 0.114*B)

Source:
core/color.js, line 305
Example
import { brightnessB } from 'points/color';

// wgsl string
${brightnessB}
let value = brightnessB(rgba);
js

staticconstantbrightnessC String

Returns the perceived brightness of a color by the eye.
// Percieved B
slower to calculate
LuminanceC = sqrt(0.299*(R**2) + 0.587*(G**2) + 0.114*(B**2))

Source:
core/color.js, line 328
Example
import { brightnessC } from 'points/color';

// wgsl string
${brightnessC}
let value = brightnessC(rgba);
js

staticconstantlayer String

Layers two colors by cropping the color in the back, based on the alpha value.

Source:
core/color.js, line 161
Example
import { layer } from 'points/color';

// wgsl string
${layer}

let rgbaImage1 = texture(image1, imageSampler, uvr, true);
let rgbaImage2 = texture(image2, imageSampler, uvr, true);
let rgbaImage3 = texture(image3, imageSampler, uvr, true);

var finalColor:vec4f = layer(rgbaImage2, rgbaImage3);
finalColor = layer(rgbaImage1, finalColor);
js

staticconstantlayerPremultiplied String

Same as layer but with premultiplied alpha. The consideration here is that the back param already has the alpha applied. Layers two colors by cropping the color in the back, based on the alpha value.

Source:
core/color.js, line 195
Example
import { layerPremultiplied } from 'points/color';

// wgsl string
${layer}

let rgbaImage1 = texture(image1, imageSampler, uvr, true);
let rgbaImage2 = texture(image2, imageSampler, uvr, true);
let rgbaImage3 = texture(image3, imageSampler, uvr, true);

var finalColor:vec4f = layerPremultiplied(rgbaImage2, rgbaImage3);
finalColor = layerPremultiplied(rgbaImage1, finalColor);
js

MIT

Documentation generated by JSDoc 4.0.5 using Docolatte theme on