From 5b776884c474d391968ed775992404439c6ecf43 Mon Sep 17 00:00:00 2001 From: Yehonatan Daniv Date: Tue, 24 Dec 2024 20:45:33 +0200 Subject: [PATCH] Turbulence fix mouse direction (#64) * Fixed direction of mouse offset in turbulence * Updated CHANGELOG * 0.14.8 --- CHANGELOG.md | 6 ++++++ dist/index.cjs | 4 ++-- index.umd.js | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- src/effects/turbulence.js | 4 ++-- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3950dd..bf284c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### 0.14.8 (2024-12-24) + +_Fixed:_ + +- Fixed direction of `u_mouse` offsets in `turbulence` effect. + ### 0.14.7 (2024-12-19) _New:_ diff --git a/dist/index.cjs b/dist/index.cjs index 959bc9a..817ae7b 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -2059,9 +2059,9 @@ const INPUT_TYPES = { 'vec3 turbulenceSeed = vec3(gl_FragCoord.xy, u_time * 0.0001);', FRAGCOORD_XYZ: 'vec3 turbulenceSeed = vec3(gl_FragCoord.xyz);', FRAGCOORD_XY_MOUSE_TIME: - 'vec3 turbulenceSeed = vec3(gl_FragCoord.xy + u_mouse * u_resolution * vec2(-1.0, 1.0), u_time * 0.0001);', + 'vec3 turbulenceSeed = vec3(gl_FragCoord.xy - u_mouse * u_resolution, u_time * 0.0001);', FRAGCOORD_XY_MOUSE_Z: - 'vec3 turbulenceSeed = vec3(gl_FragCoord.xy + u_mouse * u_resolution * vec2(-1.0, 1.0), gl_FragCoord.z);', + 'vec3 turbulenceSeed = vec3(gl_FragCoord.xy - u_mouse * u_resolution, gl_FragCoord.z);', }; turbulence.COLOR = OUTPUT_TYPES.COLOR; diff --git a/index.umd.js b/index.umd.js index ff70784..4de0fcf 100644 --- a/index.umd.js +++ b/index.umd.js @@ -2063,9 +2063,9 @@ float turbulence (vec3 seed, vec2 frequency, int numOctaves, bool isFractal) { 'vec3 turbulenceSeed = vec3(gl_FragCoord.xy, u_time * 0.0001);', FRAGCOORD_XYZ: 'vec3 turbulenceSeed = vec3(gl_FragCoord.xyz);', FRAGCOORD_XY_MOUSE_TIME: - 'vec3 turbulenceSeed = vec3(gl_FragCoord.xy + u_mouse * u_resolution * vec2(-1.0, 1.0), u_time * 0.0001);', + 'vec3 turbulenceSeed = vec3(gl_FragCoord.xy - u_mouse * u_resolution, u_time * 0.0001);', FRAGCOORD_XY_MOUSE_Z: - 'vec3 turbulenceSeed = vec3(gl_FragCoord.xy + u_mouse * u_resolution * vec2(-1.0, 1.0), gl_FragCoord.z);', + 'vec3 turbulenceSeed = vec3(gl_FragCoord.xy - u_mouse * u_resolution, gl_FragCoord.z);', }; turbulence.COLOR = OUTPUT_TYPES.COLOR; diff --git a/package-lock.json b/package-lock.json index 49cc14c..57e6247 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "kampos", - "version": "0.14.7", + "version": "0.14.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "kampos", - "version": "0.14.7", + "version": "0.14.8", "license": "MIT", "devDependencies": { "@babel/core": "^7.26.0", diff --git a/package.json b/package.json index e59643a..aecdcfb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kampos", - "version": "0.14.7", + "version": "0.14.8", "description": "Tiny and fast effects compositor on WebGL", "registry": "https://registry.npmjs.org/", "main": "dist/index.cjs", diff --git a/src/effects/turbulence.js b/src/effects/turbulence.js index d10b1bc..602fd64 100644 --- a/src/effects/turbulence.js +++ b/src/effects/turbulence.js @@ -150,9 +150,9 @@ const INPUT_TYPES = { 'vec3 turbulenceSeed = vec3(gl_FragCoord.xy, u_time * 0.0001);', FRAGCOORD_XYZ: 'vec3 turbulenceSeed = vec3(gl_FragCoord.xyz);', FRAGCOORD_XY_MOUSE_TIME: - 'vec3 turbulenceSeed = vec3(gl_FragCoord.xy + u_mouse * u_resolution * vec2(-1.0, 1.0), u_time * 0.0001);', + 'vec3 turbulenceSeed = vec3(gl_FragCoord.xy - u_mouse * u_resolution, u_time * 0.0001);', FRAGCOORD_XY_MOUSE_Z: - 'vec3 turbulenceSeed = vec3(gl_FragCoord.xy + u_mouse * u_resolution * vec2(-1.0, 1.0), gl_FragCoord.z);', + 'vec3 turbulenceSeed = vec3(gl_FragCoord.xy - u_mouse * u_resolution, gl_FragCoord.z);', }; turbulence.COLOR = OUTPUT_TYPES.COLOR;