Comparing version 0.14.2 to 0.14.3
@@ -1,3 +0,9 @@ | ||
### 0.14.1 (2024-12-15) | ||
### 0.14.3 (2024-12-16) | ||
_New:_ | ||
- Added ability to use `u_mouse` as input to `turbulence` effect. | ||
### 0.14.2 (2024-12-15) | ||
_Fixed:_ | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "kampos", | ||
"version": "0.14.2", | ||
"version": "0.14.3", | ||
"description": "Tiny and fast effects compositor on WebGL", | ||
@@ -5,0 +5,0 @@ "registry": "https://registry.npmjs.org/", |
@@ -12,2 +12,3 @@ /** | ||
* @param {number} [params.time=0] initial time for controlling initial noise value. | ||
* @param {string} [params.input] how to define `turbulenceSeed`. Defaults to `turbulence.FRAGCOORD_XY_TIME`. | ||
* @returns {turbulenceEffect} | ||
@@ -24,2 +25,3 @@ * | ||
time = 0.0, | ||
input = INPUT_TYPES.FRAGCOORD_XY_TIME, | ||
}) { | ||
@@ -87,6 +89,6 @@ const { x: fx, y: fy } = frequency || { x: 0.0, y: 0.0 }; | ||
source: ` | ||
vec3 turbulenceSeed = vec3(gl_FragCoord.xy, u_time * 0.0001); | ||
${input || ''} | ||
float turbulenceValue = turbulence(turbulenceSeed, u_turbulenceFrequency, u_turbulenceOctaves, u_isFractal);`, | ||
main: ` | ||
${output || ''}` | ||
${output || ''}`, | ||
}, | ||
@@ -149,5 +151,19 @@ get frequency() { | ||
const INPUT_TYPES = { | ||
FRAGCOORD_XY_TIME: | ||
'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);', | ||
FRAGCOORD_XY_MOUSE_Z: | ||
'vec3 turbulenceSeed = vec3(gl_FragCoord.xy + u_mouse * u_resolution * vec2(-1.0, 1.0), gl_FragCoord.z);', | ||
}; | ||
turbulence.COLOR = OUTPUT_TYPES.COLOR; | ||
turbulence.ALPHA = OUTPUT_TYPES.ALPHA; | ||
turbulence.FRAGCOORD_XY_TIME = INPUT_TYPES.FRAGCOORD_XY_TIME; | ||
turbulence.FRAGCOORD_XYZ = INPUT_TYPES.FRAGCOORD_XYZ; | ||
turbulence.FRAGCOORD_XY_MOUSE_TIME = INPUT_TYPES.FRAGCOORD_XY_MOUSE_TIME; | ||
turbulence.FRAGCOORD_XY_MOUSE_Z = INPUT_TYPES.FRAGCOORD_XY_MOUSE_Z; | ||
export default turbulence; |
@@ -202,2 +202,6 @@ import * as core from './core.js'; | ||
if (source && !this.data.source) { | ||
this.data.source = source; | ||
} | ||
if (typeof shouldUpdate === 'boolean') { | ||
@@ -204,0 +208,0 @@ this.data.source.shouldUpdate = shouldUpdate; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
10544165
29926