mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-18 14:19:30 -07:00
not bad for first time
This commit is contained in:
@@ -7,6 +7,7 @@ import makeStripePass from "./stripePass.js";
|
||||
import makeImagePass from "./imagePass.js";
|
||||
import makeResurrectionPass from "./resurrectionPass.js";
|
||||
import makeQuiltPass from "./quiltPass.js";
|
||||
import makeRipplesPass from "./ripplesPass.js";
|
||||
import getLKG from "./lkgHelper.js";
|
||||
|
||||
const effects = {
|
||||
@@ -20,6 +21,7 @@ const effects = {
|
||||
image: makeImagePass,
|
||||
resurrection: makeResurrectionPass,
|
||||
resurrections: makeResurrectionPass,
|
||||
ripples: makeRipplesPass,
|
||||
};
|
||||
|
||||
const dimensions = { width: 1, height: 1 };
|
||||
@@ -41,19 +43,19 @@ export default async (canvas, config) => {
|
||||
canvas.height = Math.ceil(canvas.clientHeight * config.resolution);
|
||||
};
|
||||
window.onresize = resize;
|
||||
if (document.fullscreenEnabled || document.webkitFullscreenEnabled) {
|
||||
window.onclick = () => {
|
||||
if (document.fullscreenElement == null) {
|
||||
if (canvas.webkitRequestFullscreen != null) {
|
||||
canvas.webkitRequestFullscreen();
|
||||
} else {
|
||||
canvas.requestFullscreen();
|
||||
}
|
||||
} else {
|
||||
document.exitFullscreen();
|
||||
}
|
||||
};
|
||||
}
|
||||
// if (document.fullscreenEnabled || document.webkitFullscreenEnabled) {
|
||||
// window.onclick = () => {
|
||||
// if (document.fullscreenElement == null) {
|
||||
// if (canvas.webkitRequestFullscreen != null) {
|
||||
// canvas.webkitRequestFullscreen();
|
||||
// } else {
|
||||
// canvas.requestFullscreen();
|
||||
// }
|
||||
// } else {
|
||||
// document.exitFullscreen();
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
resize();
|
||||
|
||||
const regl = createREGL({
|
||||
|
||||
35
js/regl/ripplesPass.js
Normal file
35
js/regl/ripplesPass.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import { loadImage, loadText, makePassFBO, makePass } from "./utils.js";
|
||||
|
||||
// Multiplies the rendered rain and bloom by a loaded in image
|
||||
|
||||
// const defaultBGURL = "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Flammarion_Colored.jpg/917px-Flammarion_Colored.jpg";
|
||||
|
||||
export default ({ regl, config }, inputs) => {
|
||||
console.log('ripples');
|
||||
|
||||
const output = makePassFBO(regl, config.useHalfFloat);
|
||||
// const bgURL = "bgURL" in config ? config.bgURL : defaultBGURL;
|
||||
// const bloomStrength = config.bloomStrength;
|
||||
// const background = loadImage(regl, bgURL);
|
||||
const ripplesPassFrag = loadText("shaders/glsl/ripplesPass.frag.glsl");
|
||||
const render = regl({
|
||||
frag: regl.prop("frag"),
|
||||
uniforms: {
|
||||
// bloomStrength,
|
||||
time: regl.context("time"),
|
||||
tex: inputs.primary,
|
||||
bloomTex: inputs.bloom,
|
||||
height: regl.context("viewportWidth"),
|
||||
width: regl.context("viewportHeight"),
|
||||
},
|
||||
framebuffer: output,
|
||||
});
|
||||
return makePass(
|
||||
{
|
||||
primary: output,
|
||||
},
|
||||
Promise.all([ripplesPassFrag.loaded]),
|
||||
(w, h) => output.resize(w, h),
|
||||
() => render({ frag: ripplesPassFrag.text() })
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user