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.
Files changed (49) hide show
  1. package/README.md +7 -6
  2. package/dist/{BrightnessContrastShader-BN6FBcLV.cjs → BrightnessContrastShader-C1jbh-NA.cjs} +2 -2
  3. package/dist/BrightnessContrastShader-CoM5EjqG.js +13 -0
  4. package/dist/CopyShader-C2Oc7n1P.js +12 -0
  5. package/dist/{CopyShader-DPSZNOxL.cjs → CopyShader-CM1OGKAp.cjs} +2 -2
  6. package/dist/EffectComposer-CMs4vldH.js +88 -0
  7. package/dist/EffectComposer-CdAQB6p0.cjs +1 -0
  8. package/dist/HueSaturationShader-BeHSjNY8.js +13 -0
  9. package/dist/{HueSaturationShader-BEp7jjxf.cjs → HueSaturationShader-bN5IWhh8.cjs} +2 -2
  10. package/dist/OutputPass-DicIJHut.cjs +72 -0
  11. package/dist/OutputPass-oQu4Xmeb.js +29 -0
  12. package/dist/Pass-CSHIrJrV.js +51 -0
  13. package/dist/Pass-D0vYi-gB.cjs +1 -0
  14. package/dist/RenderPass-DS8SYAhJ.js +16 -0
  15. package/dist/RenderPass-DlRq51Kq.cjs +1 -0
  16. package/dist/ShaderPass-DghZ7TAj.cjs +1 -0
  17. package/dist/ShaderPass-h4P0lBmc.js +22 -0
  18. package/dist/{ThreePathTracingService-DvBQToys.cjs → ThreePathTracingService-CMw8SvGp.cjs} +97 -97
  19. package/dist/ThreePathTracingService-Dze7maGx.js +2546 -0
  20. package/dist/UnrealBloomPass-BTHiW_Y8.js +123 -0
  21. package/dist/UnrealBloomPass-CQHHa-s_.cjs +115 -0
  22. package/dist/VignetteShader-CPF_iEkO.js +13 -0
  23. package/dist/{VignetteShader-Drpo9YxI.cjs → VignetteShader-CQmGrpns.cjs} +2 -2
  24. package/dist/index.d.cts +13 -0
  25. package/dist/index.d.ts +13 -0
  26. package/dist/simple-viewer.cjs +23 -1
  27. package/dist/simple-viewer.es.js +8492 -11
  28. package/dist/unwrap-CuSMMFPQ.cjs +2 -0
  29. package/dist/unwrap-DdgS2iXe.js +2087 -0
  30. package/package.json +30 -18
  31. package/dist/BrightnessContrastShader-B9tNAd_c.js +0 -49
  32. package/dist/CopyShader-DVL8Bcar.js +0 -41
  33. package/dist/EffectComposer-BdHnHszK.js +0 -188
  34. package/dist/EffectComposer-D2IQ0sek.cjs +0 -1
  35. package/dist/HueSaturationShader-B6tnz2ga.js +0 -60
  36. package/dist/OutputPass-Dy4KNHYF.cjs +0 -72
  37. package/dist/OutputPass-Tt8WbC_B.js +0 -125
  38. package/dist/Pass-C1mreNp8.cjs +0 -1
  39. package/dist/Pass-DOcH4lwV.js +0 -88
  40. package/dist/RenderPass-B57TYmjs.js +0 -37
  41. package/dist/RenderPass-BVzyKWsC.cjs +0 -1
  42. package/dist/ShaderPass-BQRqK8zp.cjs +0 -1
  43. package/dist/ShaderPass-C2HX8lsT.js +0 -45
  44. package/dist/ThreePathTracingService-Cf8e9Msc.js +0 -6383
  45. package/dist/UnrealBloomPass-Kx7djcld.cjs +0 -115
  46. package/dist/UnrealBloomPass-rjyQu37v.js +0 -281
  47. package/dist/VignetteShader-BG_QwoTp.js +0 -45
  48. package/dist/index-1jWUObtn.js +0 -13084
  49. package/dist/index-BlwMVqol.cjs +0 -29
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "softbox",
3
3
  "private": false,
4
- "version": "4.17.0",
4
+ "version": "4.19.0",
5
5
  "homepage": "https://leming.github.io/softbox/",
6
6
  "type": "module",
7
7
  "description": "Batteries-included React 3D viewer — any GLB looks studio-shot in one line",
