mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-18 22:29:28 -07:00
Moving bloom strength math to the combine steps, and fixing a redundant multiply issue in the REGL based renderer
This commit is contained in:
@@ -7,13 +7,11 @@ const defaultBGURL = "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/
|
||||
export default ({ regl, config }, inputs) => {
|
||||
const output = makePassFBO(regl, config.useHalfFloat);
|
||||
const bgURL = "bgURL" in config ? config.bgURL : defaultBGURL;
|
||||
const bloomStrength = config.bloomStrength;
|
||||
const background = loadImage(regl, bgURL);
|
||||
const imagePassFrag = loadText("shaders/glsl/imagePass.frag.glsl");
|
||||
const render = regl({
|
||||
frag: regl.prop("frag"),
|
||||
uniforms: {
|
||||
bloomStrength,
|
||||
backgroundTex: background.texture,
|
||||
tex: inputs.primary,
|
||||
bloomTex: inputs.bloom,
|
||||
|
||||
@@ -57,7 +57,7 @@ const makePalette = (regl, entries) => {
|
||||
export default ({ regl, config }, inputs) => {
|
||||
const output = makePassFBO(regl, config.useHalfFloat);
|
||||
const paletteTex = makePalette(regl, config.palette);
|
||||
const { backgroundColor, cursorColor, glintColor, ditherMagnitude, bloomStrength } = config;
|
||||
const { backgroundColor, cursorColor, glintColor, ditherMagnitude } = config;
|
||||
|
||||
const palettePassFrag = loadText("shaders/glsl/palettePass.frag.glsl");
|
||||
|
||||
@@ -69,7 +69,6 @@ export default ({ regl, config }, inputs) => {
|
||||
cursorColor: colorToRGB(cursorColor),
|
||||
glintColor: colorToRGB(glintColor),
|
||||
ditherMagnitude,
|
||||
bloomStrength,
|
||||
tex: inputs.primary,
|
||||
bloomTex: inputs.bloom,
|
||||
paletteTex,
|
||||
|
||||
@@ -30,7 +30,7 @@ const prideStripeColors = [
|
||||
export default ({ regl, config }, inputs) => {
|
||||
const output = makePassFBO(regl, config.useHalfFloat);
|
||||
|
||||
const { backgroundColor, cursorColor, glintColor, ditherMagnitude, bloomStrength } = config;
|
||||
const { backgroundColor, cursorColor, glintColor, ditherMagnitude } = config;
|
||||
|
||||
// Expand and convert stripe colors into 1D texture data
|
||||
const stripeColors = "stripeColors" in config ? config.stripeColors : config.effect === "pride" ? prideStripeColors : transPrideStripeColors;
|
||||
@@ -49,7 +49,6 @@ export default ({ regl, config }, inputs) => {
|
||||
cursorColor: colorToRGB(cursorColor),
|
||||
glintColor: colorToRGB(glintColor),
|
||||
ditherMagnitude,
|
||||
bloomStrength,
|
||||
tex: inputs.primary,
|
||||
bloomTex: inputs.bloom,
|
||||
stripeTex,
|
||||
|
||||
@@ -20,7 +20,7 @@ const makePyramid = (device, size, pyramidHeight) =>
|
||||
.map((_, index) =>
|
||||
makeComputeTarget(
|
||||
device,
|
||||
size.map((x) => Math.floor(x * 2 ** -(index + 1)))
|
||||
size.map((x) => Math.floor(x * 2 ** -index))
|
||||
)
|
||||
);
|
||||
|
||||
@@ -97,7 +97,7 @@ export default ({ config, device }) => {
|
||||
vBlurBuffer = makeUniformBuffer(device, blurUniforms, { bloomRadius, direction: [0, 1] });
|
||||
|
||||
const combineUniforms = structs.from(combineShader.code).Config;
|
||||
combineBuffer = makeUniformBuffer(device, combineUniforms, { pyramidHeight });
|
||||
combineBuffer = makeUniformBuffer(device, combineUniforms, { pyramidHeight, bloomStrength });
|
||||
})();
|
||||
|
||||
const build = (screenSize, inputs) => {
|
||||
|
||||
@@ -35,7 +35,7 @@ export default ({ config, device }) => {
|
||||
});
|
||||
|
||||
const configUniforms = structs.from(imageShader.code).Config;
|
||||
configBuffer = makeUniformBuffer(device, configUniforms, { bloomStrength: config.bloomStrength });
|
||||
configBuffer = makeUniformBuffer(device, configUniforms, { unused: 0 });
|
||||
})();
|
||||
|
||||
const build = (size, inputs) => {
|
||||
|
||||
@@ -50,7 +50,7 @@ export default ({ config, device, cameraTex, cameraAspectRatio, timeBuffer }) =>
|
||||
const mirrorShaderUniforms = structs.from(mirrorShader.code);
|
||||
|
||||
const configUniforms = mirrorShaderUniforms.Config;
|
||||
configBuffer = makeUniformBuffer(device, configUniforms, { bloomStrength: config.bloomStrength });
|
||||
configBuffer = makeUniformBuffer(device, configUniforms, { unused: 0 });
|
||||
|
||||
sceneUniforms = mirrorShaderUniforms.Scene;
|
||||
sceneBuffer = makeUniformBuffer(device, sceneUniforms);
|
||||
|
||||
@@ -96,7 +96,6 @@ export default ({ config, device, timeBuffer }) => {
|
||||
const paletteShaderUniforms = structs.from(paletteShader.code);
|
||||
const configUniforms = paletteShaderUniforms.Config;
|
||||
configBuffer = makeUniformBuffer(device, configUniforms, {
|
||||
bloomStrength: config.bloomStrength,
|
||||
ditherMagnitude: config.ditherMagnitude,
|
||||
backgroundColor: colorToRGB(config.backgroundColor),
|
||||
cursorColor: colorToRGB(config.cursorColor),
|
||||
|
||||
@@ -71,7 +71,6 @@ export default ({ config, device, timeBuffer }) => {
|
||||
|
||||
const configUniforms = structs.from(stripeShader.code).Config;
|
||||
configBuffer = makeUniformBuffer(device, configUniforms, {
|
||||
bloomStrength: config.bloomStrength,
|
||||
ditherMagnitude: config.ditherMagnitude,
|
||||
backgroundColor: colorToRGB(config.backgroundColor),
|
||||
cursorColor: colorToRGB(config.cursorColor),
|
||||
|
||||
Reference in New Issue
Block a user