softbox 4.17.0 → 4.19.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/README.md +7 -6
- package/dist/{BrightnessContrastShader-BN6FBcLV.cjs → BrightnessContrastShader-C1jbh-NA.cjs} +2 -2
- package/dist/BrightnessContrastShader-CoM5EjqG.js +13 -0
- package/dist/CopyShader-C2Oc7n1P.js +12 -0
- package/dist/{CopyShader-DPSZNOxL.cjs → CopyShader-CM1OGKAp.cjs} +2 -2
- package/dist/EffectComposer-CMs4vldH.js +88 -0
- package/dist/EffectComposer-CdAQB6p0.cjs +1 -0
- package/dist/HueSaturationShader-BeHSjNY8.js +13 -0
- package/dist/{HueSaturationShader-BEp7jjxf.cjs → HueSaturationShader-bN5IWhh8.cjs} +2 -2
- package/dist/OutputPass-DicIJHut.cjs +72 -0
- package/dist/OutputPass-oQu4Xmeb.js +29 -0
- package/dist/Pass-CSHIrJrV.js +51 -0
- package/dist/Pass-D0vYi-gB.cjs +1 -0
- package/dist/RenderPass-DS8SYAhJ.js +16 -0
- package/dist/RenderPass-DlRq51Kq.cjs +1 -0
- package/dist/ShaderPass-DghZ7TAj.cjs +1 -0
- package/dist/ShaderPass-h4P0lBmc.js +22 -0
- package/dist/{ThreePathTracingService-DvBQToys.cjs → ThreePathTracingService-CMw8SvGp.cjs} +97 -97
- package/dist/ThreePathTracingService-Dze7maGx.js +2546 -0
- package/dist/UnrealBloomPass-BTHiW_Y8.js +123 -0
- package/dist/UnrealBloomPass-CQHHa-s_.cjs +115 -0
- package/dist/VignetteShader-CPF_iEkO.js +13 -0
- package/dist/{VignetteShader-Drpo9YxI.cjs → VignetteShader-CQmGrpns.cjs} +2 -2
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/simple-viewer.cjs +23 -1
- package/dist/simple-viewer.es.js +8492 -11
- package/dist/unwrap-CuSMMFPQ.cjs +2 -0
- package/dist/unwrap-DdgS2iXe.js +2087 -0
- package/package.json +30 -18
- package/dist/BrightnessContrastShader-B9tNAd_c.js +0 -49
- package/dist/CopyShader-DVL8Bcar.js +0 -41
- package/dist/EffectComposer-BdHnHszK.js +0 -188
- package/dist/EffectComposer-D2IQ0sek.cjs +0 -1
- package/dist/HueSaturationShader-B6tnz2ga.js +0 -60
- package/dist/OutputPass-Dy4KNHYF.cjs +0 -72
- package/dist/OutputPass-Tt8WbC_B.js +0 -125
- package/dist/Pass-C1mreNp8.cjs +0 -1
- package/dist/Pass-DOcH4lwV.js +0 -88
- package/dist/RenderPass-B57TYmjs.js +0 -37
- package/dist/RenderPass-BVzyKWsC.cjs +0 -1
- package/dist/ShaderPass-BQRqK8zp.cjs +0 -1
- package/dist/ShaderPass-C2HX8lsT.js +0 -45
- package/dist/ThreePathTracingService-Cf8e9Msc.js +0 -6383
- package/dist/UnrealBloomPass-Kx7djcld.cjs +0 -115
- package/dist/UnrealBloomPass-rjyQu37v.js +0 -281
- package/dist/VignetteShader-BG_QwoTp.js +0 -45
- package/dist/index-1jWUObtn.js +0 -13084
- package/dist/index-BlwMVqol.cjs +0 -29
package/README.md
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
# softbox
|
|
2
2
|
|
|
3
3
|
<!-- The size badges are static (bundlephobia/bundlejs both mismeasure this
|
|
4
|
-
|
|
4
|
+
multi-chunk package: they bundle `three`, our peer dep, or read the tiny
|
|
5
5
|
re-export entry). Refresh the numbers from our own build after a release
|
|
6
6
|
that changes the bundle:
|
|
7
|
-
npm run build && for f in dist/
|
|
7
|
+
npm run build && for f in dist/simple-viewer.es.js dist/ContactShadowBaker-*.js dist/ThreePathTracingService-*.js; do
|
|
8
8
|
b=$(gzip -c "$f" | wc -c); awk -v b="$b" -v n="$f" 'BEGIN{printf "%s %.1f kB gzip\n", n, b/1000}'; done
|
|
9
|
-
|
|
9
|
+
core = simple-viewer.es.js + ContactShadowBaker-* (the entry statically
|
|
10
|
+
imports that shared chunk, so both load eagerly);
|
|
10
11
|
ThreePathTracingService-* = the lazy path-tracer chunk. -->
|
|
11
12
|
[](https://www.npmjs.com/package/softbox)
|
|
12
|
-
[](https://bundlephobia.com/package/softbox)
|
|
14
|
+
[](https://bundlephobia.com/package/softbox)
|
|
14
15
|
[](https://github.com/LEMing/softbox/actions/workflows/ci.yml)
|
|
15
16
|
[](https://github.com/LEMing/softbox/blob/main/LICENSE)
|
|
16
17
|
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
<SimpleViewer object="/model.glb" />
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
Balanced studio lighting, a
|
|
26
|
+
Balanced studio lighting, a baked soft contact shadow that grounds the model, auto-framing, compressed-asset decoders — all on by default, zero configuration (the real-scale concrete paver floor is [one option away](#configuration)). Lighting needs zero network requests (the studio environment is procedural); the DRACO/KTX2 decoder wasm is fetched only when a model actually uses that compression, from a CDN by default or [self-hosted](#loaders) for offline use. The core is ~102 kB gzip; the path tracer lives in a lazy chunk that loads only when enabled. Every release is gated by 790+ unit tests plus a Playwright suite that asserts **real WebGL pixels** in CI.
|
|
26
27
|
|
|
27
28
|
[](https://leming.github.io/softbox/)
|
|
28
29
|
|
package/dist/{BrightnessContrastShader-BN6FBcLV.cjs → BrightnessContrastShader-C1jbh-NA.cjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var e={name:`BrightnessContrastShader`,uniforms:{tDiffuse:{value:null},brightness:{value:0},contrast:{value:0}},vertexShader:`
|
|
2
2
|
|
|
3
3
|
varying vec2 vUv;
|
|
4
4
|
|
|
@@ -28,4 +28,4 @@
|
|
|
28
28
|
gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
}`};exports.BrightnessContrastShader=
|
|
31
|
+
}`};exports.BrightnessContrastShader=e;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region node_modules/three/examples/jsm/shaders/BrightnessContrastShader.js
|
|
2
|
+
var e = {
|
|
3
|
+
name: "BrightnessContrastShader",
|
|
4
|
+
uniforms: {
|
|
5
|
+
tDiffuse: { value: null },
|
|
6
|
+
brightness: { value: 0 },
|
|
7
|
+
contrast: { value: 0 }
|
|
8
|
+
},
|
|
9
|
+
vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
|
|
10
|
+
fragmentShader: "\n\n uniform sampler2D tDiffuse;\n uniform float brightness;\n uniform float contrast;\n\n varying vec2 vUv;\n\n void main() {\n\n gl_FragColor = texture2D( tDiffuse, vUv );\n\n gl_FragColor.rgb += brightness;\n\n if (contrast > 0.0) {\n gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;\n } else {\n gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;\n }\n\n }"
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as BrightnessContrastShader };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region node_modules/three/examples/jsm/shaders/CopyShader.js
|
|
2
|
+
var e = {
|
|
3
|
+
name: "CopyShader",
|
|
4
|
+
uniforms: {
|
|
5
|
+
tDiffuse: { value: null },
|
|
6
|
+
opacity: { value: 1 }
|
|
7
|
+
},
|
|
8
|
+
vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
|
|
9
|
+
fragmentShader: "\n\n uniform float opacity;\n\n uniform sampler2D tDiffuse;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 texel = texture2D( tDiffuse, vUv );\n gl_FragColor = opacity * texel;\n\n\n }"
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { e as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var e={name:`CopyShader`,uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
|
|
2
2
|
|
|
3
3
|
varying vec2 vUv;
|
|
4
4
|
|
|
@@ -21,4 +21,4 @@
|
|
|
21
21
|
gl_FragColor = opacity * texel;
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
}`};exports
|
|
24
|
+
}`};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return e}});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { t as e } from "./CopyShader-C2Oc7n1P.js";
|
|
2
|
+
import { n as t } from "./Pass-CSHIrJrV.js";
|
|
3
|
+
import { ShaderPass as n } from "./ShaderPass-h4P0lBmc.js";
|
|
4
|
+
import { HalfFloatType as r, NoBlending as i, Timer as a, Vector2 as o, WebGLRenderTarget as s } from "three";
|
|
5
|
+
//#region node_modules/three/examples/jsm/postprocessing/MaskPass.js
|
|
6
|
+
var c = class extends t {
|
|
7
|
+
constructor(e, t) {
|
|
8
|
+
super(), this.scene = e, this.camera = t, this.clear = !0, this.needsSwap = !1, this.inverse = !1;
|
|
9
|
+
}
|
|
10
|
+
render(e, t, n) {
|
|
11
|
+
let r = e.getContext(), i = e.state;
|
|
12
|
+
i.buffers.color.setMask(!1), i.buffers.depth.setMask(!1), i.buffers.color.setLocked(!0), i.buffers.depth.setLocked(!0);
|
|
13
|
+
let a, o;
|
|
14
|
+
this.inverse ? (a = 0, o = 1) : (a = 1, o = 0), i.buffers.stencil.setTest(!0), i.buffers.stencil.setOp(r.REPLACE, r.REPLACE, r.REPLACE), i.buffers.stencil.setFunc(r.ALWAYS, a, 4294967295), i.buffers.stencil.setClear(o), i.buffers.stencil.setLocked(!0), e.setRenderTarget(n), this.clear && e.clear(), e.render(this.scene, this.camera), e.setRenderTarget(t), this.clear && e.clear(), e.render(this.scene, this.camera), i.buffers.color.setLocked(!1), i.buffers.depth.setLocked(!1), i.buffers.color.setMask(!0), i.buffers.depth.setMask(!0), i.buffers.stencil.setLocked(!1), i.buffers.stencil.setFunc(r.EQUAL, 1, 4294967295), i.buffers.stencil.setOp(r.KEEP, r.KEEP, r.KEEP), i.buffers.stencil.setLocked(!0);
|
|
15
|
+
}
|
|
16
|
+
}, l = class extends t {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(), this.needsSwap = !1;
|
|
19
|
+
}
|
|
20
|
+
render(e) {
|
|
21
|
+
e.state.buffers.stencil.setLocked(!1), e.state.buffers.stencil.setTest(!1);
|
|
22
|
+
}
|
|
23
|
+
}, u = class {
|
|
24
|
+
constructor(t, c) {
|
|
25
|
+
if (this.renderer = t, this._pixelRatio = t.getPixelRatio(), c === void 0) {
|
|
26
|
+
let e = t.getSize(new o());
|
|
27
|
+
this._width = e.width, this._height = e.height, c = new s(this._width * this._pixelRatio, this._height * this._pixelRatio, { type: r }), c.texture.name = "EffectComposer.rt1";
|
|
28
|
+
} else this._width = c.width, this._height = c.height;
|
|
29
|
+
this.renderTarget1 = c, this.renderTarget2 = c.clone(), this.renderTarget2.texture.name = "EffectComposer.rt2", this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2, this.renderToScreen = !0, this.passes = [], this.copyPass = new n(e), this.copyPass.material.blending = i, this.timer = new a();
|
|
30
|
+
}
|
|
31
|
+
swapBuffers() {
|
|
32
|
+
let e = this.readBuffer;
|
|
33
|
+
this.readBuffer = this.writeBuffer, this.writeBuffer = e;
|
|
34
|
+
}
|
|
35
|
+
addPass(e) {
|
|
36
|
+
this.passes.push(e), e.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
|
|
37
|
+
}
|
|
38
|
+
insertPass(e, t) {
|
|
39
|
+
this.passes.splice(t, 0, e), e.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
|
|
40
|
+
}
|
|
41
|
+
removePass(e) {
|
|
42
|
+
let t = this.passes.indexOf(e);
|
|
43
|
+
t !== -1 && this.passes.splice(t, 1);
|
|
44
|
+
}
|
|
45
|
+
isLastEnabledPass(e) {
|
|
46
|
+
for (let t = e + 1; t < this.passes.length; t++) if (this.passes[t].enabled) return !1;
|
|
47
|
+
return !0;
|
|
48
|
+
}
|
|
49
|
+
render(e) {
|
|
50
|
+
this.timer.update(), e === void 0 && (e = this.timer.getDelta());
|
|
51
|
+
let t = this.renderer.getRenderTarget(), n = !1;
|
|
52
|
+
for (let t = 0, r = this.passes.length; t < r; t++) {
|
|
53
|
+
let r = this.passes[t];
|
|
54
|
+
if (r.enabled !== !1) {
|
|
55
|
+
if (r.renderToScreen = this.renderToScreen && this.isLastEnabledPass(t), r.render(this.renderer, this.writeBuffer, this.readBuffer, e, n), r.needsSwap) {
|
|
56
|
+
if (n) {
|
|
57
|
+
let t = this.renderer.getContext(), n = this.renderer.state.buffers.stencil;
|
|
58
|
+
n.setFunc(t.NOTEQUAL, 1, 4294967295), this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, e), n.setFunc(t.EQUAL, 1, 4294967295);
|
|
59
|
+
}
|
|
60
|
+
this.swapBuffers();
|
|
61
|
+
}
|
|
62
|
+
c !== void 0 && (r instanceof c ? n = !0 : r instanceof l && (n = !1));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
this.renderer.setRenderTarget(t);
|
|
66
|
+
}
|
|
67
|
+
reset(e) {
|
|
68
|
+
if (e === void 0) {
|
|
69
|
+
let t = this.renderer.getSize(new o());
|
|
70
|
+
this._pixelRatio = this.renderer.getPixelRatio(), this._width = t.width, this._height = t.height, e = this.renderTarget1.clone(), e.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
|
|
71
|
+
}
|
|
72
|
+
this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.renderTarget1 = e, this.renderTarget2 = e.clone(), this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2;
|
|
73
|
+
}
|
|
74
|
+
setSize(e, t) {
|
|
75
|
+
this._width = e, this._height = t;
|
|
76
|
+
let n = this._width * this._pixelRatio, r = this._height * this._pixelRatio;
|
|
77
|
+
this.renderTarget1.setSize(n, r), this.renderTarget2.setSize(n, r);
|
|
78
|
+
for (let e = 0; e < this.passes.length; e++) this.passes[e].setSize(n, r);
|
|
79
|
+
}
|
|
80
|
+
setPixelRatio(e) {
|
|
81
|
+
this._pixelRatio = e, this.setSize(this._width, this._height);
|
|
82
|
+
}
|
|
83
|
+
dispose() {
|
|
84
|
+
this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.copyPass.dispose();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
//#endregion
|
|
88
|
+
export { u as EffectComposer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./CopyShader-CM1OGKAp.cjs"),t=require("./Pass-D0vYi-gB.cjs"),n=require("./ShaderPass-DghZ7TAj.cjs");let r=require("three");var i=class extends t.n{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){let r=e.getContext(),i=e.state;i.buffers.color.setMask(!1),i.buffers.depth.setMask(!1),i.buffers.color.setLocked(!0),i.buffers.depth.setLocked(!0);let a,o;this.inverse?(a=0,o=1):(a=1,o=0),i.buffers.stencil.setTest(!0),i.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),i.buffers.stencil.setFunc(r.ALWAYS,a,4294967295),i.buffers.stencil.setClear(o),i.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),i.buffers.color.setLocked(!1),i.buffers.depth.setLocked(!1),i.buffers.color.setMask(!0),i.buffers.depth.setMask(!0),i.buffers.stencil.setLocked(!1),i.buffers.stencil.setFunc(r.EQUAL,1,4294967295),i.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),i.buffers.stencil.setLocked(!0)}},a=class extends t.n{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}},o=class{constructor(t,i){if(this.renderer=t,this._pixelRatio=t.getPixelRatio(),i===void 0){let e=t.getSize(new r.Vector2);this._width=e.width,this._height=e.height,i=new r.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:r.HalfFloatType}),i.texture.name=`EffectComposer.rt1`}else this._width=i.width,this._height=i.height;this.renderTarget1=i,this.renderTarget2=i.clone(),this.renderTarget2.texture.name=`EffectComposer.rt2`,this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new n.ShaderPass(e.t),this.copyPass.material.blending=r.NoBlending,this.timer=new r.Timer}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){let t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){this.timer.update(),e===void 0&&(e=this.timer.getDelta());let t=this.renderer.getRenderTarget(),n=!1;for(let t=0,r=this.passes.length;t<r;t++){let r=this.passes[t];if(r.enabled!==!1){if(r.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),r.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),r.needsSwap){if(n){let t=this.renderer.getContext(),n=this.renderer.state.buffers.stencil;n.setFunc(t.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),n.setFunc(t.EQUAL,1,4294967295)}this.swapBuffers()}i!==void 0&&(r instanceof i?n=!0:r instanceof a&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){let t=this.renderer.getSize(new r.Vector2);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;let n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}};exports.EffectComposer=o;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region node_modules/three/examples/jsm/shaders/HueSaturationShader.js
|
|
2
|
+
var e = {
|
|
3
|
+
name: "HueSaturationShader",
|
|
4
|
+
uniforms: {
|
|
5
|
+
tDiffuse: { value: null },
|
|
6
|
+
hue: { value: 0 },
|
|
7
|
+
saturation: { value: 0 }
|
|
8
|
+
},
|
|
9
|
+
vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
|
|
10
|
+
fragmentShader: "\n\n uniform sampler2D tDiffuse;\n uniform float hue;\n uniform float saturation;\n\n varying vec2 vUv;\n\n void main() {\n\n gl_FragColor = texture2D( tDiffuse, vUv );\n\n // hue\n float angle = hue * 3.14159265;\n float s = sin(angle), c = cos(angle);\n vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;\n float len = length(gl_FragColor.rgb);\n gl_FragColor.rgb = vec3(\n dot(gl_FragColor.rgb, weights.xyz),\n dot(gl_FragColor.rgb, weights.zxy),\n dot(gl_FragColor.rgb, weights.yzx)\n );\n\n // saturation\n float average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;\n if (saturation > 0.0) {\n gl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));\n } else {\n gl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);\n }\n\n }"
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as HueSaturationShader };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var e={name:`HueSaturationShader`,uniforms:{tDiffuse:{value:null},hue:{value:0},saturation:{value:0}},vertexShader:`
|
|
2
2
|
|
|
3
3
|
varying vec2 vUv;
|
|
4
4
|
|
|
@@ -39,4 +39,4 @@
|
|
|
39
39
|
gl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
}`};exports.HueSaturationShader=
|
|
42
|
+
}`};exports.HueSaturationShader=e;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const e=require("./Pass-D0vYi-gB.cjs");let t=require("three");var n={name:`OutputShader`,uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:`
|
|
2
|
+
precision highp float;
|
|
3
|
+
|
|
4
|
+
uniform mat4 modelViewMatrix;
|
|
5
|
+
uniform mat4 projectionMatrix;
|
|
6
|
+
|
|
7
|
+
attribute vec3 position;
|
|
8
|
+
attribute vec2 uv;
|
|
9
|
+
|
|
10
|
+
varying vec2 vUv;
|
|
11
|
+
|
|
12
|
+
void main() {
|
|
13
|
+
|
|
14
|
+
vUv = uv;
|
|
15
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
16
|
+
|
|
17
|
+
}`,fragmentShader:`
|
|
18
|
+
|
|
19
|
+
precision highp float;
|
|
20
|
+
|
|
21
|
+
uniform sampler2D tDiffuse;
|
|
22
|
+
|
|
23
|
+
#include <tonemapping_pars_fragment>
|
|
24
|
+
#include <colorspace_pars_fragment>
|
|
25
|
+
|
|
26
|
+
varying vec2 vUv;
|
|
27
|
+
|
|
28
|
+
void main() {
|
|
29
|
+
|
|
30
|
+
gl_FragColor = texture2D( tDiffuse, vUv );
|
|
31
|
+
|
|
32
|
+
// tone mapping
|
|
33
|
+
|
|
34
|
+
#ifdef LINEAR_TONE_MAPPING
|
|
35
|
+
|
|
36
|
+
gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
|
|
37
|
+
|
|
38
|
+
#elif defined( REINHARD_TONE_MAPPING )
|
|
39
|
+
|
|
40
|
+
gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
|
|
41
|
+
|
|
42
|
+
#elif defined( CINEON_TONE_MAPPING )
|
|
43
|
+
|
|
44
|
+
gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
|
|
45
|
+
|
|
46
|
+
#elif defined( ACES_FILMIC_TONE_MAPPING )
|
|
47
|
+
|
|
48
|
+
gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
|
|
49
|
+
|
|
50
|
+
#elif defined( AGX_TONE_MAPPING )
|
|
51
|
+
|
|
52
|
+
gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
|
|
53
|
+
|
|
54
|
+
#elif defined( NEUTRAL_TONE_MAPPING )
|
|
55
|
+
|
|
56
|
+
gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
|
|
57
|
+
|
|
58
|
+
#elif defined( CUSTOM_TONE_MAPPING )
|
|
59
|
+
|
|
60
|
+
gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
|
|
61
|
+
|
|
62
|
+
#endif
|
|
63
|
+
|
|
64
|
+
// color space
|
|
65
|
+
|
|
66
|
+
#ifdef SRGB_TRANSFER
|
|
67
|
+
|
|
68
|
+
gl_FragColor = sRGBTransferOETF( gl_FragColor );
|
|
69
|
+
|
|
70
|
+
#endif
|
|
71
|
+
|
|
72
|
+
}`},r=class extends e.n{constructor(){super(),this.isOutputPass=!0,this.uniforms=t.UniformsUtils.clone(n.uniforms),this.material=new t.RawShaderMaterial({name:n.name,uniforms:this.uniforms,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}),this._fsQuad=new e.t(this.material),this._outputColorSpace=null,this._toneMapping=null}render(e,n,r){this.uniforms.tDiffuse.value=r.texture,this.uniforms.toneMappingExposure.value=e.toneMappingExposure,(this._outputColorSpace!==e.outputColorSpace||this._toneMapping!==e.toneMapping)&&(this._outputColorSpace=e.outputColorSpace,this._toneMapping=e.toneMapping,this.material.defines={},t.ColorManagement.getTransfer(this._outputColorSpace)===t.SRGBTransfer&&(this.material.defines.SRGB_TRANSFER=``),this._toneMapping===t.LinearToneMapping?this.material.defines.LINEAR_TONE_MAPPING=``:this._toneMapping===t.ReinhardToneMapping?this.material.defines.REINHARD_TONE_MAPPING=``:this._toneMapping===t.CineonToneMapping?this.material.defines.CINEON_TONE_MAPPING=``:this._toneMapping===t.ACESFilmicToneMapping?this.material.defines.ACES_FILMIC_TONE_MAPPING=``:this._toneMapping===t.AgXToneMapping?this.material.defines.AGX_TONE_MAPPING=``:this._toneMapping===t.NeutralToneMapping?this.material.defines.NEUTRAL_TONE_MAPPING=``:this._toneMapping===t.CustomToneMapping&&(this.material.defines.CUSTOM_TONE_MAPPING=``),this.material.needsUpdate=!0),this.renderToScreen===!0?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(n),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}};exports.OutputPass=r;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { n as e, t } from "./Pass-CSHIrJrV.js";
|
|
2
|
+
import { ACESFilmicToneMapping as n, AgXToneMapping as r, CineonToneMapping as i, ColorManagement as a, CustomToneMapping as o, LinearToneMapping as s, NeutralToneMapping as c, RawShaderMaterial as l, ReinhardToneMapping as u, SRGBTransfer as d, UniformsUtils as f } from "three";
|
|
3
|
+
//#region node_modules/three/examples/jsm/shaders/OutputShader.js
|
|
4
|
+
var p = {
|
|
5
|
+
name: "OutputShader",
|
|
6
|
+
uniforms: {
|
|
7
|
+
tDiffuse: { value: null },
|
|
8
|
+
toneMappingExposure: { value: 1 }
|
|
9
|
+
},
|
|
10
|
+
vertexShader: "\n precision highp float;\n\n uniform mat4 modelViewMatrix;\n uniform mat4 projectionMatrix;\n\n attribute vec3 position;\n attribute vec2 uv;\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
|
|
11
|
+
fragmentShader: "\n\n precision highp float;\n\n uniform sampler2D tDiffuse;\n\n #include <tonemapping_pars_fragment>\n #include <colorspace_pars_fragment>\n\n varying vec2 vUv;\n\n void main() {\n\n gl_FragColor = texture2D( tDiffuse, vUv );\n\n // tone mapping\n\n #ifdef LINEAR_TONE_MAPPING\n\n gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\n #elif defined( REINHARD_TONE_MAPPING )\n\n gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\n #elif defined( CINEON_TONE_MAPPING )\n\n gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );\n\n #elif defined( ACES_FILMIC_TONE_MAPPING )\n\n gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\n #elif defined( AGX_TONE_MAPPING )\n\n gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\n #elif defined( NEUTRAL_TONE_MAPPING )\n\n gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\n\n #elif defined( CUSTOM_TONE_MAPPING )\n\n gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );\n\n #endif\n\n // color space\n\n #ifdef SRGB_TRANSFER\n\n gl_FragColor = sRGBTransferOETF( gl_FragColor );\n\n #endif\n\n }"
|
|
12
|
+
}, m = class extends e {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(), this.isOutputPass = !0, this.uniforms = f.clone(p.uniforms), this.material = new l({
|
|
15
|
+
name: p.name,
|
|
16
|
+
uniforms: this.uniforms,
|
|
17
|
+
vertexShader: p.vertexShader,
|
|
18
|
+
fragmentShader: p.fragmentShader
|
|
19
|
+
}), this._fsQuad = new t(this.material), this._outputColorSpace = null, this._toneMapping = null;
|
|
20
|
+
}
|
|
21
|
+
render(e, t, l) {
|
|
22
|
+
this.uniforms.tDiffuse.value = l.texture, this.uniforms.toneMappingExposure.value = e.toneMappingExposure, (this._outputColorSpace !== e.outputColorSpace || this._toneMapping !== e.toneMapping) && (this._outputColorSpace = e.outputColorSpace, this._toneMapping = e.toneMapping, this.material.defines = {}, a.getTransfer(this._outputColorSpace) === d && (this.material.defines.SRGB_TRANSFER = ""), this._toneMapping === s ? this.material.defines.LINEAR_TONE_MAPPING = "" : this._toneMapping === u ? this.material.defines.REINHARD_TONE_MAPPING = "" : this._toneMapping === i ? this.material.defines.CINEON_TONE_MAPPING = "" : this._toneMapping === n ? this.material.defines.ACES_FILMIC_TONE_MAPPING = "" : this._toneMapping === r ? this.material.defines.AGX_TONE_MAPPING = "" : this._toneMapping === c ? this.material.defines.NEUTRAL_TONE_MAPPING = "" : this._toneMapping === o && (this.material.defines.CUSTOM_TONE_MAPPING = ""), this.material.needsUpdate = !0), this.renderToScreen === !0 ? (e.setRenderTarget(null), this._fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), this._fsQuad.render(e));
|
|
23
|
+
}
|
|
24
|
+
dispose() {
|
|
25
|
+
this.material.dispose(), this._fsQuad.dispose();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { m as OutputPass };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BufferGeometry as e, Float32BufferAttribute as t, Mesh as n, OrthographicCamera as r } from "three";
|
|
2
|
+
//#region node_modules/three/examples/jsm/postprocessing/Pass.js
|
|
3
|
+
var i = class {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.isPass = !0, this.enabled = !0, this.needsSwap = !0, this.clear = !1, this.renderToScreen = !1;
|
|
6
|
+
}
|
|
7
|
+
setSize() {}
|
|
8
|
+
render() {
|
|
9
|
+
console.error("THREE.Pass: .render() must be implemented in derived pass.");
|
|
10
|
+
}
|
|
11
|
+
dispose() {}
|
|
12
|
+
}, a = new r(-1, 1, 1, -1, 0, 1), o = new class extends e {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(), this.setAttribute("position", new t([
|
|
15
|
+
-1,
|
|
16
|
+
3,
|
|
17
|
+
0,
|
|
18
|
+
-1,
|
|
19
|
+
-1,
|
|
20
|
+
0,
|
|
21
|
+
3,
|
|
22
|
+
-1,
|
|
23
|
+
0
|
|
24
|
+
], 3)), this.setAttribute("uv", new t([
|
|
25
|
+
0,
|
|
26
|
+
2,
|
|
27
|
+
0,
|
|
28
|
+
0,
|
|
29
|
+
2,
|
|
30
|
+
0
|
|
31
|
+
], 2));
|
|
32
|
+
}
|
|
33
|
+
}(), s = class {
|
|
34
|
+
constructor(e) {
|
|
35
|
+
this._mesh = new n(o, e);
|
|
36
|
+
}
|
|
37
|
+
dispose() {
|
|
38
|
+
this._mesh.geometry.dispose();
|
|
39
|
+
}
|
|
40
|
+
render(e) {
|
|
41
|
+
e.render(this._mesh, a);
|
|
42
|
+
}
|
|
43
|
+
get material() {
|
|
44
|
+
return this._mesh.material;
|
|
45
|
+
}
|
|
46
|
+
set material(e) {
|
|
47
|
+
this._mesh.material = e;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { i as n, s as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("three");var t=class{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error(`THREE.Pass: .render() must be implemented in derived pass.`)}dispose(){}},n=new e.OrthographicCamera(-1,1,1,-1,0,1),r=new class extends e.BufferGeometry{constructor(){super(),this.setAttribute(`position`,new e.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute(`uv`,new e.Float32BufferAttribute([0,2,0,0,2,0],2))}},i=class{constructor(t){this._mesh=new e.Mesh(r,t)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,n)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { n as e } from "./Pass-CSHIrJrV.js";
|
|
2
|
+
import { Color as t } from "three";
|
|
3
|
+
//#region node_modules/three/examples/jsm/postprocessing/RenderPass.js
|
|
4
|
+
var n = class extends e {
|
|
5
|
+
constructor(e, n, r = null, i = null, a = null) {
|
|
6
|
+
super(), this.scene = e, this.camera = n, this.overrideMaterial = r, this.clearColor = i, this.clearAlpha = a, this.clear = !0, this.clearDepth = !1, this.needsSwap = !1, this.isRenderPass = !0, this._oldClearColor = new t();
|
|
7
|
+
}
|
|
8
|
+
render(e, t, n) {
|
|
9
|
+
let r = e.autoClear;
|
|
10
|
+
e.autoClear = !1;
|
|
11
|
+
let i, a;
|
|
12
|
+
this.overrideMaterial !== null && (a = this.scene.overrideMaterial, this.scene.overrideMaterial = this.overrideMaterial), this.clearColor !== null && (e.getClearColor(this._oldClearColor), e.setClearColor(this.clearColor, e.getClearAlpha())), this.clearAlpha !== null && (i = e.getClearAlpha(), e.setClearAlpha(this.clearAlpha)), this.clearDepth == 1 && e.clearDepth(), e.setRenderTarget(this.renderToScreen ? null : n), this.clear === !0 && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), e.render(this.scene, this.camera), this.clearColor !== null && e.setClearColor(this._oldClearColor), this.clearAlpha !== null && e.setClearAlpha(i), this.overrideMaterial !== null && (this.scene.overrideMaterial = a), e.autoClear = r;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { n as RenderPass };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./Pass-D0vYi-gB.cjs");let t=require("three");var n=class extends e.n{constructor(e,n,r=null,i=null,a=null){super(),this.scene=e,this.camera=n,this.overrideMaterial=r,this.clearColor=i,this.clearAlpha=a,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new t.Color}render(e,t,n){let r=e.autoClear;e.autoClear=!1;let i,a;this.overrideMaterial!==null&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(i=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==1&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(i),this.overrideMaterial!==null&&(this.scene.overrideMaterial=a),e.autoClear=r}};exports.RenderPass=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./Pass-D0vYi-gB.cjs");let t=require("three");var n=class extends e.n{constructor(n,r=`tDiffuse`){super(),this.textureID=r,this.uniforms=null,this.material=null,n instanceof t.ShaderMaterial?(this.uniforms=n.uniforms,this.material=n):n&&(this.uniforms=t.UniformsUtils.clone(n.uniforms),this.material=new t.ShaderMaterial({name:n.name===void 0?`unspecified`:n.name,defines:Object.assign({},n.defines),uniforms:this.uniforms,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader})),this._fsQuad=new e.t(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}};exports.ShaderPass=n;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { n as e, t } from "./Pass-CSHIrJrV.js";
|
|
2
|
+
import { ShaderMaterial as n, UniformsUtils as r } from "three";
|
|
3
|
+
//#region node_modules/three/examples/jsm/postprocessing/ShaderPass.js
|
|
4
|
+
var i = class extends e {
|
|
5
|
+
constructor(e, i = "tDiffuse") {
|
|
6
|
+
super(), this.textureID = i, this.uniforms = null, this.material = null, e instanceof n ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms = r.clone(e.uniforms), this.material = new n({
|
|
7
|
+
name: e.name === void 0 ? "unspecified" : e.name,
|
|
8
|
+
defines: Object.assign({}, e.defines),
|
|
9
|
+
uniforms: this.uniforms,
|
|
10
|
+
vertexShader: e.vertexShader,
|
|
11
|
+
fragmentShader: e.fragmentShader
|
|
12
|
+
})), this._fsQuad = new t(this.material);
|
|
13
|
+
}
|
|
14
|
+
render(e, t, n) {
|
|
15
|
+
this.uniforms[this.textureID] && (this.uniforms[this.textureID].value = n.texture), this._fsQuad.material = this.material, this.renderToScreen ? (e.setRenderTarget(null), this._fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), this._fsQuad.render(e));
|
|
16
|
+
}
|
|
17
|
+
dispose() {
|
|
18
|
+
this.material.dispose(), this._fsQuad.dispose();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { i as ShaderPass };
|