@@ -12,7 +12,11 @@
12
12
  "viewer",
13
13
  "glb",
14
14
  "gltf",
15
- "product viewer"
15
+ "product viewer",
16
+ "webgl",
17
+ "model-viewer",
18
+ "path-tracing",
19
+ "turntable"
16
20
  ],
17
21
  "repository": {
18
22
  "type": "git",
@@ -20,7 +24,7 @@
20
24
  },
21
25
  "license": "MIT",
22
26
  "engines": {
23
- "node": ">=18"
27
+ "node": ">=22.13.0"
24
28
  },
25
29
  "scripts": {
26
30
  "dev": "vite",
@@ -65,38 +69,46 @@
65
69
  "access": "public"
66
70
  },
67
71
  "devDependencies": {
68
- "@arethetypeswrong/cli": "^0.18.4",
69
- "@eslint/js": "^9.30.1",
72
+ "@arethetypeswrong/cli": "^0.18.5",
73
+ "@eslint/js": "^10.0.1",
74
+ "@microsoft/api-extractor": "^7.58.9",
70
75
  "@playwright/test": "^1.61.1",
71
76
  "@testing-library/jest-dom": "^6.4.8",
72
77
  "@testing-library/react": "^16.1.0",
73
- "@types/jest": "^29.5.12",
78
+ "@types/jest": "^30.0.0",
74
79
  "@types/pngjs": "^6.0.5",
75
80
  "@types/react": "^19.0.0",
76
81
  "@types/react-dom": "^19.0.0",
77
- "@types/three": "0.185.0",
78
- "@vitejs/plugin-react": "^4.3.1",
79
- "eslint": "^9.30.1",
80
- "eslint-plugin-react-hooks": "^5.2.0",
81
- "jest": "^29.7.0",
82
- "jest-environment-jsdom": "^29.7.0",
83
- "knip": "^6.23.0",
82
+ "@types/three": "^0.185.1",
83
+ "@vitejs/plugin-react": "^6.0.3",
84
+ "eslint": "^10.7.0",
85
+ "eslint-plugin-react-hooks": "^7.1.1",
86
+ "jest": "^30.4.2",
87
+ "jest-environment-jsdom": "^30.4.1",
88
+ "knip": "^6.26.0",
84
89
  "pngjs": "^7.0.0",
85
90
  "react": "^19.0.0",
86
91
  "react-dom": "^19.0.0",
87
92
  "three": "^0.185.1",
88
93
  "three-gpu-pathtracer": "^0.0.23",
89
- "three-mesh-bvh": "^0.9.9",
94
+ "three-mesh-bvh": "^0.9.11",
90
95
  "threedgizmo": "^1.2.1",
91
- "ts-jest": "^29.2.4",
96
+ "ts-jest": "^29.4.11",
92
97
  "typescript": "^5.5.3",
93
- "typescript-eslint": "^8.35.1",
94
- "vite": "^6.3.5",
95
- "vite-plugin-dts": "^4.0.3"
98
+ "typescript-eslint": "^8.63.0",
99
+ "unplugin-dts": "^1.0.3",
100
+ "vite": "^8.1.4"
96
101
  },
97
102
  "peerDependencies": {
98
103
  "react": ">=18.0.0 <20.0.0",
99
104
  "react-dom": ">=18.0.0 <20.0.0",
100
105
  "three": ">=0.177.0 <0.186.0"
106
+ },
107
+ "sideEffects": [
108
+ "./dist/simple-viewer.es.js",
109
+ "./dist/simple-viewer.cjs"
110
+ ],
111
+ "bugs": {
112
+ "url": "https://github.com/LEMing/softbox/issues"
101
113
  }
102
114
  }
