[orx-fx] Use the appropriate FilterNto1 interfaces

* Fix webgl 2 compatibility
 * Add LumaLaplacian, ACESTonemap, ReinhardTonemap, DirectionalHashBlur
This commit is contained in:
Edwin Jakobs
2022-12-28 13:57:27 +01:00
parent beb53bbde7
commit 750b5ef67e
87 changed files with 578 additions and 175 deletions

View File

@@ -16,7 +16,7 @@ void main() {
vec2 blockCoord = uv / blockSize + blockOffset;
ivec2 blockIndex = ivec2(blockCoord);
vec2 blockUV = mod(blockCoord - blockIndex, vec2(1.0));
vec2 blockUV = mod(blockCoord - vec2(blockIndex), vec2(1.0));
vec2 blockAspect = vec2(1.0);

View File

@@ -8,21 +8,19 @@ out vec4 o_color;
void main() {
vec2 uv = v_texCoord0;
vec2 ts = textureSize(tex0, 0);
vec2 ts = vec2(textureSize(tex0, 0));
vec2 step = 1.0 / ts;
float phi = radians(rotation);
float cp = cos(phi);
float sp = sin(phi);
mat2 rm = mat2(vec2(cp,sp), vec2(-sp,cp));
mat2 rm = mat2(vec2(cp, sp), vec2(-sp, cp));
float aspectRatio = ts.y / ts.x;
step.y /= aspectRatio;
step *= feather;
vec2 intensity = vec2(strength,
strength);
vec2 intensity = vec2(strength, strength);
vec2 coords = uv;
coords = (coords - 0.5) * 2.0;

View File

@@ -1,5 +1,5 @@
in vec2 v_texCoord0;
uniform sampler2D tex0; // input
uniform sampler2D tex0;// input
uniform float phase;
uniform float amplitude;
uniform float frequency;
@@ -11,7 +11,7 @@ float truncate(float x, int segments) {
if (segments == 0) {
return x;
} else {
return floor(x*segments) / segments;
return floor(x * float(segments)) / float(segments);
}
}

View File

@@ -9,17 +9,17 @@ uniform float distort;
out vec4 o_color;
void main() {
vec2 uv = v_texCoord0;
vec2 blockSize = vec2(1.0/columns, 1.0/rows);
vec2 blockSize = vec2(1.0 / float(columns), 1.0 / float(rows));
vec2 blockIndex = floor(uv / blockSize);
vec2 blockUV = mod(uv/blockSize, vec2(1.0));
vec2 blockUVC1 = (blockUV - vec2(0.5)) * 2.0;
vec2 blockCenter = (blockIndex+0.5) * blockSize;
vec2 blockCenter = (blockIndex + 0.5) * blockSize;
float ca = cos(radians(rotation));
float sa = sin(radians(rotation));
vec2 ts = textureSize(tex0, 0);
mat2 rm = mat2(1.0, 0.0, 0.0, ts.x/ts.y) * mat2(vec2(ca, sa), vec2(-sa, ca)) * mat2(1.0, 0.0, 0.0, ts.y/ts.x);
mat2 rm = mat2(1.0, 0.0, 0.0, ts.x / ts.y) * mat2(vec2(ca, sa), vec2(-sa, ca)) * mat2(1.0, 0.0, 0.0, ts.y / ts.x);
vec2 ruv = (uv - blockCenter);
vec2 luv;
luv.x = (1.0 - blockUVC1.y * blockUVC1.y * distort) * ruv.x;

View File

@@ -128,8 +128,8 @@ float snoise(vec3 v)
}
vec3 segment(vec3 t, int x, int y) {
float sx = x == 0? t.x : floor(t.x * x) / x;
float sy = y == 0? t.y : floor(t.y * y) / y;
float sx = x == 0? t.x : floor(t.x * float(x)) / float(x);
float sy = y == 0? t.y : floor(t.y * float(y)) / float(y);
return vec3(sx,sy, t.z);
}

View File

@@ -22,7 +22,7 @@ void main() {
float bias = 0.0;
float radius = logPolar? log(1.0 + length(uv)*(exp(1.0)-bias)) / log(1.0+(exp(1.0)-bias)*sqrt(0.5)) : (length(uv) / sqrt(0.5));
vec2 sourceUV = vec2(arg / (2*PI) + 0.5, radius);
vec2 sourceUV = vec2(arg / (2.0 * PI) + 0.5, radius);
#ifndef OR_GL_TEXTURE2D
vec4 result = texture(tex0, sourceUV);

View File

@@ -21,7 +21,7 @@ uniform bool logPolar;
void main() {
vec2 uv = v_texCoord0;
float arg = (uv.x-0.5) * 2 * PI;
float arg = (uv.x-0.5) * 2.0 * PI;
float radius = logPolar? (((exp(uv.y)-1.0) / (exp(1.0)-1.0))) : uv.y;
vec2 sourceUV = (radius * sqrt(0.5) * vec2(cos(arg), sin(arg)) + vec2(0.5));

View File

@@ -11,7 +11,7 @@ float truncate(float x, int segments) {
if (segments == 0) {
return x;
} else {
return floor(x*segments) / segments;
return floor(x * float(segments)) / float(segments);
}
}
@@ -23,7 +23,7 @@ void main() {
mat2 rm = mat2(cr, -sr, sr, cr);
vec2 ruv = rm * uv;
vec2 truv = vec2( truncate(ruv.x, xSegments), truncate(ruv.y, ySegments));
vec2 truv = vec2(truncate(ruv.x, xSegments), truncate(ruv.y, ySegments));
vec2 tuv = transpose(rm) * truv + vec2(0.5);
vec4 c = vec4(0.0);

View File

@@ -11,7 +11,7 @@ float truncate(float x, int segments) {
if (segments == 0) {
return x;
} else {
return floor(x*segments) / segments;
return floor(x * float(segments)) / float(segments);
}
}