Skip to content

Commit

Permalink
fixing for init
Browse files Browse the repository at this point in the history
  • Loading branch information
patriciogonzalezvivo committed Nov 21, 2024
1 parent 5a2c9c6 commit e14e074
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions filter/kuwahara.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit e14e074

Please sign in to comment.