From 2ab818888b1cdb878550026038e885c03ca6637c Mon Sep 17 00:00:00 2001 From: ParticleG Date: Thu, 21 Nov 2024 00:07:32 +0800 Subject: [PATCH] - --- Zenitha | 2 +- assets/shader/focus.hlsl | 8 +++++++- assets/shader/fog.hlsl | 8 +++++++- assets/shader/gaussianBlur.hlsl | 14 ++++++++++++-- assets/shader/gaussianSharp.hlsl | 14 ++++++++++++-- conf.lua | 14 +++++++------- 6 files changed, 46 insertions(+), 14 deletions(-) diff --git a/Zenitha b/Zenitha index 8a7e079d..b730d25f 160000 --- a/Zenitha +++ b/Zenitha @@ -1 +1 @@ -Subproject commit 8a7e079de1ce79e61dd3625d5e5d6eb6d803e979 +Subproject commit b730d25f2bd1dc4c98d303a904d23b2b634b524f diff --git a/assets/shader/focus.hlsl b/assets/shader/focus.hlsl index 9bfa0552..1607e438 100644 --- a/assets/shader/focus.hlsl +++ b/assets/shader/focus.hlsl @@ -2,6 +2,8 @@ extern highp float time; +const float MAX_ITERATIONS = 100.0; + float hash(vec2 p) { float h = dot(p, vec2(127.1, 311.7)); @@ -33,8 +35,12 @@ float perlinNoise(vec2 p, float iteration) { float outValue = 0.0; - for (float i = 0.0; i < iteration; i += 1.0) + for (float i = 0.0; i < MAX_ITERATIONS; i += 1.0) { + 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 612a6428..2ed65e7c 100644 --- a/assets/shader/fog.hlsl +++ b/assets/shader/fog.hlsl @@ -2,6 +2,8 @@ extern highp float time; +const float MAX_ITERATIONS = 100.0; + float rand3d(vec3 co, float seed) { return sin(fract((sin(dot(co, vec3(30.233 * seed, 7.233 * seed, 20.2352 * seed)))) * 815150.5453) * 321.321); @@ -45,8 +47,12 @@ float Noise3d(vec3 pos, float size, float seed) float perlinNoise3d(vec3 pos, float size, float seed, float iteration) { float r = 0.0; - for (float i = 0.0; i < iteration; i++) + for (float i = 0.0; i < MAX_ITERATIONS; i++) { + 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 d539c63c..3933c1b5 100644 --- a/assets/shader/gaussianBlur.hlsl +++ b/assets/shader/gaussianBlur.hlsl @@ -3,12 +3,22 @@ extern float smpCount; // 10 extern float radius; // 0.026 +const float MAX_ITERATIONS = 100.0; + vec4 effect(vec4 color, sampler2D tex, vec2 texCoord, vec2 scrCoord) { vec4 res = vec4(0.0, 0.0, 0.0, 0.0); float weightSum = 0.0; - for (float x = 0.0; x < smpCount; x++) { - for (float y = 0.0; y < smpCount; y++) { + for (float x = 0.0; x < MAX_ITERATIONS; x++) { + if (x >= smpCount) + { + break; + } + for (float y = 0.0; y < MAX_ITERATIONS; y++) { + 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 2b7182e8..ed187e41 100644 --- a/assets/shader/gaussianSharp.hlsl +++ b/assets/shader/gaussianSharp.hlsl @@ -4,13 +4,23 @@ extern float smpCount; // 10 extern float radius; // 0.026 extern float intensity; // 1 +const float MAX_ITERATIONS = 100.0; + vec4 effect(vec4 color, sampler2D tex, vec2 texCoord, vec2 scrCoord) { vec4 normal = texture2D(tex, texCoord); vec4 res = vec4(0.0); float weightSum = 0.0; - for (float x = 0.0; x < smpCount; x++) { - for (float y = 0.0; y < smpCount; y++) { + for (float x = 0.0; x < MAX_ITERATIONS; x++) { + if (x >= smpCount) + { + break; + } + for (float y = 0.0; y < MAX_ITERATIONS; y++) { + 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/conf.lua b/conf.lua index 1075f50b..bb079914 100644 --- a/conf.lua +++ b/conf.lua @@ -7,13 +7,13 @@ function love.conf(t) local fs=love.filesystem fs.setIdentity(identity) - do -- Load grapgic settings from conf/settings - local fileData=fs.read('conf/settings') - if fileData then - msaa=tonumber(fileData:match('"msaa":(%d+)')) or 0 - portrait=mobile and fileData:find('"portrait":true') and true - end - end + -- do -- Load grapgic settings from conf/settings + -- local fileData=fs.read('conf/settings') + -- if fileData then + -- msaa=tonumber(fileData:match('"msaa":(%d+)')) or 0 + -- portrait=mobile and fileData:find('"portrait":true') and true + -- end + -- end t.identity='Techmino_Galaxy' -- Saving folder t.externalstorage=true -- Use external storage on Android