@react-three/postprocessing 2.15.12 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/effects/DepthOfField.cjs +2 -2
- package/dist/effects/DepthOfField.cjs.map +1 -1
- package/dist/effects/DepthOfField.js +2 -2
- package/dist/effects/DepthOfField.js.map +1 -1
- package/dist/effects/Water.cjs +33 -0
- package/dist/effects/Water.cjs.map +1 -0
- package/dist/effects/Water.d.ts +15 -0
- package/dist/effects/Water.js +33 -0
- package/dist/effects/Water.js.map +1 -0
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -43,8 +43,8 @@ const DepthOfField = React.forwardRef(function DepthOfField2({
|
|
|
43
43
|
effect2.target = new THREE.Vector3();
|
|
44
44
|
if (depthTexture)
|
|
45
45
|
effect2.setDepthTexture(depthTexture.texture, depthTexture.packing);
|
|
46
|
-
const
|
|
47
|
-
|
|
46
|
+
const maskPass = effect2.maskPass;
|
|
47
|
+
maskPass.maskFunction = postprocessing.MaskFunction.MULTIPLY_RGB_SET_ALPHA;
|
|
48
48
|
return effect2;
|
|
49
49
|
}, [
|
|
50
50
|
camera,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DepthOfField.cjs","sources":["../../src/effects/DepthOfField.tsx"],"sourcesContent":["import { DepthOfFieldEffect, MaskFunction } from 'postprocessing'\nimport { Ref, forwardRef, useMemo, useEffect, useContext } from 'react'\nimport { ReactThreeFiber } from '@react-three/fiber'\nimport { type DepthPackingStrategies, type Texture, Vector3 } from 'three'\nimport { EffectComposerContext } from '../EffectComposer'\n\ntype DOFProps = ConstructorParameters<typeof DepthOfFieldEffect>[1] &\n Partial<{\n target: ReactThreeFiber.Vector3\n depthTexture: {\n texture: Texture\n // TODO: narrow to DepthPackingStrategies\n packing: number\n }\n // TODO: not used\n blur: number\n }>\n\nexport const DepthOfField = forwardRef(function DepthOfField(\n {\n blendFunction,\n worldFocusDistance,\n worldFocusRange,\n focusDistance,\n focusRange,\n focalLength,\n bokehScale,\n resolutionScale,\n resolutionX,\n resolutionY,\n width,\n height,\n target,\n depthTexture,\n ...props\n }: DOFProps,\n ref: Ref<DepthOfFieldEffect>\n) {\n const { camera } = useContext(EffectComposerContext)\n const autoFocus = target != null\n const effect = useMemo(() => {\n const effect = new DepthOfFieldEffect(camera, {\n blendFunction,\n worldFocusDistance,\n worldFocusRange,\n focusDistance,\n focusRange,\n focalLength,\n bokehScale,\n resolutionScale,\n resolutionX,\n resolutionY,\n width,\n height,\n })\n // Creating a target enables autofocus, R3F will set via props\n if (autoFocus) effect.target = new Vector3()\n // Depth texture for depth picking with optional packing strategy\n if (depthTexture) effect.setDepthTexture(depthTexture.texture, depthTexture.packing as DepthPackingStrategies)\n // Temporary fix that restores DOF 6.21.3 behavior, everything since then lets shapes leak through the blur\n const
|
|
1
|
+
{"version":3,"file":"DepthOfField.cjs","sources":["../../src/effects/DepthOfField.tsx"],"sourcesContent":["import { DepthOfFieldEffect, MaskFunction } from 'postprocessing'\nimport { Ref, forwardRef, useMemo, useEffect, useContext } from 'react'\nimport { ReactThreeFiber } from '@react-three/fiber'\nimport { type DepthPackingStrategies, type Texture, Vector3 } from 'three'\nimport { EffectComposerContext } from '../EffectComposer'\n\ntype DOFProps = ConstructorParameters<typeof DepthOfFieldEffect>[1] &\n Partial<{\n target: ReactThreeFiber.Vector3\n depthTexture: {\n texture: Texture\n // TODO: narrow to DepthPackingStrategies\n packing: number\n }\n // TODO: not used\n blur: number\n }>\n\nexport const DepthOfField = forwardRef(function DepthOfField(\n {\n blendFunction,\n worldFocusDistance,\n worldFocusRange,\n focusDistance,\n focusRange,\n focalLength,\n bokehScale,\n resolutionScale,\n resolutionX,\n resolutionY,\n width,\n height,\n target,\n depthTexture,\n ...props\n }: DOFProps,\n ref: Ref<DepthOfFieldEffect>\n) {\n const { camera } = useContext(EffectComposerContext)\n const autoFocus = target != null\n const effect = useMemo(() => {\n const effect = new DepthOfFieldEffect(camera, {\n blendFunction,\n worldFocusDistance,\n worldFocusRange,\n focusDistance,\n focusRange,\n focalLength,\n bokehScale,\n resolutionScale,\n resolutionX,\n resolutionY,\n width,\n height,\n })\n // Creating a target enables autofocus, R3F will set via props\n if (autoFocus) effect.target = new Vector3()\n // Depth texture for depth picking with optional packing strategy\n if (depthTexture) effect.setDepthTexture(depthTexture.texture, depthTexture.packing as DepthPackingStrategies)\n // Temporary fix that restores DOF 6.21.3 behavior, everything since then lets shapes leak through the blur\n const maskPass = (effect as any).maskPass\n maskPass.maskFunction = MaskFunction.MULTIPLY_RGB_SET_ALPHA\n return effect\n }, [\n camera,\n blendFunction,\n worldFocusDistance,\n worldFocusRange,\n focusDistance,\n focusRange,\n focalLength,\n bokehScale,\n resolutionScale,\n resolutionX,\n resolutionY,\n width,\n height,\n autoFocus,\n depthTexture,\n ])\n\n useEffect(() => {\n return () => {\n effect.dispose()\n }\n }, [effect])\n\n return <primitive {...props} ref={ref} object={effect} target={target} />\n})\n"],"names":["forwardRef","DepthOfField","useContext","EffectComposerContext","useMemo","effect","DepthOfFieldEffect","Vector3","MaskFunction","useEffect"],"mappings":";;;;;;;AAkBa,MAAA,eAAeA,MAAAA,WAAW,SAASC,cAC9C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,EAAE,OAAA,IAAWC,MAAA,WAAWC,eAAqB,qBAAA;AACnD,QAAM,YAAY,UAAU;AACtB,QAAA,SAASC,MAAAA,QAAQ,MAAM;AACrBC,UAAAA,UAAS,IAAIC,eAAA,mBAAmB,QAAQ;AAAA,MAC5C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACD;AAEG,QAAA;AAAWD,cAAO,SAAS,IAAIE,MAAAA;AAE/B,QAAA;AAAcF,cAAO,gBAAgB,aAAa,SAAS,aAAa,OAAiC;AAE7G,UAAM,WAAYA,QAAe;AACjC,aAAS,eAAeG,eAAa,aAAA;AAC9BH,WAAAA;AAAAA,EAAA,GACN;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAEDI,QAAAA,UAAU,MAAM;AACd,WAAO,MAAM;AACX,aAAO,QAAQ;AAAA,IAAA;AAAA,EACjB,GACC,CAAC,MAAM,CAAC;AAEX,wCAAQ,aAAW,EAAA,GAAG,OAAO,KAAU,QAAQ,QAAQ,OAAgB,CAAA;AACzE,CAAC;;"}
|
|
@@ -41,8 +41,8 @@ const DepthOfField = forwardRef(function DepthOfField2({
|
|
|
41
41
|
effect2.target = new Vector3();
|
|
42
42
|
if (depthTexture)
|
|
43
43
|
effect2.setDepthTexture(depthTexture.texture, depthTexture.packing);
|
|
44
|
-
const
|
|
45
|
-
|
|
44
|
+
const maskPass = effect2.maskPass;
|
|
45
|
+
maskPass.maskFunction = MaskFunction.MULTIPLY_RGB_SET_ALPHA;
|
|
46
46
|
return effect2;
|
|
47
47
|
}, [
|
|
48
48
|
camera,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DepthOfField.js","sources":["../../src/effects/DepthOfField.tsx"],"sourcesContent":["import { DepthOfFieldEffect, MaskFunction } from 'postprocessing'\nimport { Ref, forwardRef, useMemo, useEffect, useContext } from 'react'\nimport { ReactThreeFiber } from '@react-three/fiber'\nimport { type DepthPackingStrategies, type Texture, Vector3 } from 'three'\nimport { EffectComposerContext } from '../EffectComposer'\n\ntype DOFProps = ConstructorParameters<typeof DepthOfFieldEffect>[1] &\n Partial<{\n target: ReactThreeFiber.Vector3\n depthTexture: {\n texture: Texture\n // TODO: narrow to DepthPackingStrategies\n packing: number\n }\n // TODO: not used\n blur: number\n }>\n\nexport const DepthOfField = forwardRef(function DepthOfField(\n {\n blendFunction,\n worldFocusDistance,\n worldFocusRange,\n focusDistance,\n focusRange,\n focalLength,\n bokehScale,\n resolutionScale,\n resolutionX,\n resolutionY,\n width,\n height,\n target,\n depthTexture,\n ...props\n }: DOFProps,\n ref: Ref<DepthOfFieldEffect>\n) {\n const { camera } = useContext(EffectComposerContext)\n const autoFocus = target != null\n const effect = useMemo(() => {\n const effect = new DepthOfFieldEffect(camera, {\n blendFunction,\n worldFocusDistance,\n worldFocusRange,\n focusDistance,\n focusRange,\n focalLength,\n bokehScale,\n resolutionScale,\n resolutionX,\n resolutionY,\n width,\n height,\n })\n // Creating a target enables autofocus, R3F will set via props\n if (autoFocus) effect.target = new Vector3()\n // Depth texture for depth picking with optional packing strategy\n if (depthTexture) effect.setDepthTexture(depthTexture.texture, depthTexture.packing as DepthPackingStrategies)\n // Temporary fix that restores DOF 6.21.3 behavior, everything since then lets shapes leak through the blur\n const
|
|
1
|
+
{"version":3,"file":"DepthOfField.js","sources":["../../src/effects/DepthOfField.tsx"],"sourcesContent":["import { DepthOfFieldEffect, MaskFunction } from 'postprocessing'\nimport { Ref, forwardRef, useMemo, useEffect, useContext } from 'react'\nimport { ReactThreeFiber } from '@react-three/fiber'\nimport { type DepthPackingStrategies, type Texture, Vector3 } from 'three'\nimport { EffectComposerContext } from '../EffectComposer'\n\ntype DOFProps = ConstructorParameters<typeof DepthOfFieldEffect>[1] &\n Partial<{\n target: ReactThreeFiber.Vector3\n depthTexture: {\n texture: Texture\n // TODO: narrow to DepthPackingStrategies\n packing: number\n }\n // TODO: not used\n blur: number\n }>\n\nexport const DepthOfField = forwardRef(function DepthOfField(\n {\n blendFunction,\n worldFocusDistance,\n worldFocusRange,\n focusDistance,\n focusRange,\n focalLength,\n bokehScale,\n resolutionScale,\n resolutionX,\n resolutionY,\n width,\n height,\n target,\n depthTexture,\n ...props\n }: DOFProps,\n ref: Ref<DepthOfFieldEffect>\n) {\n const { camera } = useContext(EffectComposerContext)\n const autoFocus = target != null\n const effect = useMemo(() => {\n const effect = new DepthOfFieldEffect(camera, {\n blendFunction,\n worldFocusDistance,\n worldFocusRange,\n focusDistance,\n focusRange,\n focalLength,\n bokehScale,\n resolutionScale,\n resolutionX,\n resolutionY,\n width,\n height,\n })\n // Creating a target enables autofocus, R3F will set via props\n if (autoFocus) effect.target = new Vector3()\n // Depth texture for depth picking with optional packing strategy\n if (depthTexture) effect.setDepthTexture(depthTexture.texture, depthTexture.packing as DepthPackingStrategies)\n // Temporary fix that restores DOF 6.21.3 behavior, everything since then lets shapes leak through the blur\n const maskPass = (effect as any).maskPass\n maskPass.maskFunction = MaskFunction.MULTIPLY_RGB_SET_ALPHA\n return effect\n }, [\n camera,\n blendFunction,\n worldFocusDistance,\n worldFocusRange,\n focusDistance,\n focusRange,\n focalLength,\n bokehScale,\n resolutionScale,\n resolutionX,\n resolutionY,\n width,\n height,\n autoFocus,\n depthTexture,\n ])\n\n useEffect(() => {\n return () => {\n effect.dispose()\n }\n }, [effect])\n\n return <primitive {...props} ref={ref} object={effect} target={target} />\n})\n"],"names":["DepthOfField","effect"],"mappings":";;;;;AAkBa,MAAA,eAAe,WAAW,SAASA,cAC9C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,EAAE,OAAA,IAAW,WAAW,qBAAqB;AACnD,QAAM,YAAY,UAAU;AACtB,QAAA,SAAS,QAAQ,MAAM;AACrBC,UAAAA,UAAS,IAAI,mBAAmB,QAAQ;AAAA,MAC5C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACD;AAEG,QAAA;AAAWA,cAAO,SAAS,IAAI;AAE/B,QAAA;AAAcA,cAAO,gBAAgB,aAAa,SAAS,aAAa,OAAiC;AAE7G,UAAM,WAAYA,QAAe;AACjC,aAAS,eAAe,aAAa;AAC9BA,WAAAA;AAAAA,EAAA,GACN;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAED,YAAU,MAAM;AACd,WAAO,MAAM;AACX,aAAO,QAAQ;AAAA,IAAA;AAAA,EACjB,GACC,CAAC,MAAM,CAAC;AAEX,6BAAQ,aAAW,EAAA,GAAG,OAAO,KAAU,QAAQ,QAAQ,OAAgB,CAAA;AACzE,CAAC;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const THREE = require("three");
|
|
4
|
+
const postprocessing = require("postprocessing");
|
|
5
|
+
const util = require("../util.cjs");
|
|
6
|
+
const WaterShader = {
|
|
7
|
+
fragmentShader: `
|
|
8
|
+
uniform float factor;
|
|
9
|
+
void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
|
|
10
|
+
vec2 vUv = uv;
|
|
11
|
+
float frequency = 6.0 * factor;
|
|
12
|
+
float amplitude = 0.015 * factor;
|
|
13
|
+
float x = vUv.y * frequency + time * .7;
|
|
14
|
+
float y = vUv.x * frequency + time * .3;
|
|
15
|
+
vUv.x += cos(x+y) * amplitude * cos(y);
|
|
16
|
+
vUv.y += sin(x-y) * amplitude * cos(y);
|
|
17
|
+
vec4 rgba = texture2D(inputBuffer, vUv);
|
|
18
|
+
outputColor = rgba;
|
|
19
|
+
}`
|
|
20
|
+
};
|
|
21
|
+
class WaterEffectImpl extends postprocessing.Effect {
|
|
22
|
+
constructor({ blendFunction = postprocessing.BlendFunction.NORMAL, factor = 0 } = {}) {
|
|
23
|
+
super("WaterEffect", WaterShader.fragmentShader, {
|
|
24
|
+
blendFunction,
|
|
25
|
+
attributes: postprocessing.EffectAttribute.CONVOLUTION,
|
|
26
|
+
uniforms: /* @__PURE__ */ new Map([["factor", new THREE.Uniform(factor)]])
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const WaterEffect = util.wrapEffect(WaterEffectImpl, { blendFunction: postprocessing.BlendFunction.NORMAL });
|
|
31
|
+
exports.WaterEffect = WaterEffect;
|
|
32
|
+
exports.WaterEffectImpl = WaterEffectImpl;
|
|
33
|
+
//# sourceMappingURL=Water.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Water.cjs","sources":["../../src/effects/Water.tsx"],"sourcesContent":["import { Uniform } from 'three'\nimport { BlendFunction, Effect, EffectAttribute } from 'postprocessing'\nimport { wrapEffect } from '../util'\n\nconst WaterShader = {\n fragmentShader: `\n uniform float factor;\n void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {\n vec2 vUv = uv;\n float frequency = 6.0 * factor;\n float amplitude = 0.015 * factor;\n float x = vUv.y * frequency + time * .7; \n float y = vUv.x * frequency + time * .3;\n vUv.x += cos(x+y) * amplitude * cos(y);\n vUv.y += sin(x-y) * amplitude * cos(y);\n vec4 rgba = texture2D(inputBuffer, vUv);\n outputColor = rgba;\n }`\n}\n\nexport class WaterEffectImpl extends Effect {\n constructor({ blendFunction = BlendFunction.NORMAL, factor = 0 } = {}) {\n super('WaterEffect', WaterShader.fragmentShader, {\n blendFunction,\n attributes: EffectAttribute.CONVOLUTION,\n uniforms: new Map<string, Uniform<number | number[]>>([['factor', new Uniform(factor)]])\n })\n }\n}\n\nexport const WaterEffect = wrapEffect(WaterEffectImpl, { blendFunction: BlendFunction.NORMAL })\n"],"names":["Effect","BlendFunction","EffectAttribute","Uniform","wrapEffect"],"mappings":";;;;;AAIA,MAAM,cAAc;AAAA,EAClB,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAalB;AAEO,MAAM,wBAAwBA,eAAAA,OAAO;AAAA,EAC1C,YAAY,EAAE,gBAAgBC,eAAA,cAAc,QAAQ,SAAS,EAAM,IAAA,IAAI;AAC/D,UAAA,eAAe,YAAY,gBAAgB;AAAA,MAC/C;AAAA,MACA,YAAYC,eAAgB,gBAAA;AAAA,MAC5B,UAAc,oBAAA,IAAwC,CAAC,CAAC,UAAU,IAAIC,cAAQ,MAAM,CAAC,CAAC,CAAC;AAAA,IAAA,CACxF;AAAA,EACH;AACF;AAEO,MAAM,cAAcC,KAAW,WAAA,iBAAiB,EAAE,eAAeH,eAAAA,cAAc,OAAQ,CAAA;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BlendFunction, Effect } from 'postprocessing';
|
|
3
|
+
export declare class WaterEffectImpl extends Effect {
|
|
4
|
+
constructor({ blendFunction, factor }?: {
|
|
5
|
+
blendFunction?: BlendFunction | undefined;
|
|
6
|
+
factor?: number | undefined;
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export declare const WaterEffect: import("react").ForwardRefExoticComponent<Omit<import("@react-three/fiber").ExtendedColors<import("@react-three/fiber").Overwrite<Partial<WaterEffectImpl>, import("@react-three/fiber").NodeProps<WaterEffectImpl, typeof WaterEffectImpl>>> & {
|
|
10
|
+
blendFunction?: BlendFunction | undefined;
|
|
11
|
+
factor?: number | undefined;
|
|
12
|
+
} & {
|
|
13
|
+
blendFunction?: BlendFunction | undefined;
|
|
14
|
+
opacity?: number | undefined;
|
|
15
|
+
}, "ref"> & import("react").RefAttributes<typeof WaterEffectImpl>>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Uniform } from "three";
|
|
2
|
+
import { Effect, EffectAttribute, BlendFunction } from "postprocessing";
|
|
3
|
+
import { wrapEffect } from "../util.js";
|
|
4
|
+
const WaterShader = {
|
|
5
|
+
fragmentShader: `
|
|
6
|
+
uniform float factor;
|
|
7
|
+
void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
|
|
8
|
+
vec2 vUv = uv;
|
|
9
|
+
float frequency = 6.0 * factor;
|
|
10
|
+
float amplitude = 0.015 * factor;
|
|
11
|
+
float x = vUv.y * frequency + time * .7;
|
|
12
|
+
float y = vUv.x * frequency + time * .3;
|
|
13
|
+
vUv.x += cos(x+y) * amplitude * cos(y);
|
|
14
|
+
vUv.y += sin(x-y) * amplitude * cos(y);
|
|
15
|
+
vec4 rgba = texture2D(inputBuffer, vUv);
|
|
16
|
+
outputColor = rgba;
|
|
17
|
+
}`
|
|
18
|
+
};
|
|
19
|
+
class WaterEffectImpl extends Effect {
|
|
20
|
+
constructor({ blendFunction = BlendFunction.NORMAL, factor = 0 } = {}) {
|
|
21
|
+
super("WaterEffect", WaterShader.fragmentShader, {
|
|
22
|
+
blendFunction,
|
|
23
|
+
attributes: EffectAttribute.CONVOLUTION,
|
|
24
|
+
uniforms: /* @__PURE__ */ new Map([["factor", new Uniform(factor)]])
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const WaterEffect = wrapEffect(WaterEffectImpl, { blendFunction: BlendFunction.NORMAL });
|
|
29
|
+
export {
|
|
30
|
+
WaterEffect,
|
|
31
|
+
WaterEffectImpl
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=Water.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Water.js","sources":["../../src/effects/Water.tsx"],"sourcesContent":["import { Uniform } from 'three'\nimport { BlendFunction, Effect, EffectAttribute } from 'postprocessing'\nimport { wrapEffect } from '../util'\n\nconst WaterShader = {\n fragmentShader: `\n uniform float factor;\n void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {\n vec2 vUv = uv;\n float frequency = 6.0 * factor;\n float amplitude = 0.015 * factor;\n float x = vUv.y * frequency + time * .7; \n float y = vUv.x * frequency + time * .3;\n vUv.x += cos(x+y) * amplitude * cos(y);\n vUv.y += sin(x-y) * amplitude * cos(y);\n vec4 rgba = texture2D(inputBuffer, vUv);\n outputColor = rgba;\n }`\n}\n\nexport class WaterEffectImpl extends Effect {\n constructor({ blendFunction = BlendFunction.NORMAL, factor = 0 } = {}) {\n super('WaterEffect', WaterShader.fragmentShader, {\n blendFunction,\n attributes: EffectAttribute.CONVOLUTION,\n uniforms: new Map<string, Uniform<number | number[]>>([['factor', new Uniform(factor)]])\n })\n }\n}\n\nexport const WaterEffect = wrapEffect(WaterEffectImpl, { blendFunction: BlendFunction.NORMAL })\n"],"names":[],"mappings":";;;AAIA,MAAM,cAAc;AAAA,EAClB,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAalB;AAEO,MAAM,wBAAwB,OAAO;AAAA,EAC1C,YAAY,EAAE,gBAAgB,cAAc,QAAQ,SAAS,EAAM,IAAA,IAAI;AAC/D,UAAA,eAAe,YAAY,gBAAgB;AAAA,MAC/C;AAAA,MACA,YAAY,gBAAgB;AAAA,MAC5B,UAAc,oBAAA,IAAwC,CAAC,CAAC,UAAU,IAAI,QAAQ,MAAM,CAAC,CAAC,CAAC;AAAA,IAAA,CACxF;AAAA,EACH;AACF;AAEO,MAAM,cAAc,WAAW,iBAAiB,EAAE,eAAe,cAAc,OAAQ,CAAA;"}
|
package/dist/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ const LUT = require("./effects/LUT.cjs");
|
|
|
34
34
|
const TiltShift = require("./effects/TiltShift.cjs");
|
|
35
35
|
const TiltShift2 = require("./effects/TiltShift2.cjs");
|
|
36
36
|
const ASCII = require("./effects/ASCII.cjs");
|
|
37
|
+
const Water = require("./effects/Water.cjs");
|
|
37
38
|
const index = require("./effects/SSR/index.cjs");
|
|
38
39
|
const index$1 = require("./effects/N8AO/index.cjs");
|
|
39
40
|
exports.Select = Selection.Select;
|
|
@@ -77,6 +78,8 @@ exports.TiltShift = TiltShift.TiltShift;
|
|
|
77
78
|
exports.TiltShift2 = TiltShift2.TiltShift2;
|
|
78
79
|
exports.TiltShiftEffect = TiltShift2.TiltShiftEffect;
|
|
79
80
|
exports.ASCII = ASCII.ASCII;
|
|
81
|
+
exports.WaterEffect = Water.WaterEffect;
|
|
82
|
+
exports.WaterEffectImpl = Water.WaterEffectImpl;
|
|
80
83
|
exports.SSR = index.SSR;
|
|
81
84
|
exports.N8AO = index$1.N8AO;
|
|
82
85
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ import { LUT } from "./effects/LUT.js";
|
|
|
32
32
|
import { TiltShift } from "./effects/TiltShift.js";
|
|
33
33
|
import { TiltShift2, TiltShiftEffect } from "./effects/TiltShift2.js";
|
|
34
34
|
import { ASCII } from "./effects/ASCII.js";
|
|
35
|
+
import { WaterEffect, WaterEffectImpl } from "./effects/Water.js";
|
|
35
36
|
import { SSR } from "./effects/SSR/index.js";
|
|
36
37
|
import { N8AO } from "./effects/N8AO/index.js";
|
|
37
38
|
export {
|
|
@@ -74,6 +75,8 @@ export {
|
|
|
74
75
|
TiltShiftEffect,
|
|
75
76
|
ToneMapping,
|
|
76
77
|
Vignette,
|
|
78
|
+
WaterEffect,
|
|
79
|
+
WaterEffectImpl,
|
|
77
80
|
resolveRef,
|
|
78
81
|
selectionContext,
|
|
79
82
|
useVector2,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|