@@ -1,49 +0,0 @@
1
- const r = {
2
- name: "BrightnessContrastShader",
3
- uniforms: {
4
- tDiffuse: { value: null },
5
- brightness: { value: 0 },
6
- contrast: { value: 0 }
7
- },
8
- vertexShader: (
9
- /* glsl */
10
- `
11
-
12
- varying vec2 vUv;
13
-
14
- void main() {
15
-
16
- vUv = uv;
17
-
18
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
19
-
20
- }`
21
- ),
22
- fragmentShader: (
23
- /* glsl */
24
- `
25
-
26
- uniform sampler2D tDiffuse;
27
- uniform float brightness;
28
- uniform float contrast;
29
-
30
- varying vec2 vUv;
31
-
32
- void main() {
33
-
34
- gl_FragColor = texture2D( tDiffuse, vUv );
35
-
36
- gl_FragColor.rgb += brightness;
37
-
38
- if (contrast > 0.0) {
39
- gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;
40
- } else {
41
- gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;
42
- }
43
-
44
- }`
45
- )
46
- };
47
- export {
48
- r as BrightnessContrastShader
49
- };
@@ -1,41 +0,0 @@
1
- const e = {
2
- name: "CopyShader",
3
- uniforms: {
4
- tDiffuse: { value: null },
5
- opacity: { value: 1 }
6
- },
7
- vertexShader: (
8
- /* glsl */
9
- `
10
-
11
- varying vec2 vUv;
12
-
13
- void main() {
14
-
15
- vUv = uv;
16
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
17
-
18
- }`
19
- ),
20
- fragmentShader: (
21
- /* glsl */
22
- `
23
-
24
- uniform float opacity;
25
-
26
- uniform sampler2D tDiffuse;
27
-
28
- varying vec2 vUv;
29
-
30
- void main() {
31
-
32
- vec4 texel = texture2D( tDiffuse, vUv );
33
- gl_FragColor = opacity * texel;
34
-
35
-
36
- }`
37
- )
38
- };
39
- export {
40
- e as C
41
- };
@@ -1,188 +0,0 @@
1
- import { Vector2 as o, WebGLRenderTarget as d, HalfFloatType as u, NoBlending as p, Timer as g } from "three";
2
- import { C as _ } from "./CopyShader-DVL8Bcar.js";
3
- import { ShaderPass as x } from "./ShaderPass-C2HX8lsT.js";
4
- import { P as l } from "./Pass-DOcH4lwV.js";
5
- class c extends l {
6
- /**
7
- * Constructs a new mask pass.
8
- *
9
- * @param {Scene} scene - The 3D objects in this scene will define the mask.
10
- * @param {Camera} camera - The camera.
11
- */
12
- constructor(e, s) {
13
- super(), this.scene = e, this.camera = s, this.clear = !0, this.needsSwap = !1, this.inverse = !1;
14
- }
15
- /**
16
- * Performs a mask pass with the configured scene and camera.
17
- *
18
- * @param {WebGLRenderer} renderer - The renderer.
19
- * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering
20
- * destination for the pass.
21
- * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the
22
- * previous pass from this buffer.
23
- * @param {number} deltaTime - The delta time in seconds.
24
- * @param {boolean} maskActive - Whether masking is active or not.
25
- */
26
- render(e, s, r) {
27
- const i = e.getContext(), t = e.state;
28
- t.buffers.color.setMask(!1), t.buffers.depth.setMask(!1), t.buffers.color.setLocked(!0), t.buffers.depth.setLocked(!0);
29
- let h, f;
30
- this.inverse ? (h = 0, f = 1) : (h = 1, f = 0), t.buffers.stencil.setTest(!0), t.buffers.stencil.setOp(i.REPLACE, i.REPLACE, i.REPLACE), t.buffers.stencil.setFunc(i.ALWAYS, h, 4294967295), t.buffers.stencil.setClear(f), t.buffers.stencil.setLocked(!0), e.setRenderTarget(r), this.clear && e.clear(), e.render(this.scene, this.camera), e.setRenderTarget(s), this.clear && e.clear(), e.render(this.scene, this.camera), t.buffers.color.setLocked(!1), t.buffers.depth.setLocked(!1), t.buffers.color.setMask(!0), t.buffers.depth.setMask(!0), t.buffers.stencil.setLocked(!1), t.buffers.stencil.setFunc(i.EQUAL, 1, 4294967295), t.buffers.stencil.setOp(i.KEEP, i.KEEP, i.KEEP), t.buffers.stencil.setLocked(!0);
31
- }
32
- }
33
- class w extends l {
34
- /**
35
- * Constructs a new clear mask pass.
36
- */
37
- constructor() {
38
- super(), this.needsSwap = !1;
39
- }
40
- /**
41
- * Performs the clear of the currently defined mask.
42
- *
43
- * @param {WebGLRenderer} renderer - The renderer.
44
- * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering
45
- * destination for the pass.
46
- * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the
47
- * previous pass from this buffer.
48
- * @param {number} deltaTime - The delta time in seconds.
49
- * @param {boolean} maskActive - Whether masking is active or not.
50
- */
51
- render(e) {
52
- e.state.buffers.stencil.setLocked(!1), e.state.buffers.stencil.setTest(!1);
53
- }
54
- }
55
- class E {
56
- /**
57
- * Constructs a new effect composer.
58
- *
59
- * @param {WebGLRenderer} renderer - The renderer.
60
- * @param {WebGLRenderTarget} [renderTarget] - This render target and a clone will
61
- * be used as the internal read and write buffers. If not given, the composer creates
62
- * the buffers automatically.
63
- */
64
- constructor(e, s) {
65
- if (this.renderer = e, this._pixelRatio = e.getPixelRatio(), s === void 0) {
66
- const r = e.getSize(new o());
67
- this._width = r.width, this._height = r.height, s = new d(this._width * this._pixelRatio, this._height * this._pixelRatio, { type: u }), s.texture.name = "EffectComposer.rt1";
68
- } else
69
- this._width = s.width, this._height = s.height;
70
- this.renderTarget1 = s, this.renderTarget2 = s.clone(), this.renderTarget2.texture.name = "EffectComposer.rt2", this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2, this.renderToScreen = !0, this.passes = [], this.copyPass = new x(_), this.copyPass.material.blending = p, this.timer = new g();
71
- }
72
- /**
73
- * Swaps the internal read/write buffers.
74
- */
75
- swapBuffers() {
76
- const e = this.readBuffer;
77
- this.readBuffer = this.writeBuffer, this.writeBuffer = e;
78
- }
79
- /**
80
- * Adds the given pass to the pass chain.
81
- *
82
- * @param {Pass} pass - The pass to add.
83
- */
84
- addPass(e) {
85
- this.passes.push(e), e.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
86
- }
87
- /**
88
- * Inserts the given pass at a given index.
89
- *
90
- * @param {Pass} pass - The pass to insert.
91
- * @param {number} index - The index into the pass chain.
92
- */
93
- insertPass(e, s) {
94
- this.passes.splice(s, 0, e), e.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
95
- }
96
- /**
97
- * Removes the given pass from the pass chain.
98
- *
99
- * @param {Pass} pass - The pass to remove.
100
- */
101
- removePass(e) {
102
- const s = this.passes.indexOf(e);
103
- s !== -1 && this.passes.splice(s, 1);
104
- }
105
- /**
106
- * Returns `true` if the pass for the given index is the last enabled pass in the pass chain.
107
- *
108
- * @param {number} passIndex - The pass index.
109
- * @return {boolean} Whether the pass for the given index is the last pass in the pass chain.
110
- */
111
- isLastEnabledPass(e) {
112
- for (let s = e + 1; s < this.passes.length; s++)
113
- if (this.passes[s].enabled)
114
- return !1;
115
- return !0;
116
- }
117
- /**
118
- * Executes all enabled post-processing passes in order to produce the final frame.
119
- *
120
- * @param {number} deltaTime - The delta time in seconds. If not given, the composer computes
121
- * its own time delta value.
122
- */
123
- render(e) {
124
- this.timer.update(), e === void 0 && (e = this.timer.getDelta());
125
- const s = this.renderer.getRenderTarget();
126
- let r = !1;
127
- for (let i = 0, t = this.passes.length; i < t; i++) {
128
- const h = this.passes[i];
129
- if (h.enabled !== !1) {
130
- if (h.renderToScreen = this.renderToScreen && this.isLastEnabledPass(i), h.render(this.renderer, this.writeBuffer, this.readBuffer, e, r), h.needsSwap) {
131
- if (r) {
132
- const f = this.renderer.getContext(), n = this.renderer.state.buffers.stencil;
133
- n.setFunc(f.NOTEQUAL, 1, 4294967295), this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, e), n.setFunc(f.EQUAL, 1, 4294967295);
134
- }
135
- this.swapBuffers();
136
- }
137
- c !== void 0 && (h instanceof c ? r = !0 : h instanceof w && (r = !1));
138
- }
139
- }
140
- this.renderer.setRenderTarget(s);
141
- }
142
- /**
143
- * Resets the internal state of the EffectComposer.
144
- *
145
- * @param {WebGLRenderTarget} [renderTarget] - This render target has the same purpose like
146
- * the one from the constructor. If set, it is used to setup the read and write buffers.
147
- */
148
- reset(e) {
149
- if (e === void 0) {
150
- const s = this.renderer.getSize(new o());
151
- this._pixelRatio = this.renderer.getPixelRatio(), this._width = s.width, this._height = s.height, e = this.renderTarget1.clone(), e.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
152
- }
153
- this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.renderTarget1 = e, this.renderTarget2 = e.clone(), this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2;
154
- }
155
- /**
156
- * Resizes the internal read and write buffers as well as all passes. Similar to {@link WebGLRenderer#setSize},
157
- * this method honors the current pixel ration.
158
- *
159
- * @param {number} width - The width in logical pixels.
160
- * @param {number} height - The height in logical pixels.
161
- */
162
- setSize(e, s) {
163
- this._width = e, this._height = s;
164
- const r = this._width * this._pixelRatio, i = this._height * this._pixelRatio;
165
- this.renderTarget1.setSize(r, i), this.renderTarget2.setSize(r, i);
166
- for (let t = 0; t < this.passes.length; t++)
167
- this.passes[t].setSize(r, i);
168
- }
169
- /**
170
- * Sets device pixel ratio. This is usually used for HiDPI device to prevent blurring output.
171
- * Setting the pixel ratio will automatically resize the composer.
172
- *
173
- * @param {number} pixelRatio - The pixel ratio to set.
174
- */
175
- setPixelRatio(e) {
176
- this._pixelRatio = e, this.setSize(this._width, this._height);
177
- }
178
- /**
179
- * Frees the GPU-related resources allocated by this instance. Call this
180
- * method whenever the composer is no longer used in your app.
181
- */
182
- dispose() {
183
- this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.copyPass.dispose();
184
- }
185
- }
186
- export {
187
- E as EffectComposer
188
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("three"),d=require("./CopyShader-DPSZNOxL.cjs"),u=require("./ShaderPass-BQRqK8zp.cjs"),l=require("./Pass-C1mreNp8.cjs");class c extends l.Pass{constructor(e,s){super(),this.scene=e,this.camera=s,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,s,r){const i=e.getContext(),t=e.state;t.buffers.color.setMask(!1),t.buffers.depth.setMask(!1),t.buffers.color.setLocked(!0),t.buffers.depth.setLocked(!0);let h,f;this.inverse?(h=0,f=1):(h=1,f=0),t.buffers.stencil.setTest(!0),t.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),t.buffers.stencil.setFunc(i.ALWAYS,h,4294967295),t.buffers.stencil.setClear(f),t.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(s),this.clear&&e.clear(),e.render(this.scene,this.camera),t.buffers.color.setLocked(!1),t.buffers.depth.setLocked(!1),t.buffers.color.setMask(!0),t.buffers.depth.setMask(!0),t.buffers.stencil.setLocked(!1),t.buffers.stencil.setFunc(i.EQUAL,1,4294967295),t.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),t.buffers.stencil.setLocked(!0)}}class p extends l.Pass{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class g{constructor(e,s){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),s===void 0){const r=e.getSize(new a.Vector2);this._width=r.width,this._height=r.height,s=new a.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:a.HalfFloatType}),s.texture.name="EffectComposer.rt1"}else this._width=s.width,this._height=s.height;this.renderTarget1=s,this.renderTarget2=s.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new u.ShaderPass(d.CopyShader),this.copyPass.material.blending=a.NoBlending,this.timer=new a.Timer}swapBuffers(){const 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,s){this.passes.splice(s,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const s=this.passes.indexOf(e);s!==-1&&this.passes.splice(s,1)}isLastEnabledPass(e){for(let s=e+1;s<this.passes.length;s++)if(this.passes[s].enabled)return!1;return!0}render(e){this.timer.update(),e===void 0&&(e=this.timer.getDelta());const s=this.renderer.getRenderTarget();let r=!1;for(let i=0,t=this.passes.length;i<t;i++){const h=this.passes[i];if(h.enabled!==!1){if(h.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(i),h.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),h.needsSwap){if(r){const f=this.renderer.getContext(),o=this.renderer.state.buffers.stencil;o.setFunc(f.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),o.setFunc(f.EQUAL,1,4294967295)}this.swapBuffers()}c!==void 0&&(h instanceof c?r=!0:h instanceof p&&(r=!1))}}this.renderer.setRenderTarget(s)}reset(e){if(e===void 0){const s=this.renderer.getSize(new a.Vector2);this._pixelRatio=this.renderer.getPixelRatio(),this._width=s.width,this._height=s.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,s){this._width=e,this._height=s;const r=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget1.setSize(r,i),this.renderTarget2.setSize(r,i);for(let t=0;t<this.passes.length;t++)this.passes[t].setSize(r,i)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}exports.EffectComposer=g;
@@ -1,60 +0,0 @@
1
- const r = {
2
- name: "HueSaturationShader",
3
- uniforms: {
4
- tDiffuse: { value: null },
5
- hue: { value: 0 },
6
- saturation: { value: 0 }
7
- },
8
- vertexShader: (
9
- /* glsl */
10
- `
11
-
12
- varying vec2 vUv;
13
-
14
- void main() {
15
-
16
- vUv = uv;
17
-
18
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
19
-
20
- }`
21
- ),
22
- fragmentShader: (
23
- /* glsl */
24
- `
25
-
26
- uniform sampler2D tDiffuse;
27
- uniform float hue;
28
- uniform float saturation;
29
-
30
- varying vec2 vUv;
31
-
32
- void main() {
33
-
34
- gl_FragColor = texture2D( tDiffuse, vUv );
35
-
36
- // hue
37
- float angle = hue * 3.14159265;
38
- float s = sin(angle), c = cos(angle);
39
- vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;
40
- float len = length(gl_FragColor.rgb);
41
- gl_FragColor.rgb = vec3(
42
- dot(gl_FragColor.rgb, weights.xyz),
43
- dot(gl_FragColor.rgb, weights.zxy),
44
- dot(gl_FragColor.rgb, weights.yzx)
45
- );
46
-
47
- // saturation
48
- float average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;
49
- if (saturation > 0.0) {
50
- gl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));
51
- } else {
52
- gl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);
53
- }
54
-
55
- }`
56
- )
57
- };
58
- export {
59
- r as HueSaturationShader
60
- };
@@ -1,72 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("three"),t=require("./Pass-C1mreNp8.cjs"),a={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
- }`};class r extends t.Pass{constructor(){super(),this.isOutputPass=!0,this.uniforms=i.UniformsUtils.clone(a.uniforms),this.material=new i.RawShaderMaterial({name:a.name,uniforms:this.uniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader}),this._fsQuad=new t.FullScreenQuad(this.material),this._outputColorSpace=null,this._toneMapping=null}render(e,o,n){this.uniforms.tDiffuse.value=n.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={},i.ColorManagement.getTransfer(this._outputColorSpace)===i.SRGBTransfer&&(this.material.defines.SRGB_TRANSFER=""),this._toneMapping===i.LinearToneMapping?this.material.defines.LINEAR_TONE_MAPPING="":this._toneMapping===i.ReinhardToneMapping?this.material.defines.REINHARD_TONE_MAPPING="":this._toneMapping===i.CineonToneMapping?this.material.defines.CINEON_TONE_MAPPING="":this._toneMapping===i.ACESFilmicToneMapping?this.material.defines.ACES_FILMIC_TONE_MAPPING="":this._toneMapping===i.AgXToneMapping?this.material.defines.AGX_TONE_MAPPING="":this._toneMapping===i.NeutralToneMapping?this.material.defines.NEUTRAL_TONE_MAPPING="":this._toneMapping===i.CustomToneMapping&&(this.material.defines.CUSTOM_TONE_MAPPING=""),this.material.needsUpdate=!0),this.renderToScreen===!0?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(o),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}}exports.OutputPass=r;
@@ -1,125 +0,0 @@
1
- import { UniformsUtils as o, RawShaderMaterial as n, ColorManagement as r, SRGBTransfer as s, LinearToneMapping as l, ReinhardToneMapping as p, CineonToneMapping as g, ACESFilmicToneMapping as f, AgXToneMapping as _, NeutralToneMapping as u, CustomToneMapping as h } from "three";
2
- import { P as M, F as m } from "./Pass-DOcH4lwV.js";
3
- const i = {
4
- name: "OutputShader",
5
- uniforms: {
6
- tDiffuse: { value: null },
7
- toneMappingExposure: { value: 1 }
8
- },
9
- vertexShader: (
10
- /* glsl */
11
- `
12
- precision highp float;
13
-
14
- uniform mat4 modelViewMatrix;
15
- uniform mat4 projectionMatrix;
16
-
17
- attribute vec3 position;
18
- attribute vec2 uv;
19
-
20
- varying vec2 vUv;
21
-
22
- void main() {
23
-
24
- vUv = uv;
25
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
26
-
27
- }`
28
- ),
29
- fragmentShader: (
30
- /* glsl */
31
- `
32
-
33
- precision highp float;
34
-
35
- uniform sampler2D tDiffuse;
36
-
37
- #include <tonemapping_pars_fragment>
38
- #include <colorspace_pars_fragment>
39
-
40
- varying vec2 vUv;
41
-
42
- void main() {
43
-
44
- gl_FragColor = texture2D( tDiffuse, vUv );
45
-
46
- // tone mapping
47
-
48
- #ifdef LINEAR_TONE_MAPPING
49
-
50
- gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
51
-
52
- #elif defined( REINHARD_TONE_MAPPING )
53
-
54
- gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
55
-
56
- #elif defined( CINEON_TONE_MAPPING )
57
-
58
- gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
59
-
60
- #elif defined( ACES_FILMIC_TONE_MAPPING )
61
-
62
- gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
63
-
64
- #elif defined( AGX_TONE_MAPPING )
65
-
66
- gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
67
-
68
- #elif defined( NEUTRAL_TONE_MAPPING )
69
-
70
- gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
71
-
72
- #elif defined( CUSTOM_TONE_MAPPING )
73
-
74
- gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
75
-
76
- #endif
77
-
78
- // color space
79
-
80
- #ifdef SRGB_TRANSFER
81
-
82
- gl_FragColor = sRGBTransferOETF( gl_FragColor );
83
-
84
- #endif
85
-
86
- }`
87
- )
88
- };
89
- class T extends M {
90
- /**
91
- * Constructs a new output pass.
92
- */
93
- constructor() {
94
- super(), this.isOutputPass = !0, this.uniforms = o.clone(i.uniforms), this.material = new n({
95
- name: i.name,
96
- uniforms: this.uniforms,
97
- vertexShader: i.vertexShader,
98
- fragmentShader: i.fragmentShader
99
- }), this._fsQuad = new m(this.material), this._outputColorSpace = null, this._toneMapping = null;
100
- }
101
- /**
102
- * Performs the output pass.
103
- *
104
- * @param {WebGLRenderer} renderer - The renderer.
105
- * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering
106
- * destination for the pass.
107
- * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the
108
- * previous pass from this buffer.
109
- * @param {number} deltaTime - The delta time in seconds.
110
- * @param {boolean} maskActive - Whether masking is active or not.
111
- */
112
- render(e, a, t) {
113
- this.uniforms.tDiffuse.value = t.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 = {}, r.getTransfer(this._outputColorSpace) === s && (this.material.defines.SRGB_TRANSFER = ""), this._toneMapping === l ? this.material.defines.LINEAR_TONE_MAPPING = "" : this._toneMapping === p ? this.material.defines.REINHARD_TONE_MAPPING = "" : this._toneMapping === g ? this.material.defines.CINEON_TONE_MAPPING = "" : this._toneMapping === f ? this.material.defines.ACES_FILMIC_TONE_MAPPING = "" : this._toneMapping === _ ? this.material.defines.AGX_TONE_MAPPING = "" : this._toneMapping === u ? this.material.defines.NEUTRAL_TONE_MAPPING = "" : this._toneMapping === h && (this.material.defines.CUSTOM_TONE_MAPPING = ""), this.material.needsUpdate = !0), this.renderToScreen === !0 ? (e.setRenderTarget(null), this._fsQuad.render(e)) : (e.setRenderTarget(a), this.clear && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), this._fsQuad.render(e));
114
- }
115
- /**
116
- * Frees the GPU-related resources allocated by this instance. Call this
117
- * method whenever the pass is no longer used in your app.
118
- */
119
- dispose() {
120
- this.material.dispose(), this._fsQuad.dispose();
121
- }
122
- }
123
- export {
124
- T as OutputPass
125
- };
@@ -1 +0,0 @@
1
- "use strict";const s=require("three");class r{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(){}}const i=new s.OrthographicCamera(-1,1,1,-1,0,1);class a extends s.BufferGeometry{constructor(){super(),this.setAttribute("position",new s.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new s.Float32BufferAttribute([0,2,0,0,2,0],2))}}const n=new a;class o{constructor(e){this._mesh=new s.Mesh(n,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,i)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}exports.FullScreenQuad=o;exports.Pass=r;