@needle-tools/engine 4.4.0-alpha.2 → 4.4.0-alpha.4
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/CHANGELOG.md +4 -1
- package/dist/gltf-progressive.js +54 -54
- package/dist/gltf-progressive.light.js +54 -54
- package/dist/gltf-progressive.light.min.js +7 -7
- package/dist/gltf-progressive.min.js +7 -7
- package/dist/needle-engine.bundle.js +6614 -6556
- package/dist/needle-engine.bundle.light.js +6397 -6339
- package/dist/needle-engine.bundle.light.min.js +134 -130
- package/dist/needle-engine.bundle.light.umd.cjs +66 -62
- package/dist/needle-engine.bundle.min.js +134 -130
- package/dist/needle-engine.bundle.umd.cjs +67 -63
- package/dist/needle-engine.d.ts +9 -9
- package/dist/needle-engine.js +511 -511
- package/dist/needle-engine.light.d.ts +9 -9
- package/dist/needle-engine.light.js +511 -511
- package/dist/needle-engine.light.min.js +1 -1
- package/dist/needle-engine.min.js +1 -1
- package/dist/postprocessing.js +38 -38
- package/dist/postprocessing.light.js +38 -38
- package/dist/postprocessing.light.min.js +2 -2
- package/dist/postprocessing.min.js +2 -2
- package/dist/three-examples.js +1205 -1205
- package/dist/three-examples.light.js +1205 -1205
- package/dist/three-examples.light.min.js +15 -15
- package/dist/three-examples.min.js +15 -15
- package/dist/three-mesh-ui.js +9 -9
- package/dist/three-mesh-ui.light.js +9 -9
- package/dist/three-mesh-ui.light.min.js +9 -9
- package/dist/three-mesh-ui.min.js +9 -9
- package/dist/three.js +238 -238
- package/dist/three.light.js +238 -238
- package/dist/three.light.min.js +24 -24
- package/dist/three.min.js +24 -24
- package/dist/vendor.js +24 -24
- package/dist/vendor.light.js +24 -24
- package/dist/vendor.light.min.js +2 -2
- package/dist/vendor.min.js +2 -2
- package/lib/engine/webcomponents/needle menu/needle-menu.js +4 -0
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine-components/Camera.d.ts +1 -1
- package/lib/engine-components/Camera.js +13 -0
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/CameraUtils.js +2 -1
- package/lib/engine-components/CameraUtils.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +2 -0
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +72 -4
- package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
- package/package.json +1 -1
- package/plugins/common/license.js +14 -5
- package/src/engine/webcomponents/needle menu/needle-menu.ts +4 -0
- package/src/engine-components/Camera.ts +16 -1
- package/src/engine-components/CameraUtils.ts +3 -2
- package/src/engine-components/postprocessing/Effects/Tonemapping.ts +2 -2
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +82 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Scene as ht, Camera as Gi, Mesh as Xt, BasicDepthPacking as V, WebGLRenderTarget as T, Material as Zt, Texture as je, ShaderMaterial as w, Uniform$1 as c, NoBlending as z, LinearFilter as P, UnsignedByteType as W, SRGBColorSpace as y, Vector2 as p, DepthTexture as Ce, DepthStencilFormat as jt, UnsignedInt248Type as Jt, UnsignedIntType as be, LinearSRGBColorSpace as Je, BackSide as ke, DoubleSide as Qe, FrontSide as ki, EventDispatcher as wt, Vector4 as Fe, REVISION as Be, NoColorSpace as tt, PerspectiveCamera as Pe, DataTexture as it, LuminanceFormat as qt, RGBAFormat as N, NearestFilter as B, RepeatWrapping as de, LessDepth as It, Color as H, Vector3 as F, FloatType as j, HalfFloatType as _, Data3DTexture as Xe, ClampToEdgeWrapping as at, RGBADepthPacking as re, MeshDepthMaterial as Qi, EqualDepth as dt, NotEqualDepth as _t, LoadingManager as Oe, Matrix4 as L, LinearMipmapLinearFilter as Vi, Loader as Tt, FileLoader as $t, MeshNormalMaterial as Wi, BufferGeometry as ei, BufferAttribute as qe, GreaterDepth as Yi, GreaterEqualDepth as Ki, LessEqualDepth as Xi, AlwaysDepth as Zi, NeverDepth as ji, RedFormat as St, RGFormat as Ji, Sphere as qi, OrthographicCamera as _i, DepthFormat as Rt } from "./three.light.js";
|
|
2
|
+
import { Pass as $i } from "./three-examples.light.js";
|
|
3
3
|
/**
|
|
4
4
|
* postprocessing v6.36.6 build Tue Dec 31 2024
|
|
5
5
|
* https://github.com/pmndrs/postprocessing
|
|
@@ -423,7 +423,7 @@ uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuf
|
|
|
423
423
|
initialize(e, t, i) {
|
|
424
424
|
i !== void 0 && (this.renderTarget.texture.type = i, i !== W ? this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH = "1" : e !== null && e.outputColorSpace === y && (this.renderTarget.texture.colorSpace = y));
|
|
425
425
|
}
|
|
426
|
-
},
|
|
426
|
+
}, Ut = /* @__PURE__ */ new H(), pe = class extends O {
|
|
427
427
|
/**
|
|
428
428
|
* Constructs a new clear pass.
|
|
429
429
|
*
|
|
@@ -491,7 +491,7 @@ uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuf
|
|
|
491
491
|
*/
|
|
492
492
|
render(e, t, i, r, a) {
|
|
493
493
|
const s = this.overrideClearColor, n = this.overrideClearAlpha, o = e.getClearAlpha(), l = s !== null, u = n >= 0;
|
|
494
|
-
l ? (e.getClearColor(
|
|
494
|
+
l ? (e.getClearColor(Ut), e.setClearColor(s, u ? n : o)) : u && e.setClearAlpha(n), e.setRenderTarget(this.renderToScreen ? null : t), e.clear(this.color, this.depth, this.stencil), l ? e.setClearColor(Ut, o) : u && e.setClearAlpha(o);
|
|
495
495
|
}
|
|
496
496
|
}, ri = class extends O {
|
|
497
497
|
/**
|
|
@@ -674,7 +674,7 @@ uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuf
|
|
|
674
674
|
*/
|
|
675
675
|
createDepthTexture() {
|
|
676
676
|
const e = this.depthTexture = new Ce();
|
|
677
|
-
return this.inputBuffer.depthTexture = e, this.inputBuffer.dispose(), this.inputBuffer.stencilBuffer ? (e.format = jt, e.type = Jt) : e.type =
|
|
677
|
+
return this.inputBuffer.depthTexture = e, this.inputBuffer.dispose(), this.inputBuffer.stencilBuffer ? (e.format = jt, e.type = Jt) : e.type = be, e;
|
|
678
678
|
}
|
|
679
679
|
/**
|
|
680
680
|
* Deletes the current depth texture.
|
|
@@ -829,7 +829,7 @@ uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuf
|
|
|
829
829
|
]), this.defines = /* @__PURE__ */ new Map(), this.uniforms = /* @__PURE__ */ new Map(), this.blendModes = /* @__PURE__ */ new Map(), this.extensions = /* @__PURE__ */ new Set(), this.attributes = Q.NONE, this.varyings = /* @__PURE__ */ new Set(), this.uvTransformation = !1, this.readDepth = !1, this.colorSpace = Je;
|
|
830
830
|
}
|
|
831
831
|
};
|
|
832
|
-
function
|
|
832
|
+
function bt(e) {
|
|
833
833
|
let t;
|
|
834
834
|
if (e === 0)
|
|
835
835
|
t = new Float64Array(0);
|
|
@@ -881,7 +881,7 @@ var si = class {
|
|
|
881
881
|
generate(e, t) {
|
|
882
882
|
if (e < 3 || e > 1020)
|
|
883
883
|
throw new Error("The kernel size must be in the range [3, 1020]");
|
|
884
|
-
const i = e + t * 2, r = t > 0 ?
|
|
884
|
+
const i = e + t * 2, r = t > 0 ? bt(i).slice(t, -t) : bt(i), a = Math.floor((r.length - 1) / 2), s = r.reduce((h, d) => h + d, 0), n = r.slice(a), o = [...Array(a + 1).keys()], l = new Float64Array(Math.floor(o.length / 2)), u = new Float64Array(l.length);
|
|
885
885
|
l[0] = n[0] / s;
|
|
886
886
|
for (let h = 1, d = 1, v = o.length - 1; h < v; h += 2, ++d) {
|
|
887
887
|
const A = o[h], m = o[h + 1], E = n[h], C = n[h + 1], S = E + C, D = (A * E + m * C) / S;
|
|
@@ -1538,7 +1538,7 @@ var si = class {
|
|
|
1538
1538
|
SRC: 30,
|
|
1539
1539
|
SUBTRACT: 31,
|
|
1540
1540
|
VIVID_LIGHT: 32
|
|
1541
|
-
}, cr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y,opacity);}", fr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,min(y.a,opacity));}", hr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y)*0.5,opacity);}", dr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.rg,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}", vr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(step(0.0,y)*(1.0-min(vec4(1.0),(1.0-x)/y)),vec4(1.0),step(1.0,x));return mix(x,z,opacity);}", pr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=step(0.0,x)*mix(min(vec4(1.0),x/max(1.0-y,1e-9)),vec4(1.0),step(1.0,y));return mix(x,z,opacity);}", gr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x,y),opacity);}", mr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,abs(x-y),opacity);}", Ar = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x/max(y,1e-12),opacity);}", xr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y-2.0*x*y),opacity);}", Dr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 a=min(x,1.0),b=min(y,1.0);vec4 z=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,y));return mix(x,z,opacity);}", wr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,step(1.0,x+y),opacity);}", Tr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.r,xHSL.gb));return vec4(mix(x.rgb,z,opacity),y.a);}", Sr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-y,opacity);}", Er = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y*(1.0-x),opacity);}", Cr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x,y),opacity);}", yr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(y+x-1.0,0.0,1.0),opacity);}", Mr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x+y,1.0),opacity);}", Br = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(2.0*y+x-1.0,0.0,1.0),opacity);}", Pr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.rg,yHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}", Ir = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x*y,opacity);}", Rr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-abs(1.0-x-y),opacity);}",
|
|
1541
|
+
}, cr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y,opacity);}", fr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,min(y.a,opacity));}", hr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y)*0.5,opacity);}", dr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.rg,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}", vr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(step(0.0,y)*(1.0-min(vec4(1.0),(1.0-x)/y)),vec4(1.0),step(1.0,x));return mix(x,z,opacity);}", pr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=step(0.0,x)*mix(min(vec4(1.0),x/max(1.0-y,1e-9)),vec4(1.0),step(1.0,y));return mix(x,z,opacity);}", gr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x,y),opacity);}", mr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,abs(x-y),opacity);}", Ar = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x/max(y,1e-12),opacity);}", xr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y-2.0*x*y),opacity);}", Dr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 a=min(x,1.0),b=min(y,1.0);vec4 z=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,y));return mix(x,z,opacity);}", wr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,step(1.0,x+y),opacity);}", Tr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.r,xHSL.gb));return vec4(mix(x.rgb,z,opacity),y.a);}", Sr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-y,opacity);}", Er = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y*(1.0-x),opacity);}", Cr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x,y),opacity);}", yr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(y+x-1.0,0.0,1.0),opacity);}", Mr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x+y,1.0),opacity);}", Br = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(2.0*y+x-1.0,0.0,1.0),opacity);}", Pr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.rg,yHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}", Ir = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x*y,opacity);}", Rr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-abs(1.0-x-y),opacity);}", Ur = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,opacity);}", br = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(2.0*y*x,1.0-2.0*(1.0-y)*(1.0-x),step(0.5,x));return mix(x,z,opacity);}", Fr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 z=mix(mix(y2,x,step(0.5*x,y)),max(vec4(0.0),y2-1.0),step(x,(y2-1.0)));return mix(x,z,opacity);}", Lr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(min(x*x/max(1.0-y,1e-12),1.0),y,step(1.0,y));return mix(x,z,opacity);}", Or = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.r,yHSL.g,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}", Nr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y-min(x*y,1.0),opacity);}", Hr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 w=step(0.5,y);vec4 z=mix(x-(1.0-y2)*x*(1.0-x),mix(x+(y2-1.0)*(sqrt(x)-x),x+(y2-1.0)*x*((16.0*x-12.0)*x+3.0),w*(1.0-step(0.25,x))),w);return mix(x,z,opacity);}", zr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y;}", Gr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x+y-1.0,0.0),opacity);}", kr = "vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(max(1.0-min((1.0-x)/(2.0*y),1.0),0.0),min(x/(2.0*(1.0-y)),1.0),step(0.5,y));return mix(x,z,opacity);}", Qr = /* @__PURE__ */ new Map([
|
|
1542
1542
|
[g.ADD, cr],
|
|
1543
1543
|
[g.ALPHA, fr],
|
|
1544
1544
|
[g.AVERAGE, hr],
|
|
@@ -1562,8 +1562,8 @@ var si = class {
|
|
|
1562
1562
|
[g.LUMINOSITY, Pr],
|
|
1563
1563
|
[g.MULTIPLY, Ir],
|
|
1564
1564
|
[g.NEGATION, Rr],
|
|
1565
|
-
[g.NORMAL,
|
|
1566
|
-
[g.OVERLAY,
|
|
1565
|
+
[g.NORMAL, Ur],
|
|
1566
|
+
[g.OVERLAY, br],
|
|
1567
1567
|
[g.PIN_LIGHT, Fr],
|
|
1568
1568
|
[g.REFLECT, Lr],
|
|
1569
1569
|
[g.SATURATION, Or],
|
|
@@ -3360,7 +3360,7 @@ vec4 acc=vec4(0.0);for(int i=0;i<32;++i){vec4 kernel=kernel64[i];vec2 uv=step*ke
|
|
|
3360
3360
|
#else
|
|
3361
3361
|
vec4 maxValue=texture2D(inputBuffer,vUv);for(int i=0;i<8;++i){vec4 kernel=kernel16[i];vec2 uv=step*kernel.xy+vUv;maxValue=max(texture2D(inputBuffer,uv),maxValue);uv=step*kernel.zw+vUv;maxValue=max(texture2D(inputBuffer,uv),maxValue);}gl_FragColor=maxValue;
|
|
3362
3362
|
#endif
|
|
3363
|
-
}}`,
|
|
3363
|
+
}}`, Ue = class extends w {
|
|
3364
3364
|
/**
|
|
3365
3365
|
* Constructs a new bokeh material.
|
|
3366
3366
|
*
|
|
@@ -3988,7 +3988,7 @@ vec4 result=inputColor*(1.0-cocNearFar.y)+colorFar;result=mix(result,colorNear,c
|
|
|
3988
3988
|
const v = this.cocMaterial;
|
|
3989
3989
|
v.focusDistance = a, v.focusRange = n, i !== void 0 && (v.worldFocusDistance = i), r !== void 0 && (v.worldFocusRange = r), this.blurPass = new ve({ resolutionScale: l, resolutionX: h, resolutionY: d, kernelSize: ee.MEDIUM }), this.maskPass = new J(new di(this.renderTargetCoC.texture));
|
|
3990
3990
|
const A = this.maskPass.fullscreenMaterial;
|
|
3991
|
-
A.colorChannel = ce.GREEN, this.maskFunction = yt.MULTIPLY_RGB, this.bokehNearBasePass = new J(new
|
|
3991
|
+
A.colorChannel = ce.GREEN, this.maskFunction = yt.MULTIPLY_RGB, this.bokehNearBasePass = new J(new Ue(!1, !0)), this.bokehNearBasePass.fullscreenMaterial.cocBuffer = this.renderTargetCoCBlurred.texture, this.bokehNearFillPass = new J(new Ue(!0, !0)), this.bokehNearFillPass.fullscreenMaterial.cocBuffer = this.renderTargetCoCBlurred.texture, this.bokehFarBasePass = new J(new Ue(!1, !1)), this.bokehFarBasePass.fullscreenMaterial.cocBuffer = this.renderTargetCoC.texture, this.bokehFarFillPass = new J(new Ue(!0, !1)), this.bokehFarFillPass.fullscreenMaterial.cocBuffer = this.renderTargetCoC.texture, this.target = null;
|
|
3992
3992
|
const m = this.resolution = new x(this, h, d, l);
|
|
3993
3993
|
m.addEventListener("change", (E) => this.setSize(m.baseWidth, m.baseHeight)), this.bokehScale = o;
|
|
3994
3994
|
}
|
|
@@ -5766,7 +5766,7 @@ void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){o
|
|
|
5766
5766
|
const i = e / t, r = this.scale * (t * 0.125);
|
|
5767
5767
|
this.uniforms.get("scale").value.set(i * r, r), this.uniforms.get("lineWidth").value = r / t + this.lineWidth;
|
|
5768
5768
|
}
|
|
5769
|
-
},
|
|
5769
|
+
}, Ua = "uniform vec3 hue;uniform float saturation;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=vec3(dot(inputColor.rgb,hue.xyz),dot(inputColor.rgb,hue.zxy),dot(inputColor.rgb,hue.yzx));float average=(color.r+color.g+color.b)/3.0;vec3 diff=average-color;if(saturation>0.0){color+=diff*(1.0-1.0/(1.001-saturation));}else{color+=diff*-saturation;}outputColor=vec4(min(color,1.0),inputColor.a);}", ba = class extends I {
|
|
5770
5770
|
/**
|
|
5771
5771
|
* Constructs a new hue/saturation effect.
|
|
5772
5772
|
*
|
|
@@ -5776,7 +5776,7 @@ void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){o
|
|
|
5776
5776
|
* @param {Number} [options.saturation=0.0] - The saturation factor, ranging from -1 to 1, where 0 means no change.
|
|
5777
5777
|
*/
|
|
5778
5778
|
constructor({ blendFunction: e = g.SRC, hue: t = 0, saturation: i = 0 } = {}) {
|
|
5779
|
-
super("HueSaturationEffect",
|
|
5779
|
+
super("HueSaturationEffect", Ua, {
|
|
5780
5780
|
blendFunction: e,
|
|
5781
5781
|
uniforms: /* @__PURE__ */ new Map([
|
|
5782
5782
|
["hue", new c(new F())],
|
|
@@ -9447,9 +9447,9 @@ outputColor=vec4(vec3(1.0-ao),inputColor.a);
|
|
|
9447
9447
|
color: $ = null,
|
|
9448
9448
|
resolutionScale: te = 1,
|
|
9449
9449
|
width: ie = x.AUTO_SIZE,
|
|
9450
|
-
height:
|
|
9450
|
+
height: b = x.AUTO_SIZE,
|
|
9451
9451
|
resolutionX: ge = ie,
|
|
9452
|
-
resolutionY: me =
|
|
9452
|
+
resolutionY: me = b
|
|
9453
9453
|
} = {}) {
|
|
9454
9454
|
super("SSAOEffect", Ds, {
|
|
9455
9455
|
blendFunction: i,
|
|
@@ -10371,7 +10371,7 @@ outputColor=vec4(Uncharted2ToneMapping(inputColor.rgb),inputColor.a);
|
|
|
10371
10371
|
#else
|
|
10372
10372
|
outputColor=vec4(toneMapping(inputColor.rgb),inputColor.a);
|
|
10373
10373
|
#endif
|
|
10374
|
-
}`,
|
|
10374
|
+
}`, Us = class extends I {
|
|
10375
10375
|
/**
|
|
10376
10376
|
* Constructs a new tone mapping effect.
|
|
10377
10377
|
*
|
|
@@ -10617,7 +10617,7 @@ outputColor=vec4(toneMapping(inputColor.rgb),inputColor.a);
|
|
|
10617
10617
|
initialize(e, t, i) {
|
|
10618
10618
|
this.adaptiveLuminancePass.initialize(e, t, i);
|
|
10619
10619
|
}
|
|
10620
|
-
},
|
|
10620
|
+
}, bs = `uniform float offset;uniform float darkness;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){const vec2 center=vec2(0.5);vec3 color=inputColor.rgb;
|
|
10621
10621
|
#if VIGNETTE_TECHNIQUE == 0
|
|
10622
10622
|
float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offset));
|
|
10623
10623
|
#else
|
|
@@ -10641,7 +10641,7 @@ outputColor=vec4(color,inputColor.a);}`, Fs = class extends I {
|
|
|
10641
10641
|
offset: r = 0.5,
|
|
10642
10642
|
darkness: a = 0.5
|
|
10643
10643
|
} = {}) {
|
|
10644
|
-
super("VignetteEffect",
|
|
10644
|
+
super("VignetteEffect", bs, {
|
|
10645
10645
|
blendFunction: e,
|
|
10646
10646
|
defines: /* @__PURE__ */ new Map([
|
|
10647
10647
|
["VIGNETTE_TECHNIQUE", i.toFixed(0)]
|
|
@@ -12371,7 +12371,7 @@ var $s = class extends O {
|
|
|
12371
12371
|
}, kt = [
|
|
12372
12372
|
new Float32Array(3),
|
|
12373
12373
|
new Float32Array(3)
|
|
12374
|
-
],
|
|
12374
|
+
], U = [
|
|
12375
12375
|
new Float32Array(3),
|
|
12376
12376
|
new Float32Array(3),
|
|
12377
12377
|
new Float32Array(3),
|
|
@@ -12431,10 +12431,10 @@ function an(e, t, i, r, a, s) {
|
|
|
12431
12431
|
m >= E && E >= C ? S = Ae[0] : m >= C && C >= E ? S = Ae[1] : C >= m && m >= E ? S = Ae[2] : E >= m && m >= C ? S = Ae[3] : E >= C && C >= m ? S = Ae[4] : C >= E && E >= m && (S = Ae[5]);
|
|
12432
12432
|
const [D, Y, $, te] = S, ie = kt[0];
|
|
12433
12433
|
ie[0] = m, ie[1] = E, ie[2] = C;
|
|
12434
|
-
const
|
|
12435
|
-
|
|
12434
|
+
const b = kt[1], ge = d - u, me = v - f, ae = A - h;
|
|
12435
|
+
b[0] = ge * D[0] + u, b[1] = me * D[1] + f, b[2] = ae * D[2] + h, Re(e, t, b[0], b[1], b[2], U[0]), b[0] = ge * Y[0] + u, b[1] = me * Y[1] + f, b[2] = ae * Y[2] + h, Re(e, t, b[0], b[1], b[2], U[1]), b[0] = ge * $[0] + u, b[1] = me * $[1] + f, b[2] = ae * $[2] + h, Re(e, t, b[0], b[1], b[2], U[2]), b[0] = ge * te[0] + u, b[1] = me * te[1] + f, b[2] = ae * te[2] + h, Re(e, t, b[0], b[1], b[2], U[3]);
|
|
12436
12436
|
const ue = We(Y, $, te, ie) * 6, G = We(D, $, te, ie) * 6, Ge = We(D, Y, te, ie) * 6, rt = We(D, Y, $, ie) * 6;
|
|
12437
|
-
|
|
12437
|
+
U[0][0] *= ue, U[0][1] *= ue, U[0][2] *= ue, U[1][0] *= G, U[1][1] *= G, U[1][2] *= G, U[2][0] *= Ge, U[2][1] *= Ge, U[2][2] *= Ge, U[3][0] *= rt, U[3][1] *= rt, U[3][2] *= rt, s[0] = U[0][0] + U[1][0] + U[2][0] + U[3][0], s[1] = U[0][1] + U[1][1] + U[2][1] + U[3][1], s[2] = U[0][2] + U[1][2] + U[2][2] + U[3][2];
|
|
12438
12438
|
}
|
|
12439
12439
|
}
|
|
12440
12440
|
var sn = class {
|
|
@@ -12873,7 +12873,7 @@ const Mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
12873
12873
|
BloomEffect: fi,
|
|
12874
12874
|
BlurPass: ve,
|
|
12875
12875
|
BokehEffect: $r,
|
|
12876
|
-
BokehMaterial:
|
|
12876
|
+
BokehMaterial: Ue,
|
|
12877
12877
|
BoxBlurMaterial: Mi,
|
|
12878
12878
|
BoxBlurPass: Ks,
|
|
12879
12879
|
BrightnessContrastEffect: ta,
|
|
@@ -12923,7 +12923,7 @@ const Mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
12923
12923
|
GodRaysEffect: Pa,
|
|
12924
12924
|
GodRaysMaterial: vi,
|
|
12925
12925
|
GridEffect: Ra,
|
|
12926
|
-
HueSaturationEffect:
|
|
12926
|
+
HueSaturationEffect: ba,
|
|
12927
12927
|
ImmutableTimer: nr,
|
|
12928
12928
|
Initializable: or,
|
|
12929
12929
|
KawaseBlurMaterial: $e,
|
|
@@ -12984,7 +12984,7 @@ const Mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
12984
12984
|
TiltShiftBlurPass: Ei,
|
|
12985
12985
|
TiltShiftEffect: Ps,
|
|
12986
12986
|
Timer: ti,
|
|
12987
|
-
ToneMappingEffect:
|
|
12987
|
+
ToneMappingEffect: Us,
|
|
12988
12988
|
ToneMappingMode: Z,
|
|
12989
12989
|
UpsamplingMaterial: ui,
|
|
12990
12990
|
VignetteEffect: Fs,
|
|
@@ -13029,7 +13029,7 @@ class q {
|
|
|
13029
13029
|
this._mesh.material.dispose(), this._mesh.geometry.dispose();
|
|
13030
13030
|
}
|
|
13031
13031
|
}
|
|
13032
|
-
const
|
|
13032
|
+
const Ui = {
|
|
13033
13033
|
uniforms: {
|
|
13034
13034
|
sceneDiffuse: {
|
|
13035
13035
|
value: null
|
|
@@ -13326,7 +13326,7 @@ void main() {
|
|
|
13326
13326
|
gl_FragColor = vec4(occ, 0.5 + 0.5 * normal);
|
|
13327
13327
|
}`
|
|
13328
13328
|
)
|
|
13329
|
-
},
|
|
13329
|
+
}, bi = {
|
|
13330
13330
|
uniforms: {
|
|
13331
13331
|
sceneDiffuse: {
|
|
13332
13332
|
value: null
|
|
@@ -14198,7 +14198,7 @@ class Tn extends O {
|
|
|
14198
14198
|
magFilter: B,
|
|
14199
14199
|
type: _,
|
|
14200
14200
|
format: N
|
|
14201
|
-
}), this.transparencyRenderTargetDWTrue.depthTexture = new Ce(this.width, this.height,
|
|
14201
|
+
}), this.transparencyRenderTargetDWTrue.depthTexture = new Ce(this.width, this.height, be), this.depthCopyPass = new q(new w({
|
|
14202
14202
|
uniforms: {
|
|
14203
14203
|
depthTexture: {
|
|
14204
14204
|
value: this.depthTexture
|
|
@@ -14244,7 +14244,7 @@ class Tn extends O {
|
|
|
14244
14244
|
configureAOPass(t = !1, i = !1) {
|
|
14245
14245
|
this.firstFrame(), this.samples = this.generateHemisphereSamples(this.configuration.aoSamples);
|
|
14246
14246
|
const r = {
|
|
14247
|
-
...
|
|
14247
|
+
...Ui
|
|
14248
14248
|
};
|
|
14249
14249
|
r.fragmentShader = r.fragmentShader.replace("16", this.configuration.aoSamples).replace("16.0", this.configuration.aoSamples + ".0"), t && (r.fragmentShader = `#define LOGDEPTH
|
|
14250
14250
|
` + r.fragmentShader), i && (r.fragmentShader = `#define ORTHO
|
|
@@ -14263,7 +14263,7 @@ class Tn extends O {
|
|
|
14263
14263
|
configureEffectCompositer(t = !1, i = !1) {
|
|
14264
14264
|
this.firstFrame();
|
|
14265
14265
|
const r = {
|
|
14266
|
-
...
|
|
14266
|
+
...bi
|
|
14267
14267
|
};
|
|
14268
14268
|
t && (r.fragmentShader = `#define LOGDEPTH
|
|
14269
14269
|
` + r.fragmentShader), i && (r.fragmentShader = `#define ORTHO
|
|
@@ -14419,7 +14419,7 @@ class En extends $i {
|
|
|
14419
14419
|
type: _,
|
|
14420
14420
|
format: N,
|
|
14421
14421
|
stencilBuffer: o
|
|
14422
|
-
}), this.beautyRenderTarget.depthTexture = new Ce(this.width, this.height, o ? Jt :
|
|
14422
|
+
}), this.beautyRenderTarget.depthTexture = new Ce(this.width, this.height, o ? Jt : be), this.beautyRenderTarget.depthTexture.format = o ? jt : Rt), !0;
|
|
14423
14423
|
}
|
|
14424
14424
|
}), this.samples = [], this.samplesDenoise = [], this.autoDetectTransparency = !0, this.frame = 0, this.lastViewMatrix = new L(), this.lastProjectionMatrix = new L(), this.beautyRenderTarget = new T(this.width, this.height, {
|
|
14425
14425
|
minFilter: P,
|
|
@@ -14427,7 +14427,7 @@ class En extends $i {
|
|
|
14427
14427
|
type: _,
|
|
14428
14428
|
format: N,
|
|
14429
14429
|
stencilBuffer: !1
|
|
14430
|
-
}), this.beautyRenderTarget.depthTexture = new Ce(this.width, this.height,
|
|
14430
|
+
}), this.beautyRenderTarget.depthTexture = new Ce(this.width, this.height, be), this.beautyRenderTarget.depthTexture.format = Rt, this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer, this.camera.isOrthographicCamera), this.configureSampleDependentPasses(), this.configureHalfResTargets(), this.detectTransparency(), this.configureTransparencyTarget(), this.writeTargetInternal = new T(this.width, this.height, {
|
|
14431
14431
|
minFilter: P,
|
|
14432
14432
|
magFilter: P,
|
|
14433
14433
|
depthBuffer: !1,
|
|
@@ -14496,7 +14496,7 @@ class En extends $i {
|
|
|
14496
14496
|
magFilter: B,
|
|
14497
14497
|
type: _,
|
|
14498
14498
|
format: N
|
|
14499
|
-
}), this.transparencyRenderTargetDWTrue.depthTexture = new Ce(this.width, this.height,
|
|
14499
|
+
}), this.transparencyRenderTargetDWTrue.depthTexture = new Ce(this.width, this.height, be), this.depthCopyPass = new q(new w({
|
|
14500
14500
|
uniforms: {
|
|
14501
14501
|
depthTexture: {
|
|
14502
14502
|
value: this.beautyRenderTarget.depthTexture
|
|
@@ -14542,7 +14542,7 @@ class En extends $i {
|
|
|
14542
14542
|
configureAOPass(t = !1, i = !1) {
|
|
14543
14543
|
this.firstFrame(), this.samples = this.generateHemisphereSamples(this.configuration.aoSamples);
|
|
14544
14544
|
const r = {
|
|
14545
|
-
...
|
|
14545
|
+
...Ui
|
|
14546
14546
|
};
|
|
14547
14547
|
r.fragmentShader = r.fragmentShader.replace("16", this.configuration.aoSamples).replace("16.0", this.configuration.aoSamples + ".0"), t && (r.fragmentShader = `#define LOGDEPTH
|
|
14548
14548
|
` + r.fragmentShader), i && (r.fragmentShader = `#define ORTHO
|
|
@@ -14561,7 +14561,7 @@ class En extends $i {
|
|
|
14561
14561
|
configureEffectCompositer(t = !1, i = !1) {
|
|
14562
14562
|
this.firstFrame();
|
|
14563
14563
|
const r = {
|
|
14564
|
-
...
|
|
14564
|
+
...bi
|
|
14565
14565
|
};
|
|
14566
14566
|
t && (r.fragmentShader = `#define LOGDEPTH
|
|
14567
14567
|
` + r.fragmentShader), i && (r.fragmentShader = `#define ORTHO
|
|
@@ -14663,6 +14663,6 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
14663
14663
|
N8AOPostPass: Tn
|
|
14664
14664
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
14665
14665
|
export {
|
|
14666
|
-
Bn as
|
|
14667
|
-
Mn as
|
|
14666
|
+
Bn as N8AO,
|
|
14667
|
+
Mn as index
|
|
14668
14668
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Scene as at,Camera as Gr,Mesh as It,BasicDepthPacking as k,WebGLRenderTarget as w,Material as Rt,Texture as ke,ShaderMaterial as T,Uniform$1 as c,NoBlending as N,LinearFilter as P,UnsignedByteType as Y,SRGBColorSpace as y,Vector2 as v,DepthTexture as Ae,DepthStencilFormat as bt,UnsignedInt248Type as Ut,UnsignedIntType as Ie,LinearSRGBColorSpace as Qe,BackSide as Ve,DoubleSide as Ye,FrontSide as kr,EventDispatcher as st,Vector4 as Re,REVISION as xe,NoColorSpace as We,PerspectiveCamera as De,DataTexture as Ke,LuminanceFormat as Ft,RGBAFormat as H,NearestFilter as M,RepeatWrapping as ce,LessDepth as Lt,Color as z,Vector3 as F,FloatType as X,HalfFloatType as _,Data3DTexture as Xe,ClampToEdgeWrapping as nt,RGBADepthPacking as ie,MeshDepthMaterial as Qr,EqualDepth as ot,NotEqualDepth as Ot,LoadingManager as be,Matrix4 as L,LinearMipmapLinearFilter as Vr,Loader as lt,FileLoader as Nt,MeshNormalMaterial as Yr,BufferGeometry as Ht,BufferAttribute as Ze,GreaterDepth as Wr,GreaterEqualDepth as Kr,LessEqualDepth as Xr,AlwaysDepth as Zr,NeverDepth as jr,RedFormat as ut,RGFormat as Jr,Sphere as qr,OrthographicCamera as _r,DepthFormat as zt}from"./three.light.min.js";import{Pass as $r}from"./three-examples.light.min.js";/**
|
|
2
2
|
* postprocessing v6.36.6 build Tue Dec 31 2024
|
|
3
3
|
* https://github.com/pmndrs/postprocessing
|
|
4
4
|
* Copyright 2015-2024 Raoul van Rüschen
|
|
@@ -1620,4 +1620,4 @@ void main() {
|
|
|
1620
1620
|
`+i.fragmentShader),this.poissonBlurQuad?(this.poissonBlurQuad.material.dispose(),this.poissonBlurQuad.material=new T(i)):this.poissonBlurQuad=new q(new T(i))}configureEffectCompositer(t=!1,r=!1){this.firstFrame();const i={...br};t&&(i.fragmentShader=`#define LOGDEPTH
|
|
1621
1621
|
`+i.fragmentShader),r&&(i.fragmentShader=`#define ORTHO
|
|
1622
1622
|
`+i.fragmentShader),this.configuration.halfRes&&this.configuration.depthAwareUpsampling&&(i.fragmentShader=`#define HALFRES
|
|
1623
|
-
`+i.fragmentShader),this.effectCompositerQuad?(this.effectCompositerQuad.material.dispose(),this.effectCompositerQuad.material=new T(i)):this.effectCompositerQuad=new q(new T(i))}generateHemisphereSamples(t){const r=[];for(let i=0;i<t;i++){const a=2.399963*i;let n=Math.sqrt(i+.5)/Math.sqrt(t);const s=n*Math.cos(a),o=n*Math.sin(a),l=Math.sqrt(1-(s*s+o*o));r.push(new F(s,o,l))}return r}generateDenoiseSamples(t,r){const i=2*Math.PI*r/t,a=1/t,n=a,s=[];let o=a,l=0;for(let u=0;u<t;u++)s.push(new v(Math.cos(l),Math.sin(l)).multiplyScalar(Math.pow(o,.75))),o+=n,l+=i;return s}setSize(t,r){this.firstFrame(),this.width=t,this.height=r;const i=this.configuration.halfRes?.5:1;this.beautyRenderTarget.setSize(t,r),this.writeTargetInternal.setSize(t*i,r*i),this.readTargetInternal.setSize(t*i,r*i),this.accumulationRenderTarget.setSize(t*i,r*i),this.configuration.halfRes&&this.depthDownsampleTarget.setSize(t*i,r*i),this.configuration.transparencyAware&&(this.transparencyRenderTargetDWFalse.setSize(t,r),this.transparencyRenderTargetDWTrue.setSize(t,r))}firstFrame(){this.needsFrame=!0}render(t,r,i,a,n){t.capabilities.logarithmicDepthBuffer!==this.configuration.logarithmicDepthBuffer&&(this.configuration.logarithmicDepthBuffer=t.capabilities.logarithmicDepthBuffer,this.configureAOPass(this.configuration.logarithmicDepthBuffer,this.camera.isOrthographicCamera),this.configureDenoisePass(this.configuration.logarithmicDepthBuffer,this.camera.isOrthographicCamera),this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer,this.camera.isOrthographicCamera)),this.detectTransparency(),this.camera.updateMatrixWorld(),this.lastViewMatrix.equals(this.camera.matrixWorldInverse)&&this.lastProjectionMatrix.equals(this.camera.projectionMatrix)&&this.configuration.accumulate&&!this.needsFrame?this.frame++:(this.configuration.accumulate&&(t.setRenderTarget(this.accumulationRenderTarget),t.clear(!0,!0,!0)),this.frame=0,this.needsFrame=!1),this.lastViewMatrix.copy(this.camera.matrixWorldInverse),this.lastProjectionMatrix.copy(this.camera.projectionMatrix);let s,o,l;this.debugMode&&(s=t.getContext(),o=s.getExtension("EXT_disjoint_timer_query_webgl2"),o===null&&(console.error("EXT_disjoint_timer_query_webgl2 not available, disabling debug mode."),this.debugMode=!1)),this.configuration.autoRenderBeauty&&(t.setRenderTarget(this.beautyRenderTarget),t.render(this.scene,this.camera),this.configuration.transparencyAware&&this.renderTransparency(t)),this.debugMode&&(l=s.createQuery(),s.beginQuery(o.TIME_ELAPSED_EXT,l));const u=t.xr.enabled;t.xr.enabled=!1,this._r.set(this.width,this.height);let h=this.configuration.aoRadius;if(this.configuration.halfRes&&this.configuration.screenSpaceRadius&&(h*=.5),this.frame<1024/this.configuration.aoSamples){this.configuration.halfRes&&(t.setRenderTarget(this.depthDownsampleTarget),this.depthDownsampleQuad.material.uniforms.sceneDepth.value=this.beautyRenderTarget.depthTexture,this.depthDownsampleQuad.material.uniforms.resolution.value=this._r,this.depthDownsampleQuad.material.uniforms.near.value=this.camera.near,this.depthDownsampleQuad.material.uniforms.far.value=this.camera.far,this.depthDownsampleQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.depthDownsampleQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.depthDownsampleQuad.material.uniforms.logDepth.value=this.configuration.logarithmicDepthBuffer,this.depthDownsampleQuad.material.uniforms.ortho.value=this.camera.isOrthographicCamera,this.depthDownsampleQuad.render(t)),this.effectShaderQuad.material.uniforms.sceneDiffuse.value=this.beautyRenderTarget.texture,this.effectShaderQuad.material.uniforms.sceneDepth.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[0]:this.beautyRenderTarget.depthTexture,this.effectShaderQuad.material.uniforms.sceneNormal.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[1]:null,this.effectShaderQuad.material.uniforms.projMat.value=this.camera.projectionMatrix,this.effectShaderQuad.material.uniforms.viewMat.value=this.camera.matrixWorldInverse,this.effectShaderQuad.material.uniforms.projViewMat.value=this.camera.projectionMatrix.clone().multiply(this.camera.matrixWorldInverse.clone()),this.effectShaderQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.effectShaderQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.effectShaderQuad.material.uniforms.cameraPos.value=this.camera.getWorldPosition(new F),this.effectShaderQuad.material.uniforms.biasAdjustment.value=new v(this.configuration.biasOffset,this.configuration.biasMultiplier),this.effectShaderQuad.material.uniforms.resolution.value=this.configuration.halfRes?this._r.clone().multiplyScalar(.5).floor():this._r,this.effectShaderQuad.material.uniforms.time.value=performance.now()/1e3,this.effectShaderQuad.material.uniforms.samples.value=this.samples,this.effectShaderQuad.material.uniforms.bluenoise.value=this.bluenoise,this.effectShaderQuad.material.uniforms.radius.value=h,this.effectShaderQuad.material.uniforms.distanceFalloff.value=this.configuration.distanceFalloff,this.effectShaderQuad.material.uniforms.near.value=this.camera.near,this.effectShaderQuad.material.uniforms.far.value=this.camera.far,this.effectShaderQuad.material.uniforms.logDepth.value=t.capabilities.logarithmicDepthBuffer,this.effectShaderQuad.material.uniforms.ortho.value=this.camera.isOrthographicCamera,this.effectShaderQuad.material.uniforms.screenSpaceRadius.value=this.configuration.screenSpaceRadius,this.effectShaderQuad.material.uniforms.frame.value=this.frame,t.setRenderTarget(this.writeTargetInternal),this.effectShaderQuad.render(t);for(let d=0;d<this.configuration.denoiseIterations;d++)[this.writeTargetInternal,this.readTargetInternal]=[this.readTargetInternal,this.writeTargetInternal],this.poissonBlurQuad.material.uniforms.tDiffuse.value=this.readTargetInternal.texture,this.poissonBlurQuad.material.uniforms.sceneDepth.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[0]:this.beautyRenderTarget.depthTexture,this.poissonBlurQuad.material.uniforms.projMat.value=this.camera.projectionMatrix,this.poissonBlurQuad.material.uniforms.viewMat.value=this.camera.matrixWorldInverse,this.poissonBlurQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.poissonBlurQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.poissonBlurQuad.material.uniforms.cameraPos.value=this.camera.getWorldPosition(new F),this.poissonBlurQuad.material.uniforms.resolution.value=this.configuration.halfRes?this._r.clone().multiplyScalar(.5).floor():this._r,this.poissonBlurQuad.material.uniforms.time.value=performance.now()/1e3,this.poissonBlurQuad.material.uniforms.blueNoise.value=this.bluenoise,this.poissonBlurQuad.material.uniforms.radius.value=this.configuration.denoiseRadius*(this.configuration.halfRes?.5:1),this.poissonBlurQuad.material.uniforms.worldRadius.value=h,this.poissonBlurQuad.material.uniforms.distanceFalloff.value=this.configuration.distanceFalloff,this.poissonBlurQuad.material.uniforms.index.value=d,this.poissonBlurQuad.material.uniforms.poissonDisk.value=this.samplesDenoise,this.poissonBlurQuad.material.uniforms.near.value=this.camera.near,this.poissonBlurQuad.material.uniforms.far.value=this.camera.far,this.poissonBlurQuad.material.uniforms.logDepth.value=t.capabilities.logarithmicDepthBuffer,this.poissonBlurQuad.material.uniforms.screenSpaceRadius.value=this.configuration.screenSpaceRadius,t.setRenderTarget(this.writeTargetInternal),this.poissonBlurQuad.render(t);t.setRenderTarget(this.accumulationRenderTarget);const f=t.autoClear;t.autoClear=!1,this.accumulationQuad.material.uniforms.tDiffuse.value=this.writeTargetInternal.texture,this.accumulationQuad.material.uniforms.frame.value=this.frame,this.accumulationQuad.render(t),t.autoClear=f}this.configuration.transparencyAware&&(this.effectCompositerQuad.material.uniforms.transparencyDWFalse.value=this.transparencyRenderTargetDWFalse.texture,this.effectCompositerQuad.material.uniforms.transparencyDWTrue.value=this.transparencyRenderTargetDWTrue.texture,this.effectCompositerQuad.material.uniforms.transparencyDWTrueDepth.value=this.transparencyRenderTargetDWTrue.depthTexture,this.effectCompositerQuad.material.uniforms.transparencyAware.value=!0),this.effectCompositerQuad.material.uniforms.sceneDiffuse.value=this.beautyRenderTarget.texture,this.effectCompositerQuad.material.uniforms.sceneDepth.value=this.beautyRenderTarget.depthTexture,this.effectCompositerQuad.material.uniforms.aoTones.value=this.configuration.aoTones,this.effectCompositerQuad.material.uniforms.near.value=this.camera.near,this.effectCompositerQuad.material.uniforms.far.value=this.camera.far,this.effectCompositerQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.effectCompositerQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.effectCompositerQuad.material.uniforms.logDepth.value=t.capabilities.logarithmicDepthBuffer,this.effectCompositerQuad.material.uniforms.ortho.value=this.camera.isOrthographicCamera,this.effectCompositerQuad.material.uniforms.downsampledDepth.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[0]:this.beautyRenderTarget.depthTexture,this.effectCompositerQuad.material.uniforms.resolution.value=this._r,this.effectCompositerQuad.material.uniforms.blueNoise.value=this.bluenoise,this.effectCompositerQuad.material.uniforms.intensity.value=this.configuration.intensity,this.effectCompositerQuad.material.uniforms.renderMode.value=this.configuration.renderMode,this.effectCompositerQuad.material.uniforms.screenSpaceRadius.value=this.configuration.screenSpaceRadius,this.effectCompositerQuad.material.uniforms.radius.value=h,this.effectCompositerQuad.material.uniforms.distanceFalloff.value=this.configuration.distanceFalloff,this.effectCompositerQuad.material.uniforms.gammaCorrection.value=this.configuration.gammaCorrection,this.effectCompositerQuad.material.uniforms.tDiffuse.value=this.accumulationRenderTarget.texture,this.effectCompositerQuad.material.uniforms.color.value=this._c.copy(this.configuration.color).convertSRGBToLinear(),this.effectCompositerQuad.material.uniforms.colorMultiply.value=this.configuration.colorMultiply,this.effectCompositerQuad.material.uniforms.cameraPos.value=this.camera.getWorldPosition(new F),this.effectCompositerQuad.material.uniforms.fog.value=!!this.scene.fog,this.scene.fog&&(this.scene.fog.isFog?(this.effectCompositerQuad.material.uniforms.fogExp.value=!1,this.effectCompositerQuad.material.uniforms.fogNear.value=this.scene.fog.near,this.effectCompositerQuad.material.uniforms.fogFar.value=this.scene.fog.far):this.scene.fog.isFogExp2?(this.effectCompositerQuad.material.uniforms.fogExp.value=!0,this.effectCompositerQuad.material.uniforms.fogDensity.value=this.scene.fog.density):console.error(`Unsupported fog type ${this.scene.fog.constructor.name} in SSAOPass.`)),t.setRenderTarget(this.renderToScreen?null:r),this.effectCompositerQuad.render(t),this.debugMode&&(s.endQuery(o.TIME_ELAPSED_EXT),Hr(l,s,this)),t.xr.enabled=u}enableDebugMode(){this.debugMode=!0}disableDebugMode(){this.debugMode=!1}setDisplayMode(t){this.configuration.renderMode=["Combined","AO","No AO","Split","Split AO"].indexOf(t)}setQualityMode(t){t==="Performance"?(this.configuration.aoSamples=8,this.configuration.denoiseSamples=4,this.configuration.denoiseRadius=12):t==="Low"?(this.configuration.aoSamples=16,this.configuration.denoiseSamples=4,this.configuration.denoiseRadius=12):t==="Medium"?(this.configuration.aoSamples=16,this.configuration.denoiseSamples=8,this.configuration.denoiseRadius=12):t==="High"?(this.configuration.aoSamples=64,this.configuration.denoiseSamples=8,this.configuration.denoiseRadius=6):t==="Ultra"&&(this.configuration.aoSamples=64,this.configuration.denoiseSamples=16,this.configuration.denoiseRadius=6)}}const yn=Object.freeze(Object.defineProperty({__proto__:null,N8AOPass:Cn,N8AOPostPass:Sn},Symbol.toStringTag,{value:"Module"}));export{yn as N,xn as i};
|
|
1623
|
+
`+i.fragmentShader),this.effectCompositerQuad?(this.effectCompositerQuad.material.dispose(),this.effectCompositerQuad.material=new T(i)):this.effectCompositerQuad=new q(new T(i))}generateHemisphereSamples(t){const r=[];for(let i=0;i<t;i++){const a=2.399963*i;let n=Math.sqrt(i+.5)/Math.sqrt(t);const s=n*Math.cos(a),o=n*Math.sin(a),l=Math.sqrt(1-(s*s+o*o));r.push(new F(s,o,l))}return r}generateDenoiseSamples(t,r){const i=2*Math.PI*r/t,a=1/t,n=a,s=[];let o=a,l=0;for(let u=0;u<t;u++)s.push(new v(Math.cos(l),Math.sin(l)).multiplyScalar(Math.pow(o,.75))),o+=n,l+=i;return s}setSize(t,r){this.firstFrame(),this.width=t,this.height=r;const i=this.configuration.halfRes?.5:1;this.beautyRenderTarget.setSize(t,r),this.writeTargetInternal.setSize(t*i,r*i),this.readTargetInternal.setSize(t*i,r*i),this.accumulationRenderTarget.setSize(t*i,r*i),this.configuration.halfRes&&this.depthDownsampleTarget.setSize(t*i,r*i),this.configuration.transparencyAware&&(this.transparencyRenderTargetDWFalse.setSize(t,r),this.transparencyRenderTargetDWTrue.setSize(t,r))}firstFrame(){this.needsFrame=!0}render(t,r,i,a,n){t.capabilities.logarithmicDepthBuffer!==this.configuration.logarithmicDepthBuffer&&(this.configuration.logarithmicDepthBuffer=t.capabilities.logarithmicDepthBuffer,this.configureAOPass(this.configuration.logarithmicDepthBuffer,this.camera.isOrthographicCamera),this.configureDenoisePass(this.configuration.logarithmicDepthBuffer,this.camera.isOrthographicCamera),this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer,this.camera.isOrthographicCamera)),this.detectTransparency(),this.camera.updateMatrixWorld(),this.lastViewMatrix.equals(this.camera.matrixWorldInverse)&&this.lastProjectionMatrix.equals(this.camera.projectionMatrix)&&this.configuration.accumulate&&!this.needsFrame?this.frame++:(this.configuration.accumulate&&(t.setRenderTarget(this.accumulationRenderTarget),t.clear(!0,!0,!0)),this.frame=0,this.needsFrame=!1),this.lastViewMatrix.copy(this.camera.matrixWorldInverse),this.lastProjectionMatrix.copy(this.camera.projectionMatrix);let s,o,l;this.debugMode&&(s=t.getContext(),o=s.getExtension("EXT_disjoint_timer_query_webgl2"),o===null&&(console.error("EXT_disjoint_timer_query_webgl2 not available, disabling debug mode."),this.debugMode=!1)),this.configuration.autoRenderBeauty&&(t.setRenderTarget(this.beautyRenderTarget),t.render(this.scene,this.camera),this.configuration.transparencyAware&&this.renderTransparency(t)),this.debugMode&&(l=s.createQuery(),s.beginQuery(o.TIME_ELAPSED_EXT,l));const u=t.xr.enabled;t.xr.enabled=!1,this._r.set(this.width,this.height);let h=this.configuration.aoRadius;if(this.configuration.halfRes&&this.configuration.screenSpaceRadius&&(h*=.5),this.frame<1024/this.configuration.aoSamples){this.configuration.halfRes&&(t.setRenderTarget(this.depthDownsampleTarget),this.depthDownsampleQuad.material.uniforms.sceneDepth.value=this.beautyRenderTarget.depthTexture,this.depthDownsampleQuad.material.uniforms.resolution.value=this._r,this.depthDownsampleQuad.material.uniforms.near.value=this.camera.near,this.depthDownsampleQuad.material.uniforms.far.value=this.camera.far,this.depthDownsampleQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.depthDownsampleQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.depthDownsampleQuad.material.uniforms.logDepth.value=this.configuration.logarithmicDepthBuffer,this.depthDownsampleQuad.material.uniforms.ortho.value=this.camera.isOrthographicCamera,this.depthDownsampleQuad.render(t)),this.effectShaderQuad.material.uniforms.sceneDiffuse.value=this.beautyRenderTarget.texture,this.effectShaderQuad.material.uniforms.sceneDepth.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[0]:this.beautyRenderTarget.depthTexture,this.effectShaderQuad.material.uniforms.sceneNormal.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[1]:null,this.effectShaderQuad.material.uniforms.projMat.value=this.camera.projectionMatrix,this.effectShaderQuad.material.uniforms.viewMat.value=this.camera.matrixWorldInverse,this.effectShaderQuad.material.uniforms.projViewMat.value=this.camera.projectionMatrix.clone().multiply(this.camera.matrixWorldInverse.clone()),this.effectShaderQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.effectShaderQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.effectShaderQuad.material.uniforms.cameraPos.value=this.camera.getWorldPosition(new F),this.effectShaderQuad.material.uniforms.biasAdjustment.value=new v(this.configuration.biasOffset,this.configuration.biasMultiplier),this.effectShaderQuad.material.uniforms.resolution.value=this.configuration.halfRes?this._r.clone().multiplyScalar(.5).floor():this._r,this.effectShaderQuad.material.uniforms.time.value=performance.now()/1e3,this.effectShaderQuad.material.uniforms.samples.value=this.samples,this.effectShaderQuad.material.uniforms.bluenoise.value=this.bluenoise,this.effectShaderQuad.material.uniforms.radius.value=h,this.effectShaderQuad.material.uniforms.distanceFalloff.value=this.configuration.distanceFalloff,this.effectShaderQuad.material.uniforms.near.value=this.camera.near,this.effectShaderQuad.material.uniforms.far.value=this.camera.far,this.effectShaderQuad.material.uniforms.logDepth.value=t.capabilities.logarithmicDepthBuffer,this.effectShaderQuad.material.uniforms.ortho.value=this.camera.isOrthographicCamera,this.effectShaderQuad.material.uniforms.screenSpaceRadius.value=this.configuration.screenSpaceRadius,this.effectShaderQuad.material.uniforms.frame.value=this.frame,t.setRenderTarget(this.writeTargetInternal),this.effectShaderQuad.render(t);for(let d=0;d<this.configuration.denoiseIterations;d++)[this.writeTargetInternal,this.readTargetInternal]=[this.readTargetInternal,this.writeTargetInternal],this.poissonBlurQuad.material.uniforms.tDiffuse.value=this.readTargetInternal.texture,this.poissonBlurQuad.material.uniforms.sceneDepth.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[0]:this.beautyRenderTarget.depthTexture,this.poissonBlurQuad.material.uniforms.projMat.value=this.camera.projectionMatrix,this.poissonBlurQuad.material.uniforms.viewMat.value=this.camera.matrixWorldInverse,this.poissonBlurQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.poissonBlurQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.poissonBlurQuad.material.uniforms.cameraPos.value=this.camera.getWorldPosition(new F),this.poissonBlurQuad.material.uniforms.resolution.value=this.configuration.halfRes?this._r.clone().multiplyScalar(.5).floor():this._r,this.poissonBlurQuad.material.uniforms.time.value=performance.now()/1e3,this.poissonBlurQuad.material.uniforms.blueNoise.value=this.bluenoise,this.poissonBlurQuad.material.uniforms.radius.value=this.configuration.denoiseRadius*(this.configuration.halfRes?.5:1),this.poissonBlurQuad.material.uniforms.worldRadius.value=h,this.poissonBlurQuad.material.uniforms.distanceFalloff.value=this.configuration.distanceFalloff,this.poissonBlurQuad.material.uniforms.index.value=d,this.poissonBlurQuad.material.uniforms.poissonDisk.value=this.samplesDenoise,this.poissonBlurQuad.material.uniforms.near.value=this.camera.near,this.poissonBlurQuad.material.uniforms.far.value=this.camera.far,this.poissonBlurQuad.material.uniforms.logDepth.value=t.capabilities.logarithmicDepthBuffer,this.poissonBlurQuad.material.uniforms.screenSpaceRadius.value=this.configuration.screenSpaceRadius,t.setRenderTarget(this.writeTargetInternal),this.poissonBlurQuad.render(t);t.setRenderTarget(this.accumulationRenderTarget);const f=t.autoClear;t.autoClear=!1,this.accumulationQuad.material.uniforms.tDiffuse.value=this.writeTargetInternal.texture,this.accumulationQuad.material.uniforms.frame.value=this.frame,this.accumulationQuad.render(t),t.autoClear=f}this.configuration.transparencyAware&&(this.effectCompositerQuad.material.uniforms.transparencyDWFalse.value=this.transparencyRenderTargetDWFalse.texture,this.effectCompositerQuad.material.uniforms.transparencyDWTrue.value=this.transparencyRenderTargetDWTrue.texture,this.effectCompositerQuad.material.uniforms.transparencyDWTrueDepth.value=this.transparencyRenderTargetDWTrue.depthTexture,this.effectCompositerQuad.material.uniforms.transparencyAware.value=!0),this.effectCompositerQuad.material.uniforms.sceneDiffuse.value=this.beautyRenderTarget.texture,this.effectCompositerQuad.material.uniforms.sceneDepth.value=this.beautyRenderTarget.depthTexture,this.effectCompositerQuad.material.uniforms.aoTones.value=this.configuration.aoTones,this.effectCompositerQuad.material.uniforms.near.value=this.camera.near,this.effectCompositerQuad.material.uniforms.far.value=this.camera.far,this.effectCompositerQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.effectCompositerQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.effectCompositerQuad.material.uniforms.logDepth.value=t.capabilities.logarithmicDepthBuffer,this.effectCompositerQuad.material.uniforms.ortho.value=this.camera.isOrthographicCamera,this.effectCompositerQuad.material.uniforms.downsampledDepth.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[0]:this.beautyRenderTarget.depthTexture,this.effectCompositerQuad.material.uniforms.resolution.value=this._r,this.effectCompositerQuad.material.uniforms.blueNoise.value=this.bluenoise,this.effectCompositerQuad.material.uniforms.intensity.value=this.configuration.intensity,this.effectCompositerQuad.material.uniforms.renderMode.value=this.configuration.renderMode,this.effectCompositerQuad.material.uniforms.screenSpaceRadius.value=this.configuration.screenSpaceRadius,this.effectCompositerQuad.material.uniforms.radius.value=h,this.effectCompositerQuad.material.uniforms.distanceFalloff.value=this.configuration.distanceFalloff,this.effectCompositerQuad.material.uniforms.gammaCorrection.value=this.configuration.gammaCorrection,this.effectCompositerQuad.material.uniforms.tDiffuse.value=this.accumulationRenderTarget.texture,this.effectCompositerQuad.material.uniforms.color.value=this._c.copy(this.configuration.color).convertSRGBToLinear(),this.effectCompositerQuad.material.uniforms.colorMultiply.value=this.configuration.colorMultiply,this.effectCompositerQuad.material.uniforms.cameraPos.value=this.camera.getWorldPosition(new F),this.effectCompositerQuad.material.uniforms.fog.value=!!this.scene.fog,this.scene.fog&&(this.scene.fog.isFog?(this.effectCompositerQuad.material.uniforms.fogExp.value=!1,this.effectCompositerQuad.material.uniforms.fogNear.value=this.scene.fog.near,this.effectCompositerQuad.material.uniforms.fogFar.value=this.scene.fog.far):this.scene.fog.isFogExp2?(this.effectCompositerQuad.material.uniforms.fogExp.value=!0,this.effectCompositerQuad.material.uniforms.fogDensity.value=this.scene.fog.density):console.error(`Unsupported fog type ${this.scene.fog.constructor.name} in SSAOPass.`)),t.setRenderTarget(this.renderToScreen?null:r),this.effectCompositerQuad.render(t),this.debugMode&&(s.endQuery(o.TIME_ELAPSED_EXT),Hr(l,s,this)),t.xr.enabled=u}enableDebugMode(){this.debugMode=!0}disableDebugMode(){this.debugMode=!1}setDisplayMode(t){this.configuration.renderMode=["Combined","AO","No AO","Split","Split AO"].indexOf(t)}setQualityMode(t){t==="Performance"?(this.configuration.aoSamples=8,this.configuration.denoiseSamples=4,this.configuration.denoiseRadius=12):t==="Low"?(this.configuration.aoSamples=16,this.configuration.denoiseSamples=4,this.configuration.denoiseRadius=12):t==="Medium"?(this.configuration.aoSamples=16,this.configuration.denoiseSamples=8,this.configuration.denoiseRadius=12):t==="High"?(this.configuration.aoSamples=64,this.configuration.denoiseSamples=8,this.configuration.denoiseRadius=6):t==="Ultra"&&(this.configuration.aoSamples=64,this.configuration.denoiseSamples=16,this.configuration.denoiseRadius=6)}}const yn=Object.freeze(Object.defineProperty({__proto__:null,N8AOPass:Cn,N8AOPostPass:Sn},Symbol.toStringTag,{value:"Module"}));export{yn as N8AO,xn as index};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Scene as at,Camera as Gr,Mesh as It,BasicDepthPacking as k,WebGLRenderTarget as w,Material as Rt,Texture as ke,ShaderMaterial as T,Uniform$1 as c,NoBlending as N,LinearFilter as P,UnsignedByteType as Y,SRGBColorSpace as y,Vector2 as v,DepthTexture as Ae,DepthStencilFormat as bt,UnsignedInt248Type as Ut,UnsignedIntType as Ie,LinearSRGBColorSpace as Qe,BackSide as Ve,DoubleSide as Ye,FrontSide as kr,EventDispatcher as st,Vector4 as Re,REVISION as xe,NoColorSpace as We,PerspectiveCamera as De,DataTexture as Ke,LuminanceFormat as Ft,RGBAFormat as H,NearestFilter as M,RepeatWrapping as ce,LessDepth as Lt,Color as z,Vector3 as F,FloatType as X,HalfFloatType as _,Data3DTexture as Xe,ClampToEdgeWrapping as nt,RGBADepthPacking as ie,MeshDepthMaterial as Qr,EqualDepth as ot,NotEqualDepth as Ot,LoadingManager as be,Matrix4 as L,LinearMipmapLinearFilter as Vr,Loader as lt,FileLoader as Nt,MeshNormalMaterial as Yr,BufferGeometry as Ht,BufferAttribute as Ze,GreaterDepth as Wr,GreaterEqualDepth as Kr,LessEqualDepth as Xr,AlwaysDepth as Zr,NeverDepth as jr,RedFormat as ut,RGFormat as Jr,Sphere as qr,OrthographicCamera as _r,DepthFormat as zt}from"./three.min.js";import{Pass as $r}from"./three-examples.min.js";/**
|
|
2
2
|
* postprocessing v6.36.6 build Tue Dec 31 2024
|
|
3
3
|
* https://github.com/pmndrs/postprocessing
|
|
4
4
|
* Copyright 2015-2024 Raoul van Rüschen
|
|
@@ -1620,4 +1620,4 @@ void main() {
|
|
|
1620
1620
|
`+i.fragmentShader),this.poissonBlurQuad?(this.poissonBlurQuad.material.dispose(),this.poissonBlurQuad.material=new T(i)):this.poissonBlurQuad=new q(new T(i))}configureEffectCompositer(t=!1,r=!1){this.firstFrame();const i={...br};t&&(i.fragmentShader=`#define LOGDEPTH
|
|
1621
1621
|
`+i.fragmentShader),r&&(i.fragmentShader=`#define ORTHO
|
|
1622
1622
|
`+i.fragmentShader),this.configuration.halfRes&&this.configuration.depthAwareUpsampling&&(i.fragmentShader=`#define HALFRES
|
|
1623
|
-
`+i.fragmentShader),this.effectCompositerQuad?(this.effectCompositerQuad.material.dispose(),this.effectCompositerQuad.material=new T(i)):this.effectCompositerQuad=new q(new T(i))}generateHemisphereSamples(t){const r=[];for(let i=0;i<t;i++){const a=2.399963*i;let n=Math.sqrt(i+.5)/Math.sqrt(t);const s=n*Math.cos(a),o=n*Math.sin(a),l=Math.sqrt(1-(s*s+o*o));r.push(new F(s,o,l))}return r}generateDenoiseSamples(t,r){const i=2*Math.PI*r/t,a=1/t,n=a,s=[];let o=a,l=0;for(let u=0;u<t;u++)s.push(new v(Math.cos(l),Math.sin(l)).multiplyScalar(Math.pow(o,.75))),o+=n,l+=i;return s}setSize(t,r){this.firstFrame(),this.width=t,this.height=r;const i=this.configuration.halfRes?.5:1;this.beautyRenderTarget.setSize(t,r),this.writeTargetInternal.setSize(t*i,r*i),this.readTargetInternal.setSize(t*i,r*i),this.accumulationRenderTarget.setSize(t*i,r*i),this.configuration.halfRes&&this.depthDownsampleTarget.setSize(t*i,r*i),this.configuration.transparencyAware&&(this.transparencyRenderTargetDWFalse.setSize(t,r),this.transparencyRenderTargetDWTrue.setSize(t,r))}firstFrame(){this.needsFrame=!0}render(t,r,i,a,n){t.capabilities.logarithmicDepthBuffer!==this.configuration.logarithmicDepthBuffer&&(this.configuration.logarithmicDepthBuffer=t.capabilities.logarithmicDepthBuffer,this.configureAOPass(this.configuration.logarithmicDepthBuffer,this.camera.isOrthographicCamera),this.configureDenoisePass(this.configuration.logarithmicDepthBuffer,this.camera.isOrthographicCamera),this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer,this.camera.isOrthographicCamera)),this.detectTransparency(),this.camera.updateMatrixWorld(),this.lastViewMatrix.equals(this.camera.matrixWorldInverse)&&this.lastProjectionMatrix.equals(this.camera.projectionMatrix)&&this.configuration.accumulate&&!this.needsFrame?this.frame++:(this.configuration.accumulate&&(t.setRenderTarget(this.accumulationRenderTarget),t.clear(!0,!0,!0)),this.frame=0,this.needsFrame=!1),this.lastViewMatrix.copy(this.camera.matrixWorldInverse),this.lastProjectionMatrix.copy(this.camera.projectionMatrix);let s,o,l;this.debugMode&&(s=t.getContext(),o=s.getExtension("EXT_disjoint_timer_query_webgl2"),o===null&&(console.error("EXT_disjoint_timer_query_webgl2 not available, disabling debug mode."),this.debugMode=!1)),this.configuration.autoRenderBeauty&&(t.setRenderTarget(this.beautyRenderTarget),t.render(this.scene,this.camera),this.configuration.transparencyAware&&this.renderTransparency(t)),this.debugMode&&(l=s.createQuery(),s.beginQuery(o.TIME_ELAPSED_EXT,l));const u=t.xr.enabled;t.xr.enabled=!1,this._r.set(this.width,this.height);let h=this.configuration.aoRadius;if(this.configuration.halfRes&&this.configuration.screenSpaceRadius&&(h*=.5),this.frame<1024/this.configuration.aoSamples){this.configuration.halfRes&&(t.setRenderTarget(this.depthDownsampleTarget),this.depthDownsampleQuad.material.uniforms.sceneDepth.value=this.beautyRenderTarget.depthTexture,this.depthDownsampleQuad.material.uniforms.resolution.value=this._r,this.depthDownsampleQuad.material.uniforms.near.value=this.camera.near,this.depthDownsampleQuad.material.uniforms.far.value=this.camera.far,this.depthDownsampleQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.depthDownsampleQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.depthDownsampleQuad.material.uniforms.logDepth.value=this.configuration.logarithmicDepthBuffer,this.depthDownsampleQuad.material.uniforms.ortho.value=this.camera.isOrthographicCamera,this.depthDownsampleQuad.render(t)),this.effectShaderQuad.material.uniforms.sceneDiffuse.value=this.beautyRenderTarget.texture,this.effectShaderQuad.material.uniforms.sceneDepth.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[0]:this.beautyRenderTarget.depthTexture,this.effectShaderQuad.material.uniforms.sceneNormal.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[1]:null,this.effectShaderQuad.material.uniforms.projMat.value=this.camera.projectionMatrix,this.effectShaderQuad.material.uniforms.viewMat.value=this.camera.matrixWorldInverse,this.effectShaderQuad.material.uniforms.projViewMat.value=this.camera.projectionMatrix.clone().multiply(this.camera.matrixWorldInverse.clone()),this.effectShaderQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.effectShaderQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.effectShaderQuad.material.uniforms.cameraPos.value=this.camera.getWorldPosition(new F),this.effectShaderQuad.material.uniforms.biasAdjustment.value=new v(this.configuration.biasOffset,this.configuration.biasMultiplier),this.effectShaderQuad.material.uniforms.resolution.value=this.configuration.halfRes?this._r.clone().multiplyScalar(.5).floor():this._r,this.effectShaderQuad.material.uniforms.time.value=performance.now()/1e3,this.effectShaderQuad.material.uniforms.samples.value=this.samples,this.effectShaderQuad.material.uniforms.bluenoise.value=this.bluenoise,this.effectShaderQuad.material.uniforms.radius.value=h,this.effectShaderQuad.material.uniforms.distanceFalloff.value=this.configuration.distanceFalloff,this.effectShaderQuad.material.uniforms.near.value=this.camera.near,this.effectShaderQuad.material.uniforms.far.value=this.camera.far,this.effectShaderQuad.material.uniforms.logDepth.value=t.capabilities.logarithmicDepthBuffer,this.effectShaderQuad.material.uniforms.ortho.value=this.camera.isOrthographicCamera,this.effectShaderQuad.material.uniforms.screenSpaceRadius.value=this.configuration.screenSpaceRadius,this.effectShaderQuad.material.uniforms.frame.value=this.frame,t.setRenderTarget(this.writeTargetInternal),this.effectShaderQuad.render(t);for(let d=0;d<this.configuration.denoiseIterations;d++)[this.writeTargetInternal,this.readTargetInternal]=[this.readTargetInternal,this.writeTargetInternal],this.poissonBlurQuad.material.uniforms.tDiffuse.value=this.readTargetInternal.texture,this.poissonBlurQuad.material.uniforms.sceneDepth.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[0]:this.beautyRenderTarget.depthTexture,this.poissonBlurQuad.material.uniforms.projMat.value=this.camera.projectionMatrix,this.poissonBlurQuad.material.uniforms.viewMat.value=this.camera.matrixWorldInverse,this.poissonBlurQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.poissonBlurQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.poissonBlurQuad.material.uniforms.cameraPos.value=this.camera.getWorldPosition(new F),this.poissonBlurQuad.material.uniforms.resolution.value=this.configuration.halfRes?this._r.clone().multiplyScalar(.5).floor():this._r,this.poissonBlurQuad.material.uniforms.time.value=performance.now()/1e3,this.poissonBlurQuad.material.uniforms.blueNoise.value=this.bluenoise,this.poissonBlurQuad.material.uniforms.radius.value=this.configuration.denoiseRadius*(this.configuration.halfRes?.5:1),this.poissonBlurQuad.material.uniforms.worldRadius.value=h,this.poissonBlurQuad.material.uniforms.distanceFalloff.value=this.configuration.distanceFalloff,this.poissonBlurQuad.material.uniforms.index.value=d,this.poissonBlurQuad.material.uniforms.poissonDisk.value=this.samplesDenoise,this.poissonBlurQuad.material.uniforms.near.value=this.camera.near,this.poissonBlurQuad.material.uniforms.far.value=this.camera.far,this.poissonBlurQuad.material.uniforms.logDepth.value=t.capabilities.logarithmicDepthBuffer,this.poissonBlurQuad.material.uniforms.screenSpaceRadius.value=this.configuration.screenSpaceRadius,t.setRenderTarget(this.writeTargetInternal),this.poissonBlurQuad.render(t);t.setRenderTarget(this.accumulationRenderTarget);const f=t.autoClear;t.autoClear=!1,this.accumulationQuad.material.uniforms.tDiffuse.value=this.writeTargetInternal.texture,this.accumulationQuad.material.uniforms.frame.value=this.frame,this.accumulationQuad.render(t),t.autoClear=f}this.configuration.transparencyAware&&(this.effectCompositerQuad.material.uniforms.transparencyDWFalse.value=this.transparencyRenderTargetDWFalse.texture,this.effectCompositerQuad.material.uniforms.transparencyDWTrue.value=this.transparencyRenderTargetDWTrue.texture,this.effectCompositerQuad.material.uniforms.transparencyDWTrueDepth.value=this.transparencyRenderTargetDWTrue.depthTexture,this.effectCompositerQuad.material.uniforms.transparencyAware.value=!0),this.effectCompositerQuad.material.uniforms.sceneDiffuse.value=this.beautyRenderTarget.texture,this.effectCompositerQuad.material.uniforms.sceneDepth.value=this.beautyRenderTarget.depthTexture,this.effectCompositerQuad.material.uniforms.aoTones.value=this.configuration.aoTones,this.effectCompositerQuad.material.uniforms.near.value=this.camera.near,this.effectCompositerQuad.material.uniforms.far.value=this.camera.far,this.effectCompositerQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.effectCompositerQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.effectCompositerQuad.material.uniforms.logDepth.value=t.capabilities.logarithmicDepthBuffer,this.effectCompositerQuad.material.uniforms.ortho.value=this.camera.isOrthographicCamera,this.effectCompositerQuad.material.uniforms.downsampledDepth.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[0]:this.beautyRenderTarget.depthTexture,this.effectCompositerQuad.material.uniforms.resolution.value=this._r,this.effectCompositerQuad.material.uniforms.blueNoise.value=this.bluenoise,this.effectCompositerQuad.material.uniforms.intensity.value=this.configuration.intensity,this.effectCompositerQuad.material.uniforms.renderMode.value=this.configuration.renderMode,this.effectCompositerQuad.material.uniforms.screenSpaceRadius.value=this.configuration.screenSpaceRadius,this.effectCompositerQuad.material.uniforms.radius.value=h,this.effectCompositerQuad.material.uniforms.distanceFalloff.value=this.configuration.distanceFalloff,this.effectCompositerQuad.material.uniforms.gammaCorrection.value=this.configuration.gammaCorrection,this.effectCompositerQuad.material.uniforms.tDiffuse.value=this.accumulationRenderTarget.texture,this.effectCompositerQuad.material.uniforms.color.value=this._c.copy(this.configuration.color).convertSRGBToLinear(),this.effectCompositerQuad.material.uniforms.colorMultiply.value=this.configuration.colorMultiply,this.effectCompositerQuad.material.uniforms.cameraPos.value=this.camera.getWorldPosition(new F),this.effectCompositerQuad.material.uniforms.fog.value=!!this.scene.fog,this.scene.fog&&(this.scene.fog.isFog?(this.effectCompositerQuad.material.uniforms.fogExp.value=!1,this.effectCompositerQuad.material.uniforms.fogNear.value=this.scene.fog.near,this.effectCompositerQuad.material.uniforms.fogFar.value=this.scene.fog.far):this.scene.fog.isFogExp2?(this.effectCompositerQuad.material.uniforms.fogExp.value=!0,this.effectCompositerQuad.material.uniforms.fogDensity.value=this.scene.fog.density):console.error(`Unsupported fog type ${this.scene.fog.constructor.name} in SSAOPass.`)),t.setRenderTarget(this.renderToScreen?null:r),this.effectCompositerQuad.render(t),this.debugMode&&(s.endQuery(o.TIME_ELAPSED_EXT),Hr(l,s,this)),t.xr.enabled=u}enableDebugMode(){this.debugMode=!0}disableDebugMode(){this.debugMode=!1}setDisplayMode(t){this.configuration.renderMode=["Combined","AO","No AO","Split","Split AO"].indexOf(t)}setQualityMode(t){t==="Performance"?(this.configuration.aoSamples=8,this.configuration.denoiseSamples=4,this.configuration.denoiseRadius=12):t==="Low"?(this.configuration.aoSamples=16,this.configuration.denoiseSamples=4,this.configuration.denoiseRadius=12):t==="Medium"?(this.configuration.aoSamples=16,this.configuration.denoiseSamples=8,this.configuration.denoiseRadius=12):t==="High"?(this.configuration.aoSamples=64,this.configuration.denoiseSamples=8,this.configuration.denoiseRadius=6):t==="Ultra"&&(this.configuration.aoSamples=64,this.configuration.denoiseSamples=16,this.configuration.denoiseRadius=6)}}const yn=Object.freeze(Object.defineProperty({__proto__:null,N8AOPass:Cn,N8AOPostPass:Sn},Symbol.toStringTag,{value:"Module"}));export{yn as N,xn as i};
|
|
1623
|
+
`+i.fragmentShader),this.effectCompositerQuad?(this.effectCompositerQuad.material.dispose(),this.effectCompositerQuad.material=new T(i)):this.effectCompositerQuad=new q(new T(i))}generateHemisphereSamples(t){const r=[];for(let i=0;i<t;i++){const a=2.399963*i;let n=Math.sqrt(i+.5)/Math.sqrt(t);const s=n*Math.cos(a),o=n*Math.sin(a),l=Math.sqrt(1-(s*s+o*o));r.push(new F(s,o,l))}return r}generateDenoiseSamples(t,r){const i=2*Math.PI*r/t,a=1/t,n=a,s=[];let o=a,l=0;for(let u=0;u<t;u++)s.push(new v(Math.cos(l),Math.sin(l)).multiplyScalar(Math.pow(o,.75))),o+=n,l+=i;return s}setSize(t,r){this.firstFrame(),this.width=t,this.height=r;const i=this.configuration.halfRes?.5:1;this.beautyRenderTarget.setSize(t,r),this.writeTargetInternal.setSize(t*i,r*i),this.readTargetInternal.setSize(t*i,r*i),this.accumulationRenderTarget.setSize(t*i,r*i),this.configuration.halfRes&&this.depthDownsampleTarget.setSize(t*i,r*i),this.configuration.transparencyAware&&(this.transparencyRenderTargetDWFalse.setSize(t,r),this.transparencyRenderTargetDWTrue.setSize(t,r))}firstFrame(){this.needsFrame=!0}render(t,r,i,a,n){t.capabilities.logarithmicDepthBuffer!==this.configuration.logarithmicDepthBuffer&&(this.configuration.logarithmicDepthBuffer=t.capabilities.logarithmicDepthBuffer,this.configureAOPass(this.configuration.logarithmicDepthBuffer,this.camera.isOrthographicCamera),this.configureDenoisePass(this.configuration.logarithmicDepthBuffer,this.camera.isOrthographicCamera),this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer,this.camera.isOrthographicCamera)),this.detectTransparency(),this.camera.updateMatrixWorld(),this.lastViewMatrix.equals(this.camera.matrixWorldInverse)&&this.lastProjectionMatrix.equals(this.camera.projectionMatrix)&&this.configuration.accumulate&&!this.needsFrame?this.frame++:(this.configuration.accumulate&&(t.setRenderTarget(this.accumulationRenderTarget),t.clear(!0,!0,!0)),this.frame=0,this.needsFrame=!1),this.lastViewMatrix.copy(this.camera.matrixWorldInverse),this.lastProjectionMatrix.copy(this.camera.projectionMatrix);let s,o,l;this.debugMode&&(s=t.getContext(),o=s.getExtension("EXT_disjoint_timer_query_webgl2"),o===null&&(console.error("EXT_disjoint_timer_query_webgl2 not available, disabling debug mode."),this.debugMode=!1)),this.configuration.autoRenderBeauty&&(t.setRenderTarget(this.beautyRenderTarget),t.render(this.scene,this.camera),this.configuration.transparencyAware&&this.renderTransparency(t)),this.debugMode&&(l=s.createQuery(),s.beginQuery(o.TIME_ELAPSED_EXT,l));const u=t.xr.enabled;t.xr.enabled=!1,this._r.set(this.width,this.height);let h=this.configuration.aoRadius;if(this.configuration.halfRes&&this.configuration.screenSpaceRadius&&(h*=.5),this.frame<1024/this.configuration.aoSamples){this.configuration.halfRes&&(t.setRenderTarget(this.depthDownsampleTarget),this.depthDownsampleQuad.material.uniforms.sceneDepth.value=this.beautyRenderTarget.depthTexture,this.depthDownsampleQuad.material.uniforms.resolution.value=this._r,this.depthDownsampleQuad.material.uniforms.near.value=this.camera.near,this.depthDownsampleQuad.material.uniforms.far.value=this.camera.far,this.depthDownsampleQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.depthDownsampleQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.depthDownsampleQuad.material.uniforms.logDepth.value=this.configuration.logarithmicDepthBuffer,this.depthDownsampleQuad.material.uniforms.ortho.value=this.camera.isOrthographicCamera,this.depthDownsampleQuad.render(t)),this.effectShaderQuad.material.uniforms.sceneDiffuse.value=this.beautyRenderTarget.texture,this.effectShaderQuad.material.uniforms.sceneDepth.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[0]:this.beautyRenderTarget.depthTexture,this.effectShaderQuad.material.uniforms.sceneNormal.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[1]:null,this.effectShaderQuad.material.uniforms.projMat.value=this.camera.projectionMatrix,this.effectShaderQuad.material.uniforms.viewMat.value=this.camera.matrixWorldInverse,this.effectShaderQuad.material.uniforms.projViewMat.value=this.camera.projectionMatrix.clone().multiply(this.camera.matrixWorldInverse.clone()),this.effectShaderQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.effectShaderQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.effectShaderQuad.material.uniforms.cameraPos.value=this.camera.getWorldPosition(new F),this.effectShaderQuad.material.uniforms.biasAdjustment.value=new v(this.configuration.biasOffset,this.configuration.biasMultiplier),this.effectShaderQuad.material.uniforms.resolution.value=this.configuration.halfRes?this._r.clone().multiplyScalar(.5).floor():this._r,this.effectShaderQuad.material.uniforms.time.value=performance.now()/1e3,this.effectShaderQuad.material.uniforms.samples.value=this.samples,this.effectShaderQuad.material.uniforms.bluenoise.value=this.bluenoise,this.effectShaderQuad.material.uniforms.radius.value=h,this.effectShaderQuad.material.uniforms.distanceFalloff.value=this.configuration.distanceFalloff,this.effectShaderQuad.material.uniforms.near.value=this.camera.near,this.effectShaderQuad.material.uniforms.far.value=this.camera.far,this.effectShaderQuad.material.uniforms.logDepth.value=t.capabilities.logarithmicDepthBuffer,this.effectShaderQuad.material.uniforms.ortho.value=this.camera.isOrthographicCamera,this.effectShaderQuad.material.uniforms.screenSpaceRadius.value=this.configuration.screenSpaceRadius,this.effectShaderQuad.material.uniforms.frame.value=this.frame,t.setRenderTarget(this.writeTargetInternal),this.effectShaderQuad.render(t);for(let d=0;d<this.configuration.denoiseIterations;d++)[this.writeTargetInternal,this.readTargetInternal]=[this.readTargetInternal,this.writeTargetInternal],this.poissonBlurQuad.material.uniforms.tDiffuse.value=this.readTargetInternal.texture,this.poissonBlurQuad.material.uniforms.sceneDepth.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[0]:this.beautyRenderTarget.depthTexture,this.poissonBlurQuad.material.uniforms.projMat.value=this.camera.projectionMatrix,this.poissonBlurQuad.material.uniforms.viewMat.value=this.camera.matrixWorldInverse,this.poissonBlurQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.poissonBlurQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.poissonBlurQuad.material.uniforms.cameraPos.value=this.camera.getWorldPosition(new F),this.poissonBlurQuad.material.uniforms.resolution.value=this.configuration.halfRes?this._r.clone().multiplyScalar(.5).floor():this._r,this.poissonBlurQuad.material.uniforms.time.value=performance.now()/1e3,this.poissonBlurQuad.material.uniforms.blueNoise.value=this.bluenoise,this.poissonBlurQuad.material.uniforms.radius.value=this.configuration.denoiseRadius*(this.configuration.halfRes?.5:1),this.poissonBlurQuad.material.uniforms.worldRadius.value=h,this.poissonBlurQuad.material.uniforms.distanceFalloff.value=this.configuration.distanceFalloff,this.poissonBlurQuad.material.uniforms.index.value=d,this.poissonBlurQuad.material.uniforms.poissonDisk.value=this.samplesDenoise,this.poissonBlurQuad.material.uniforms.near.value=this.camera.near,this.poissonBlurQuad.material.uniforms.far.value=this.camera.far,this.poissonBlurQuad.material.uniforms.logDepth.value=t.capabilities.logarithmicDepthBuffer,this.poissonBlurQuad.material.uniforms.screenSpaceRadius.value=this.configuration.screenSpaceRadius,t.setRenderTarget(this.writeTargetInternal),this.poissonBlurQuad.render(t);t.setRenderTarget(this.accumulationRenderTarget);const f=t.autoClear;t.autoClear=!1,this.accumulationQuad.material.uniforms.tDiffuse.value=this.writeTargetInternal.texture,this.accumulationQuad.material.uniforms.frame.value=this.frame,this.accumulationQuad.render(t),t.autoClear=f}this.configuration.transparencyAware&&(this.effectCompositerQuad.material.uniforms.transparencyDWFalse.value=this.transparencyRenderTargetDWFalse.texture,this.effectCompositerQuad.material.uniforms.transparencyDWTrue.value=this.transparencyRenderTargetDWTrue.texture,this.effectCompositerQuad.material.uniforms.transparencyDWTrueDepth.value=this.transparencyRenderTargetDWTrue.depthTexture,this.effectCompositerQuad.material.uniforms.transparencyAware.value=!0),this.effectCompositerQuad.material.uniforms.sceneDiffuse.value=this.beautyRenderTarget.texture,this.effectCompositerQuad.material.uniforms.sceneDepth.value=this.beautyRenderTarget.depthTexture,this.effectCompositerQuad.material.uniforms.aoTones.value=this.configuration.aoTones,this.effectCompositerQuad.material.uniforms.near.value=this.camera.near,this.effectCompositerQuad.material.uniforms.far.value=this.camera.far,this.effectCompositerQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.effectCompositerQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.effectCompositerQuad.material.uniforms.logDepth.value=t.capabilities.logarithmicDepthBuffer,this.effectCompositerQuad.material.uniforms.ortho.value=this.camera.isOrthographicCamera,this.effectCompositerQuad.material.uniforms.downsampledDepth.value=this.configuration.halfRes?this.depthDownsampleTarget.textures[0]:this.beautyRenderTarget.depthTexture,this.effectCompositerQuad.material.uniforms.resolution.value=this._r,this.effectCompositerQuad.material.uniforms.blueNoise.value=this.bluenoise,this.effectCompositerQuad.material.uniforms.intensity.value=this.configuration.intensity,this.effectCompositerQuad.material.uniforms.renderMode.value=this.configuration.renderMode,this.effectCompositerQuad.material.uniforms.screenSpaceRadius.value=this.configuration.screenSpaceRadius,this.effectCompositerQuad.material.uniforms.radius.value=h,this.effectCompositerQuad.material.uniforms.distanceFalloff.value=this.configuration.distanceFalloff,this.effectCompositerQuad.material.uniforms.gammaCorrection.value=this.configuration.gammaCorrection,this.effectCompositerQuad.material.uniforms.tDiffuse.value=this.accumulationRenderTarget.texture,this.effectCompositerQuad.material.uniforms.color.value=this._c.copy(this.configuration.color).convertSRGBToLinear(),this.effectCompositerQuad.material.uniforms.colorMultiply.value=this.configuration.colorMultiply,this.effectCompositerQuad.material.uniforms.cameraPos.value=this.camera.getWorldPosition(new F),this.effectCompositerQuad.material.uniforms.fog.value=!!this.scene.fog,this.scene.fog&&(this.scene.fog.isFog?(this.effectCompositerQuad.material.uniforms.fogExp.value=!1,this.effectCompositerQuad.material.uniforms.fogNear.value=this.scene.fog.near,this.effectCompositerQuad.material.uniforms.fogFar.value=this.scene.fog.far):this.scene.fog.isFogExp2?(this.effectCompositerQuad.material.uniforms.fogExp.value=!0,this.effectCompositerQuad.material.uniforms.fogDensity.value=this.scene.fog.density):console.error(`Unsupported fog type ${this.scene.fog.constructor.name} in SSAOPass.`)),t.setRenderTarget(this.renderToScreen?null:r),this.effectCompositerQuad.render(t),this.debugMode&&(s.endQuery(o.TIME_ELAPSED_EXT),Hr(l,s,this)),t.xr.enabled=u}enableDebugMode(){this.debugMode=!0}disableDebugMode(){this.debugMode=!1}setDisplayMode(t){this.configuration.renderMode=["Combined","AO","No AO","Split","Split AO"].indexOf(t)}setQualityMode(t){t==="Performance"?(this.configuration.aoSamples=8,this.configuration.denoiseSamples=4,this.configuration.denoiseRadius=12):t==="Low"?(this.configuration.aoSamples=16,this.configuration.denoiseSamples=4,this.configuration.denoiseRadius=12):t==="Medium"?(this.configuration.aoSamples=16,this.configuration.denoiseSamples=8,this.configuration.denoiseRadius=12):t==="High"?(this.configuration.aoSamples=64,this.configuration.denoiseSamples=8,this.configuration.denoiseRadius=6):t==="Ultra"&&(this.configuration.aoSamples=64,this.configuration.denoiseSamples=16,this.configuration.denoiseRadius=6)}}const yn=Object.freeze(Object.defineProperty({__proto__:null,N8AOPass:Cn,N8AOPostPass:Sn},Symbol.toStringTag,{value:"Module"}));export{yn as N8AO,xn as index};
|