diff --git a/libs/webgl/utils/blend.js b/libs/webgl/utils/blend.js index ed3ccbc..fdb20ef 100644 --- a/libs/webgl/utils/blend.js +++ b/libs/webgl/utils/blend.js @@ -1,5 +1,5 @@ export const BLEND = { - NORMAL: ` + NORMAL: /* glsl */ ` vec3 blendNormal(vec3 base, vec3 blend) { return blend; } @@ -7,4 +7,17 @@ export const BLEND = { vec3 blendNormal(vec3 base, vec3 blend, float opacity) { return (blendNormal(base, blend) * opacity + base * (1.0 - opacity)); }`, + COLOR_DODGE: /* glsl */ ` + float blendColorDodge(float base, float blend) { + return (blend==1.0)?blend:min(base/(1.0-blend),1.0); + } + + vec3 blendColorDodge(vec3 base, vec3 blend) { + return vec3(blendColorDodge(base.r,blend.r),blendColorDodge(base.g,blend.g),blendColorDodge(base.b,blend.b)); + } + + vec3 blendColorDodge(vec3 base, vec3 blend, float opacity) { + return (blendColorDodge(base, blend) * opacity + base * (1.0 - opacity)); + } + `, } diff --git a/libs/webgl/utils/functions.js b/libs/webgl/utils/functions.js index 1071eb4..d059c00 100644 --- a/libs/webgl/utils/functions.js +++ b/libs/webgl/utils/functions.js @@ -1,13 +1,19 @@ export const FUNCTIONS = { - PI: `#define PI 3.14159265359`, - MAP_RANGE: ` + PI: /* glsl */ `#define PI 3.14159265359`, + MAP_RANGE: /* glsl */ ` float mapRange(float min1, float max1,float value, float min2, float max2) { return min2 + (value - min1) * (max2 - min2) / (max1 - min1); }`, - GREYSCALE: ` + GREYSCALE: /* glsl */ ` vec3 greyscale(vec3 color) { float average = (color.r + color.g + color.b) / 3.; return vec3(average); }`, + RANDOM: /* glsl */ ` + float random(vec2 st) { + return fract(sin(dot(st.xy, + vec2(12.9898,78.233)))* + 43758.5453123); + }`, } diff --git a/libs/webgl/utils/glsl.js b/libs/webgl/utils/glsl.js deleted file mode 100644 index ea964e6..0000000 --- a/libs/webgl/utils/glsl.js +++ /dev/null @@ -1,3 +0,0 @@ -const glsl = String.raw - -export default glsl diff --git a/package.json b/package.json index 644ccd3..55a5162 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@theatre/studio": "^0.7.2", "clsx": "^2.1.1", "gsap": "^3.12.5", - "lenis": "1.1.13", + "lenis": "1.1.14-dev.0", "next": "14.2.13", "postprocessing": "^6.36.2", "react": "18.3.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 17fe473..9ab336c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,8 +46,8 @@ importers: specifier: ^3.12.5 version: 3.12.5 lenis: - specifier: 1.1.13 - version: 1.1.13(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: 1.1.14-dev.0 + version: 1.1.14-dev.0(react@18.3.1) next: specifier: 14.2.13 version: 14.2.13(@babel/core@7.25.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.79.3) @@ -4311,15 +4311,15 @@ packages: resolution: {integrity: sha512-ApzyQnsa3t4YBdbI+nvGVXOuNTNP02Fh+haoDj4f/Sjjlo3S+19OmPdFtJAKcz1ziOL52iq1q3rTLIOtOXNDZg==} hasBin: true - lenis@1.1.13: - resolution: {integrity: sha512-iny+vWwUHcZGbJz+p2I75H1muLBRZqSG7t04jnhA+CWOQDFL1vt9bsZDwPPtYEmYVVvqAdo5MbXVFzNOlbgUkQ==} + lenis@1.1.14-dev.0: + resolution: {integrity: sha512-s0s68+Jr31eOV1FNLrlXRkZAELqhVfo3eR6RqpzGvCzoGg4MMvr646hfUpWiA1FQsSzgje5y6/GE2DhjnguiRA==} peerDependencies: react: '>=17.0.0' - react-dom: '>=17.0.0' + vue: '>=3.0.0' peerDependenciesMeta: react: optional: true - react-dom: + vue: optional: true levn@0.4.1: @@ -11139,12 +11139,11 @@ snapshots: lefthook-windows-arm64: 1.7.16 lefthook-windows-x64: 1.7.16 - lenis@1.1.13(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + lenis@1.1.14-dev.0(react@18.3.1): dependencies: '@darkroom.engineering/tempus': 0.0.46 optionalDependencies: react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) levn@0.4.1: dependencies: