All colors are now color objects

This commit is contained in:
Rezmason
2022-09-28 09:57:42 -07:00
parent 22dd5e8678
commit 3828203876
5 changed files with 58 additions and 46 deletions

View File

@@ -98,9 +98,9 @@ export default ({ config, device, timeBuffer }) => {
configBuffer = makeUniformBuffer(device, configUniforms, {
bloomStrength: config.bloomStrength,
ditherMagnitude: config.ditherMagnitude,
backgroundColor: config.backgroundColor,
cursorColor: config.cursorColor,
glintColor: config.glintColor,
backgroundColor: colorToRGB(config.backgroundColor),
cursorColor: colorToRGB(config.cursorColor),
glintColor: colorToRGB(config.glintColor),
});
const paletteUniforms = paletteShaderUniforms.Palette;

View File

@@ -1,3 +1,4 @@
import colorToRGB from "../colorToRGB.js";
import { structs } from "../../lib/gpu-buffer.js";
import { loadShader, make1DTexture, makeUniformBuffer, makeBindGroup, makeComputeTarget, makePass } from "./utils.js";
@@ -7,22 +8,22 @@ import { loadShader, make1DTexture, makeUniformBuffer, makeBindGroup, makeComput
// This shader introduces noise into the renders, to avoid banding
const transPrideStripeColors = [
[0.36, 0.81, 0.98],
[0.96, 0.66, 0.72],
[1.0, 1.0, 1.0],
[0.96, 0.66, 0.72],
[0.36, 0.81, 0.98],
{ space: "rgb", values: [0.36, 0.81, 0.98] },
{ space: "rgb", values: [0.96, 0.66, 0.72] },
{ space: "rgb", values: [1.0, 1.0, 1.0] },
{ space: "rgb", values: [0.96, 0.66, 0.72] },
{ space: "rgb", values: [0.36, 0.81, 0.98] },
]
.map((color) => Array(3).fill(color))
.flat(1);
const prideStripeColors = [
[0.89, 0.01, 0.01],
[1.0, 0.55, 0.0],
[1.0, 0.93, 0.0],
[0.0, 0.5, 0.15],
[0.0, 0.3, 1.0],
[0.46, 0.03, 0.53],
{ space: "rgb", values: [0.89, 0.01, 0.01] },
{ space: "rgb", values: [1.0, 0.55, 0.0] },
{ space: "rgb", values: [1.0, 0.93, 0.0] },
{ space: "rgb", values: [0.0, 0.5, 0.15] },
{ space: "rgb", values: [0.0, 0.3, 1.0] },
{ space: "rgb", values: [0.46, 0.03, 0.53] },
]
.map((color) => Array(2).fill(color))
.flat(1);
@@ -40,7 +41,7 @@ export default ({ config, device, timeBuffer }) => {
const stripeColors = "stripeColors" in config ? config.stripeColors : config.effect === "pride" ? prideStripeColors : transPrideStripeColors;
const stripeTex = make1DTexture(
device,
stripeColors.map((rgb) => [...rgb, 1])
stripeColors.map((color) => [...colorToRGB(color), 1])
);
const linearSampler = device.createSampler({
@@ -72,9 +73,9 @@ export default ({ config, device, timeBuffer }) => {
configBuffer = makeUniformBuffer(device, configUniforms, {
bloomStrength: config.bloomStrength,
ditherMagnitude: config.ditherMagnitude,
backgroundColor: config.backgroundColor,
cursorColor: config.cursorColor,
glintColor: config.glintColor,
backgroundColor: colorToRGB(config.backgroundColor),
cursorColor: colorToRGB(config.cursorColor),
glintColor: colorToRGB(config.glintColor),
});
})();