Renaming the data texture to "state" in the rain pass's render program

This commit is contained in:
Rezmason
2021-10-22 22:58:10 -07:00
parent 5c77e9b690
commit af44126926
3 changed files with 6 additions and 6 deletions

View File

@@ -135,7 +135,7 @@ export default (regl, config) => {
uniforms: { uniforms: {
...renderUniforms, ...renderUniforms,
lastState: doubleBuffer.front, state: doubleBuffer.front,
glyphTex: msdf.texture, glyphTex: msdf.texture,
camera: regl.prop("camera"), camera: regl.prop("camera"),

View File

@@ -4,7 +4,7 @@
#endif #endif
precision lowp float; precision lowp float;
uniform sampler2D lastState; uniform sampler2D state;
uniform float numColumns, numRows; uniform float numColumns, numRows;
uniform sampler2D glyphTex; uniform sampler2D glyphTex;
uniform float glyphHeightToWidth, glyphSequenceLength, glyphTextureColumns, glyphEdgeCrop; uniform float glyphHeightToWidth, glyphSequenceLength, glyphTextureColumns, glyphEdgeCrop;
@@ -42,7 +42,7 @@ void main() {
uv.y -= 0.5; uv.y -= 0.5;
float radius = length(uv); float radius = length(uv);
float angle = atan(uv.y, uv.x) / (2. * PI) + 0.5; float angle = atan(uv.y, uv.x) / (2. * PI) + 0.5;
uv = vec2(angle * 4. - 0.5, 1.5 - pow(radius, 0.5) * 1.5); uv = vec2(fract(angle * 4. - 0.5), 1.5 * (1. - sqrt(radius)));
} else { } else {
// Applies the slant and scales space so the viewport is fully covered // Applies the slant and scales space so the viewport is fully covered
uv = vec2( uv = vec2(
@@ -54,7 +54,7 @@ void main() {
} }
// Unpack the values from the data texture // Unpack the values from the data texture
vec4 glyph = volumetric ? vGlyph : texture2D(lastState, uv); vec4 glyph = volumetric ? vGlyph : texture2D(state, uv);
float brightness = glyph.r; float brightness = glyph.r;
float symbolIndex = getSymbolIndex(glyph.g); float symbolIndex = getSymbolIndex(glyph.g);
float quadDepth = glyph.b; float quadDepth = glyph.b;

View File

@@ -1,7 +1,7 @@
#define PI 3.14159265359 #define PI 3.14159265359
precision lowp float; precision lowp float;
attribute vec2 aPosition, aCorner; attribute vec2 aPosition, aCorner;
uniform sampler2D lastState; uniform sampler2D state;
uniform float density; uniform float density;
uniform vec2 quadSize; uniform vec2 quadSize;
uniform float glyphHeightToWidth, glyphVerticalSpacing; uniform float glyphHeightToWidth, glyphVerticalSpacing;
@@ -24,7 +24,7 @@ highp float rand( const in vec2 uv ) {
void main() { void main() {
vUV = (aPosition + aCorner) * quadSize; vUV = (aPosition + aCorner) * quadSize;
vGlyph = texture2D(lastState, aPosition * quadSize); vGlyph = texture2D(state, aPosition * quadSize);
// Calculate the world space position // Calculate the world space position
float quadDepth = 0.0; float quadDepth = 0.0;