softbox 4.7.0 → 4.8.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.
@@ -0,0 +1,24 @@
1
+ "use strict";const e={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
2
+
3
+ varying vec2 vUv;
4
+
5
+ void main() {
6
+
7
+ vUv = uv;
8
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
9
+
10
+ }`,fragmentShader:`
11
+
12
+ uniform float opacity;
13
+
14
+ uniform sampler2D tDiffuse;
15
+
16
+ varying vec2 vUv;
17
+
18
+ void main() {
19
+
20
+ vec4 texel = texture2D( tDiffuse, vUv );
21
+ gl_FragColor = opacity * texel;
22
+
23
+
24
+ }`};exports.CopyShader=e;
@@ -0,0 +1,41 @@
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
+ };
@@ -0,0 +1,188 @@
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
+ };
@@ -0,0 +1 @@
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;
@@ -0,0 +1,72 @@
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;
@@ -0,0 +1,125 @@
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
+ };
@@ -0,0 +1 @@
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;
@@ -0,0 +1,88 @@
1
+ import { Mesh as r, OrthographicCamera as i, BufferGeometry as a, Float32BufferAttribute as t } from "three";
2
+ class l {
3
+ /**
4
+ * Constructs a new pass.
5
+ */
6
+ constructor() {
7
+ this.isPass = !0, this.enabled = !0, this.needsSwap = !0, this.clear = !1, this.renderToScreen = !1;
8
+ }
9
+ /**
10
+ * Sets the size of the pass.
11
+ *
12
+ * @abstract
13
+ * @param {number} width - The width to set.
14
+ * @param {number} height - The height to set.
15
+ */
16
+ setSize() {
17
+ }
18
+ /**
19
+ * This method holds the render logic of a pass. It must be implemented in all derived classes.
20
+ *
21
+ * @abstract
22
+ * @param {WebGLRenderer} renderer - The renderer.
23
+ * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering
24
+ * destination for the pass.
25
+ * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the
26
+ * previous pass from this buffer.
27
+ * @param {number} deltaTime - The delta time in seconds.
28
+ * @param {boolean} maskActive - Whether masking is active or not.
29
+ */
30
+ render() {
31
+ console.error("THREE.Pass: .render() must be implemented in derived pass.");
32
+ }
33
+ /**
34
+ * Frees the GPU-related resources allocated by this instance. Call this
35
+ * method whenever the pass is no longer used in your app.
36
+ *
37
+ * @abstract
38
+ */
39
+ dispose() {
40
+ }
41
+ }
42
+ const n = new i(-1, 1, 1, -1, 0, 1);
43
+ class o extends a {
44
+ constructor() {
45
+ super(), this.setAttribute("position", new t([-1, 3, 0, -1, -1, 0, 3, -1, 0], 3)), this.setAttribute("uv", new t([0, 2, 0, 0, 2, 0], 2));
46
+ }
47
+ }
48
+ const h = new o();
49
+ class c {
50
+ /**
51
+ * Constructs a new full screen quad.
52
+ *
53
+ * @param {?Material} material - The material to render te full screen quad with.
54
+ */
55
+ constructor(e) {
56
+ this._mesh = new r(h, e);
57
+ }
58
+ /**
59
+ * Frees the GPU-related resources allocated by this instance. Call this
60
+ * method whenever the instance is no longer used in your app.
61
+ */
62
+ dispose() {
63
+ this._mesh.geometry.dispose();
64
+ }
65
+ /**
66
+ * Renders the full screen quad.
67
+ *
68
+ * @param {WebGLRenderer} renderer - The renderer.
69
+ */
70
+ render(e) {
71
+ e.render(this._mesh, n);
72
+ }
73
+ /**
74
+ * The quad's material.
75
+ *
76
+ * @type {?Material}
77
+ */
78
+ get material() {
79
+ return this._mesh.material;
80
+ }
81
+ set material(e) {
82
+ this._mesh.material = e;
83
+ }
84
+ }
85
+ export {
86
+ c as F,
87
+ l as P
88
+ };
@@ -0,0 +1,37 @@
1
+ import { Color as o } from "three";
2
+ import { P as r } from "./Pass-DOcH4lwV.js";
3
+ class u extends r {
4
+ /**
5
+ * Constructs a new render pass.
6
+ *
7
+ * @param {Scene} scene - The scene to render.
8
+ * @param {Camera} camera - The camera.
9
+ * @param {?Material} [overrideMaterial=null] - The override material. If set, this material is used
10
+ * for all objects in the scene.
11
+ * @param {?(number|Color|string)} [clearColor=null] - The clear color of the render pass.
12
+ * @param {?number} [clearAlpha=null] - The clear alpha of the render pass.
13
+ */
14
+ constructor(l, i, t = null, e = null, a = null) {
15
+ super(), this.scene = l, this.camera = i, this.overrideMaterial = t, this.clearColor = e, this.clearAlpha = a, this.clear = !0, this.clearDepth = !1, this.needsSwap = !1, this.isRenderPass = !0, this._oldClearColor = new o();
16
+ }
17
+ /**
18
+ * Performs a beauty pass with the configured scene and camera.
19
+ *
20
+ * @param {WebGLRenderer} renderer - The renderer.
21
+ * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering
22
+ * destination for the pass.
23
+ * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the
24
+ * previous pass from this buffer.
25
+ * @param {number} deltaTime - The delta time in seconds.
26
+ * @param {boolean} maskActive - Whether masking is active or not.
27
+ */
28
+ render(l, i, t) {
29
+ const e = l.autoClear;
30
+ l.autoClear = !1;
31
+ let a, s;
32
+ this.overrideMaterial !== null && (s = this.scene.overrideMaterial, this.scene.overrideMaterial = this.overrideMaterial), this.clearColor !== null && (l.getClearColor(this._oldClearColor), l.setClearColor(this.clearColor, l.getClearAlpha())), this.clearAlpha !== null && (a = l.getClearAlpha(), l.setClearAlpha(this.clearAlpha)), this.clearDepth == !0 && l.clearDepth(), l.setRenderTarget(this.renderToScreen ? null : t), this.clear === !0 && l.clear(l.autoClearColor, l.autoClearDepth, l.autoClearStencil), l.render(this.scene, this.camera), this.clearColor !== null && l.setClearColor(this._oldClearColor), this.clearAlpha !== null && l.setClearAlpha(a), this.overrideMaterial !== null && (this.scene.overrideMaterial = s), l.autoClear = e;
33
+ }
34
+ }
35
+ export {
36
+ u as RenderPass
37
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("three"),r=require("./Pass-C1mreNp8.cjs");class h extends r.Pass{constructor(l,s,e=null,t=null,a=null){super(),this.scene=l,this.camera=s,this.overrideMaterial=e,this.clearColor=t,this.clearAlpha=a,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new o.Color}render(l,s,e){const t=l.autoClear;l.autoClear=!1;let a,i;this.overrideMaterial!==null&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(l.getClearColor(this._oldClearColor),l.setClearColor(this.clearColor,l.getClearAlpha())),this.clearAlpha!==null&&(a=l.getClearAlpha(),l.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&l.clearDepth(),l.setRenderTarget(this.renderToScreen?null:e),this.clear===!0&&l.clear(l.autoClearColor,l.autoClearDepth,l.autoClearStencil),l.render(this.scene,this.camera),this.clearColor!==null&&l.setClearColor(this._oldClearColor),this.clearAlpha!==null&&l.setClearAlpha(a),this.overrideMaterial!==null&&(this.scene.overrideMaterial=i),l.autoClear=t}}exports.RenderPass=h;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("three"),s=require("./Pass-C1mreNp8.cjs");class n extends s.Pass{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof i.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=i.UniformsUtils.clone(e.uniforms),this.material=new i.ShaderMaterial({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this._fsQuad=new s.FullScreenQuad(this.material)}render(e,t,a){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=a.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,45 @@
1
+ import { ShaderMaterial as s, UniformsUtils as a } from "three";
2
+ import { P as n, F as u } from "./Pass-DOcH4lwV.js";
3
+ class o extends n {
4
+ /**
5
+ * Constructs a new shader pass.
6
+ *
7
+ * @param {Object|ShaderMaterial} [shader] - A shader object holding vertex and fragment shader as well as
8
+ * defines and uniforms. It's also valid to pass a custom shader material.
9
+ * @param {string} [textureID='tDiffuse'] - The name of the texture uniform that should sample
10
+ * the read buffer.
11
+ */
12
+ constructor(t, i = "tDiffuse") {
13
+ super(), this.textureID = i, this.uniforms = null, this.material = null, t instanceof s ? (this.uniforms = t.uniforms, this.material = t) : t && (this.uniforms = a.clone(t.uniforms), this.material = new s({
14
+ name: t.name !== void 0 ? t.name : "unspecified",
15
+ defines: Object.assign({}, t.defines),
16
+ uniforms: this.uniforms,
17
+ vertexShader: t.vertexShader,
18
+ fragmentShader: t.fragmentShader
19
+ })), this._fsQuad = new u(this.material);
20
+ }
21
+ /**
22
+ * Performs the shader pass.
23
+ *
24
+ * @param {WebGLRenderer} renderer - The renderer.
25
+ * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering
26
+ * destination for the pass.
27
+ * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the
28
+ * previous pass from this buffer.
29
+ * @param {number} deltaTime - The delta time in seconds.
30
+ * @param {boolean} maskActive - Whether masking is active or not.
31
+ */
32
+ render(t, i, e) {
33
+ this.uniforms[this.textureID] && (this.uniforms[this.textureID].value = e.texture), this._fsQuad.material = this.material, this.renderToScreen ? (t.setRenderTarget(null), this._fsQuad.render(t)) : (t.setRenderTarget(i), this.clear && t.clear(t.autoClearColor, t.autoClearDepth, t.autoClearStencil), this._fsQuad.render(t));
34
+ }
35
+ /**
36
+ * Frees the GPU-related resources allocated by this instance. Call this
37
+ * method whenever the pass is no longer used in your app.
38
+ */
39
+ dispose() {
40
+ this.material.dispose(), this._fsQuad.dispose();
41
+ }
42
+ }
43
+ export {
44
+ o as ShaderPass
45
+ };