From e14e0748b25b47462be696187e6a022b05b14f30 Mon Sep 17 00:00:00 2001 From: Patricio Gonzalez Vivo Date: Thu, 21 Nov 2024 11:02:38 -0500 Subject: [PATCH] fixing for init --- filter/kuwahara.glsl | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/filter/kuwahara.glsl b/filter/kuwahara.glsl index c945d7b6..6ee7c6af 100644 --- a/filter/kuwahara.glsl +++ b/filter/kuwahara.glsl @@ -30,39 +30,37 @@ KUWAHARA_TYPE kuwahara(in SAMPLER_TYPE tex, in vec2 st, in vec2 pixel, in float #endif float n = (KUWAHARA_RADIUS + 1.0) * (KUWAHARA_RADIUS + 1.0); - float i = 0.0; - float j = 0.0; KUWAHARA_TYPE m0 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE m1 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE m2 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE m3 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE s0 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE s1 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE s2 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE s3 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE rta = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE c = KUWAHARA_TYPE(0.0); - for (j = -KUWAHARA_RADIUS; j <= 0.0; ++j) { - for (i = -KUWAHARA_RADIUS; i <= 0.0; ++i) { + for (float j = -KUWAHARA_RADIUS; j <= 0.0; ++j) { + for (float i = -KUWAHARA_RADIUS; i <= 0.0; ++i) { c = KUWAHARA_SAMPLER_FNC(tex, st + vec2(i,j) * pixel); m0 += c; s0 += c * c; } } - for (j = -KUWAHARA_RADIUS; j <= 0.0; ++j) { - for (i = 0.0; i <= KUWAHARA_RADIUS; ++i) { + for (float j = -KUWAHARA_RADIUS; j <= 0.0; ++j) { + for (float i = 0.0; i <= KUWAHARA_RADIUS; ++i) { c = KUWAHARA_SAMPLER_FNC(tex, st + vec2(i,j) * pixel); m1 += c; s1 += c * c; } } - for (j = 0.0; j <= KUWAHARA_RADIUS; ++j) { - for (i = 0.0; i <= KUWAHARA_RADIUS; ++i) { + for (float j = 0.0; j <= KUWAHARA_RADIUS; ++j) { + for (float i = 0.0; i <= KUWAHARA_RADIUS; ++i) { c = KUWAHARA_SAMPLER_FNC(tex, st + vec2(i,j) * pixel); m2 += c; s2 += c * c; } } - for (j = 0.0; j <= KUWAHARA_RADIUS; ++j) { - for (i = -KUWAHARA_RADIUS; i <= 0.0; ++i) { + for (float j = 0.0; j <= KUWAHARA_RADIUS; ++j) { + for (float i = -KUWAHARA_RADIUS; i <= 0.0; ++i) { c = KUWAHARA_SAMPLER_FNC(tex, st + vec2(i,j) * pixel); m3 += c; s3 += c * c; @@ -127,22 +125,21 @@ KUWAHARA_TYPE kuwahara(in SAMPLER_TYPE tex, in vec2 st, in vec2 pixel, in float float n = (KUWAHARA_RADIUS + 1.0) * (KUWAHARA_RADIUS + 1.0); #endif - float i = 0.0; float j = 0.0; KUWAHARA_TYPE m0 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE m1 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE m2 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE m3 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE s0 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE s1 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE s2 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE s3 = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE rta = KUWAHARA_TYPE(0.0); KUWAHARA_TYPE c = KUWAHARA_TYPE(0.0); - for (j = -KUWAHARA_RADIUS; j <= 0.0; ++j) { - for (i = -KUWAHARA_RADIUS; i <= 0.0; ++i) { + for (float j = -KUWAHARA_RADIUS; j <= 0.0; ++j) { + for (float i = -KUWAHARA_RADIUS; i <= 0.0; ++i) { c = KUWAHARA_SAMPLER_FNC(tex, st + vec2(i,j) * pixel); m0 += c; s0 += c * c; } } - for (j = -KUWAHARA_RADIUS; j <= 0.0; ++j) { - for (i = 0.0; i <= KUWAHARA_RADIUS; ++i) { + for (float j = -KUWAHARA_RADIUS; j <= 0.0; ++j) { + for (float i = 0.0; i <= KUWAHARA_RADIUS; ++i) { #if defined(PLATFORM_WEBGL) if (i > radius) break; @@ -153,12 +150,12 @@ KUWAHARA_TYPE kuwahara(in SAMPLER_TYPE tex, in vec2 st, in vec2 pixel, in float } } - for (j = 0.0; j <= KUWAHARA_RADIUS; ++j) { + for (float j = 0.0; j <= KUWAHARA_RADIUS; ++j) { #if defined(PLATFORM_WEBGL) if (j > radius) break; #endif - for (i = 0.0; i <= KUWAHARA_RADIUS; ++i) { + for (float i = 0.0; i <= KUWAHARA_RADIUS; ++i) { #if defined(PLATFORM_WEBGL) if (i > radius) break; @@ -169,8 +166,8 @@ KUWAHARA_TYPE kuwahara(in SAMPLER_TYPE tex, in vec2 st, in vec2 pixel, in float } } - for (j = 0.0; j <= KUWAHARA_RADIUS; ++j) { - for (i = -KUWAHARA_RADIUS; i <= 0.0; ++i) { + for (float j = 0.0; j <= KUWAHARA_RADIUS; ++j) { + for (float i = -KUWAHARA_RADIUS; i <= 0.0; ++i) { c = KUWAHARA_SAMPLER_FNC(tex, st + vec2(i,j) * pixel); m3 += c; s3 += c * c;