mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-21 07:19:30 -07:00
Renaming renderer to rainPass, renaming its shaders, and cleaning up the main code a little.
This commit is contained in:
13
js/main.js
13
js/main.js
@@ -1,6 +1,6 @@
|
|||||||
import { makeFullScreenQuad, makePipeline } from "./utils.js";
|
import { makeFullScreenQuad, makePipeline } from "./utils.js";
|
||||||
import makeConfig from "./config.js";
|
import makeConfig from "./config.js";
|
||||||
import makeMatrixRenderer from "./renderer.js";
|
import makeRain from "./rainPass.js";
|
||||||
import makeBloomPass from "./bloomPass.js";
|
import makeBloomPass from "./bloomPass.js";
|
||||||
import makePalettePass from "./palettePass.js";
|
import makePalettePass from "./palettePass.js";
|
||||||
import makeStripePass from "./stripePass.js";
|
import makeStripePass from "./stripePass.js";
|
||||||
@@ -49,12 +49,11 @@ const dimensions = { width: 1, height: 1 };
|
|||||||
document.body.onload = async () => {
|
document.body.onload = async () => {
|
||||||
// All this takes place in a full screen quad.
|
// All this takes place in a full screen quad.
|
||||||
const fullScreenQuad = makeFullScreenQuad(regl);
|
const fullScreenQuad = makeFullScreenQuad(regl);
|
||||||
const pipeline = makePipeline([makeMatrixRenderer, effect === "none" ? null : makeBloomPass, effects[effect]], (p) => p.outputs, regl, config);
|
|
||||||
const drawToScreen = regl({
|
const bloomPass = effect === "none" ? null : makeBloomPass;
|
||||||
uniforms: {
|
const pipeline = makePipeline([makeRain, bloomPass, effects[effect]], (p) => p.outputs, regl, config);
|
||||||
tex: pipeline[pipeline.length - 1].outputs.primary,
|
const uniforms = { tex: pipeline[pipeline.length - 1].outputs.primary };
|
||||||
},
|
const drawToScreen = regl({ uniforms });
|
||||||
});
|
|
||||||
await Promise.all(pipeline.map(({ ready }) => ready));
|
await Promise.all(pipeline.map(({ ready }) => ready));
|
||||||
const tick = regl.frame(({ viewportWidth, viewportHeight }) => {
|
const tick = regl.frame(({ viewportWidth, viewportHeight }) => {
|
||||||
// tick.cancel();
|
// tick.cancel();
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ export default (regl, config) => {
|
|||||||
|
|
||||||
const uniforms = {
|
const uniforms = {
|
||||||
...extractEntries(config, [
|
...extractEntries(config, [
|
||||||
// rain general
|
// general
|
||||||
"glyphHeightToWidth",
|
"glyphHeightToWidth",
|
||||||
"glyphTextureColumns",
|
"glyphTextureColumns",
|
||||||
// rain update
|
// compute
|
||||||
"animationSpeed",
|
"animationSpeed",
|
||||||
"brightnessMinimum",
|
"brightnessMinimum",
|
||||||
"brightnessMix",
|
"brightnessMix",
|
||||||
@@ -55,9 +55,9 @@ export default (regl, config) => {
|
|||||||
"rippleSpeed",
|
"rippleSpeed",
|
||||||
"rippleThickness",
|
"rippleThickness",
|
||||||
"resurrectingCodeRatio",
|
"resurrectingCodeRatio",
|
||||||
// rain render vertex
|
// render vertex
|
||||||
"forwardSpeed",
|
"forwardSpeed",
|
||||||
// rain render fragment
|
// render fragment
|
||||||
"glyphEdgeCrop",
|
"glyphEdgeCrop",
|
||||||
"isPolar",
|
"isPolar",
|
||||||
]),
|
]),
|
||||||
@@ -94,7 +94,7 @@ export default (regl, config) => {
|
|||||||
|
|
||||||
const output = makePassFBO(regl, config.useHalfFloat);
|
const output = makePassFBO(regl, config.useHalfFloat);
|
||||||
|
|
||||||
const updateFrag = loadText("../shaders/update.frag");
|
const updateFrag = loadText("../shaders/compute.frag");
|
||||||
const update = regl({
|
const update = regl({
|
||||||
frag: regl.prop("frag"),
|
frag: regl.prop("frag"),
|
||||||
uniforms: {
|
uniforms: {
|
||||||
@@ -114,8 +114,8 @@ export default (regl, config) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// We render the code into an FBO using MSDFs: https://github.com/Chlumsky/msdfgen
|
// We render the code into an FBO using MSDFs: https://github.com/Chlumsky/msdfgen
|
||||||
const renderVert = loadText("../shaders/render.vert");
|
const renderVert = loadText("../shaders/rain.vert");
|
||||||
const renderFrag = loadText("../shaders/render.frag");
|
const renderFrag = loadText("../shaders/rain.frag");
|
||||||
const render = regl({
|
const render = regl({
|
||||||
blend: {
|
blend: {
|
||||||
enable: true,
|
enable: true,
|
||||||
Reference in New Issue
Block a user