From dd7d4015492ea84cd0acf9ccdecc8b37a00a7236 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Thu, 21 Nov 2024 02:01:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/shader/focus.hlsl | 5 +---- assets/shader/fog.hlsl | 5 +---- assets/shader/gaussianBlur.hlsl | 10 ++-------- assets/shader/gaussianSharp.hlsl | 10 ++-------- 4 files changed, 6 insertions(+), 24 deletions(-) diff --git a/assets/shader/focus.hlsl b/assets/shader/focus.hlsl index 1607e438..fb41a19f 100644 --- a/assets/shader/focus.hlsl +++ b/assets/shader/focus.hlsl @@ -37,10 +37,7 @@ float perlinNoise(vec2 p, float iteration) for (float i = 0.0; i < MAX_ITERATIONS; i += 1.0) { - if (i >= iteration) - { - break; - } + if (i >= iteration) break; float freq = pow(2.0, i); float Amp = 1.0 / freq; diff --git a/assets/shader/fog.hlsl b/assets/shader/fog.hlsl index 2ed65e7c..f0bc4b13 100644 --- a/assets/shader/fog.hlsl +++ b/assets/shader/fog.hlsl @@ -49,10 +49,7 @@ float perlinNoise3d(vec3 pos, float size, float seed, float iteration) float r = 0.0; for (float i = 0.0; i < MAX_ITERATIONS; i++) { - if (i >= iteration) - { - break; - } + if (i >= iteration) break; float freq = pow(2.0, i); r += Noise3d(pos, size * freq, seed) * (1.0 / freq); } diff --git a/assets/shader/gaussianBlur.hlsl b/assets/shader/gaussianBlur.hlsl index 3933c1b5..6dc67041 100644 --- a/assets/shader/gaussianBlur.hlsl +++ b/assets/shader/gaussianBlur.hlsl @@ -10,15 +10,9 @@ vec4 effect(vec4 color, sampler2D tex, vec2 texCoord, vec2 scrCoord) { float weightSum = 0.0; for (float x = 0.0; x < MAX_ITERATIONS; x++) { - if (x >= smpCount) - { - break; - } + if (x >= smpCount) break; for (float y = 0.0; y < MAX_ITERATIONS; y++) { - if (y >= smpCount) - { - break; - } + if (y >= smpCount) break; vec2 kuvCentered = vec2(x, y) / smpCount - 0.5; // uv coord within the kernel float bell = cos(length(kuvCentered) * 3.141592653589793) * 0.5 + 0.5; diff --git a/assets/shader/gaussianSharp.hlsl b/assets/shader/gaussianSharp.hlsl index ed187e41..0aec31d3 100644 --- a/assets/shader/gaussianSharp.hlsl +++ b/assets/shader/gaussianSharp.hlsl @@ -12,15 +12,9 @@ vec4 effect(vec4 color, sampler2D tex, vec2 texCoord, vec2 scrCoord) { float weightSum = 0.0; for (float x = 0.0; x < MAX_ITERATIONS; x++) { - if (x >= smpCount) - { - break; - } + if (x >= smpCount) break; for (float y = 0.0; y < MAX_ITERATIONS; y++) { - if (y >= smpCount) - { - break; - } + if (y >= smpCount) break; vec2 kuvCentered = vec2(x, y) / smpCount - 0.5; // uv coord within the kernel float bell = cos(length(kuvCentered) * 3.141592653589793) * 0.5 + 0.5;