[orx-integral-image] Pad source image for npot inputs. Add demo

This commit is contained in:
Edwin Jakobs
2024-06-28 11:12:38 +02:00
parent ab04e6b001
commit b1f2984b3e
4 changed files with 133 additions and 84 deletions

View File

@@ -1,5 +1,3 @@
#version 330 core
uniform sampler2D tex0;
in vec2 v_texCoord0;
out vec4 o_color;
@@ -11,16 +9,18 @@ uniform vec2 passDirection;
void main() {
vec2 passOffset = vec2(pow(sampleCountBase, passIndex)) * (1.0/textureSize(tex0, 0)) * passDirection;
vec2 passOffset = vec2(
pow(float(sampleCountBase),
float(passIndex))) * (1.0 / vec2(textureSize(tex0, 0))
) * passDirection;
vec2 uv0 = v_texCoord0;
// uv0.y = 1.0 - uv0.y;
vec4 result = vec4(0.0);
for (int i = 0; i < sampleCount; ++i) {
vec2 readUV = v_texCoord0 - vec2(i *passOffset);
vec2 readUV = v_texCoord0 - vec2(float(i) * passOffset);
float factor = step(0.0, readUV.x) * step(0.0, readUV.y);
result += factor * texture(tex0, readUV);
}
o_color = result;
}