From 5902ecc6254ff574b5e8db0a7e57e8c3c157f7ea Mon Sep 17 00:00:00 2001 From: Rezmason Date: Wed, 20 Oct 2021 01:13:55 -0700 Subject: [PATCH] Renaming some variables --- js/imagePass.js | 10 +++++----- js/renderer.js | 6 +++--- js/utils.js | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/js/imagePass.js b/js/imagePass.js index cee672e..bb7e6fd 100644 --- a/js/imagePass.js +++ b/js/imagePass.js @@ -6,7 +6,7 @@ const defaultBGURL = export default (regl, config, inputs) => { const output = makePassFBO(regl, config.useHalfFloat); const bgURL = "bgURL" in config ? config.bgURL : defaultBGURL; - const bgLoader = loadImage(regl, bgURL); + const background = loadImage(regl, bgURL); return makePass( { primary: output @@ -16,23 +16,23 @@ export default (regl, config, inputs) => { precision mediump float; uniform sampler2D tex; uniform sampler2D bloomTex; - uniform sampler2D bgTex; + uniform sampler2D backgroundTex; varying vec2 vUV; void main() { - vec3 bgColor = texture2D(bgTex, vUV).rgb; + vec3 bgColor = texture2D(backgroundTex, vUV).rgb; float brightness = pow(min(1., texture2D(tex, vUV).r * 2.) + texture2D(bloomTex, vUV).r, 1.5); gl_FragColor = vec4(bgColor * brightness, 1.0); } `, uniforms: { - bgTex: bgLoader.texture, + backgroundTex: background.texture, tex: inputs.primary, bloomTex: inputs.bloom }, framebuffer: output }), null, - bgLoader.ready + background.loaded ); }; diff --git a/js/renderer.js b/js/renderer.js index 6af4dbf..b22f1ba 100644 --- a/js/renderer.js +++ b/js/renderer.js @@ -94,7 +94,7 @@ export default (regl, config) => { 1 / (Math.abs(Math.sin(2 * config.slant)) * (Math.sqrt(2) - 1) + 1); uniforms.showComputationTexture = config.effect === "none"; - const msdfLoader = loadImage(regl, config.glyphTexURL); + const msdf = loadImage(regl, config.glyphTexURL); // This shader is the star of the show. // In normal operation, each pixel represents a glyph's: @@ -455,7 +455,7 @@ export default (regl, config) => { ...uniforms, lastState: doubleBuffer.front, - glyphTex: msdfLoader.texture, + glyphTex: msdf.texture, camera: regl.prop("camera"), transform: regl.prop("transform"), @@ -501,6 +501,6 @@ export default (regl, config) => { glMatrix.mat4.perspective(camera, (Math.PI / 180) * 90, aspectRatio, 0.0001, 1000); [screenSize[0], screenSize[1]] = aspectRatio > 1 ? [1, aspectRatio] : [1 / aspectRatio, 1]; }, - msdfLoader.ready + msdf.loaded ); }; diff --git a/js/utils.js b/js/utils.js index b975613..519f7a9 100644 --- a/js/utils.js +++ b/js/utils.js @@ -78,7 +78,7 @@ const loadImage = (regl, url) => { } return texture; }, - ready: (async () => { + loaded: (async () => { if (url != null) { const data = new Image(); data.crossOrigin = "anonymous";