@react-three/postprocessing 2.15.13 → 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/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
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|