@roomle/web-sdk 3.10.0-alpha.2 → 3.10.0-alpha.3
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/lib/{BufferGeometry-Dxcf7n9V.mjs → BufferGeometry-Dj5loCTL.mjs} +2 -2
- package/lib/{BufferGeometry-Dxcf7n9V.mjs.map → BufferGeometry-Dj5loCTL.mjs.map} +1 -1
- package/lib/ConfiguratorKernel.wasm +0 -0
- package/lib/{GLTFExporter-kpv1e-Ks.mjs → GLTFExporter-CquK-kkI.mjs} +1 -1
- package/lib/{GLTFExporter-kpv1e-Ks.mjs.map → GLTFExporter-CquK-kkI.mjs.map} +1 -1
- package/lib/{GaussianBlurNode-CMVlBe39.mjs → GaussianBlurNode-CDYPio-x.mjs} +3 -3
- package/lib/{GaussianBlurNode-CMVlBe39.mjs.map → GaussianBlurNode-CDYPio-x.mjs.map} +1 -1
- package/lib/{Object3D-BZaiqQIE.mjs → Object3D-YXSPdGeJ.mjs} +1 -1
- package/lib/{Object3D-BZaiqQIE.mjs.map → Object3D-YXSPdGeJ.mjs.map} +1 -1
- package/lib/{PointLightHelper-fzRB58rC.mjs → PointLightHelper-g98giMRd.mjs} +4 -4
- package/lib/{PointLightHelper-fzRB58rC.mjs.map → PointLightHelper-g98giMRd.mjs.map} +1 -1
- package/lib/RoomleCore.wasm +0 -0
- package/lib/RoomleToolsCore.wasm +0 -0
- package/lib/{SpotLightHelper-D5UFwRPb.mjs → SpotLightHelper-xR8lCZau.mjs} +3 -3
- package/lib/{SpotLightHelper-D5UFwRPb.mjs.map → SpotLightHelper-xR8lCZau.mjs.map} +1 -1
- package/lib/{USDZExporter-Y0SSGr5_.mjs → USDZExporter-BMqBymZI.mjs} +2 -2
- package/lib/{USDZExporter-Y0SSGr5_.mjs.map → USDZExporter-BMqBymZI.mjs.map} +1 -1
- package/lib/{Vector4-BfZH1ecw.mjs → Vector4-CqzXUndP.mjs} +2 -2
- package/lib/{Vector4-BfZH1ecw.mjs.map → Vector4-CqzXUndP.mjs.map} +1 -1
- package/lib/{api-BXU3pZnX.mjs → api-BlFJIGaV.mjs} +2 -2
- package/lib/{api-BXU3pZnX.mjs.map → api-BlFJIGaV.mjs.map} +1 -1
- package/lib/{asset-loader.worker-C911tbNL.mjs → asset-loader.worker-CHyN7JB1.mjs} +1 -1
- package/lib/{asset-loader.worker-C911tbNL.mjs.map → asset-loader.worker-CHyN7JB1.mjs.map} +1 -1
- package/lib/{banana-for-scale-B_LIHI9q.mjs → banana-for-scale-Cs2s9dNp.mjs} +3 -3
- package/lib/{banana-for-scale-B_LIHI9q.mjs.map → banana-for-scale-Cs2s9dNp.mjs.map} +1 -1
- package/lib/{budgeteer.sw-D3VxiASa.mjs → budgeteer.sw-BCLEIWCW.mjs} +1 -1
- package/lib/budgeteer.sw-BCLEIWCW.mjs.map +1 -0
- package/lib/{common-utils-B9PC_rvS.mjs → common-utils-DMk5jc_R.mjs} +1 -1
- package/lib/{common-utils-B9PC_rvS.mjs.map → common-utils-DMk5jc_R.mjs.map} +1 -1
- package/lib/{component-dimensioning-5iIw1f_3.mjs → component-dimensioning-DcmDM6gV.mjs} +6 -6
- package/lib/{component-dimensioning-5iIw1f_3.mjs.map → component-dimensioning-DcmDM6gV.mjs.map} +1 -1
- package/lib/{component-raycast-helper-O27_buEg.mjs → component-raycast-helper-CXN2MHtG.mjs} +4 -4
- package/lib/{component-raycast-helper-O27_buEg.mjs.map → component-raycast-helper-CXN2MHtG.mjs.map} +1 -1
- package/lib/configurator-B8jcqVX9.mjs +2 -0
- package/lib/{configurator-BwxEIDv7.mjs → configurator-BkQ6h239.mjs} +4 -4
- package/lib/{configurator-BwxEIDv7.mjs.map → configurator-BkQ6h239.mjs.map} +1 -1
- package/lib/{continuous-drawing-helper-D25YPUle.mjs → continuous-drawing-helper-BlGATN0C.mjs} +2 -2
- package/lib/{continuous-drawing-helper-D25YPUle.mjs.map → continuous-drawing-helper-BlGATN0C.mjs.map} +1 -1
- package/lib/{dat.gui.module-CZ-DIWHM.mjs → dat.gui.module-BLjoST8r.mjs} +1 -1
- package/lib/{dat.gui.module-CZ-DIWHM.mjs.map → dat.gui.module-BLjoST8r.mjs.map} +1 -1
- package/lib/{decorate-C9r0zXzz.mjs → decorate-CTUwswpM.mjs} +1 -1
- package/lib/{decorate-C9r0zXzz.mjs.map → decorate-CTUwswpM.mjs.map} +1 -1
- package/lib/dimensioning-helper-BwBj5QDM.mjs +2 -0
- package/lib/{dimensioning-helper-d6JA4UMr.mjs → dimensioning-helper-DMop5qcu.mjs} +4 -4
- package/lib/{dimensioning-helper-d6JA4UMr.mjs.map → dimensioning-helper-DMop5qcu.mjs.map} +1 -1
- package/lib/dist-DGov-RNo.mjs +438 -0
- package/lib/dist-DGov-RNo.mjs.map +1 -0
- package/lib/{fflate.module-CBz7CLOg.mjs → fflate.module-n0Jozp8Z.mjs} +1 -1
- package/lib/{fflate.module-CBz7CLOg.mjs.map → fflate.module-n0Jozp8Z.mjs.map} +1 -1
- package/lib/{glb-viewer-C0Et5SO6.mjs → glb-viewer-D58flqDh.mjs} +6 -6
- package/lib/{glb-viewer-C0Et5SO6.mjs.map → glb-viewer-D58flqDh.mjs.map} +1 -1
- package/lib/glb-viewer-Dg3F2Tz1.mjs +2 -0
- package/lib/{highlight-coordinator-DdQ8yNjO.mjs → highlight-coordinator-CTZ_qcde.mjs} +2 -2
- package/lib/{highlight-coordinator-DdQ8yNjO.mjs.map → highlight-coordinator-CTZ_qcde.mjs.map} +1 -1
- package/lib/{homag-intelligence-DrKayEjK.mjs → homag-intelligence-D7L2SS4z.mjs} +3 -3
- package/lib/{homag-intelligence-DrKayEjK.mjs.map → homag-intelligence-D7L2SS4z.mjs.map} +1 -1
- package/lib/{imos-ix-poc-export-helper-DU0ag-Lw.mjs → imos-ix-poc-export-helper-D2KaQu_v.mjs} +3 -3
- package/lib/{imos-ix-poc-export-helper-DU0ag-Lw.mjs.map → imos-ix-poc-export-helper-D2KaQu_v.mjs.map} +1 -1
- package/lib/{kernel-utils-Cj5B4fDD.mjs → kernel-utils-042AuCQh.mjs} +1 -1
- package/lib/{kernel-utils-Cj5B4fDD.mjs.map → kernel-utils-042AuCQh.mjs.map} +1 -1
- package/lib/{layer-C_JtkhdO.mjs → layer-CFAr2mK_.mjs} +1 -1
- package/lib/{layer-C_JtkhdO.mjs.map → layer-CFAr2mK_.mjs.map} +1 -1
- package/lib/{main-D2BulNeN.mjs → main-C2m_IBXL.mjs} +2901 -2907
- package/lib/main-C2m_IBXL.mjs.map +1 -0
- package/lib/{material-viewer-CZQwo8Nc.mjs → material-viewer-BJs0W2Gk.mjs} +6 -6
- package/lib/{material-viewer-CZQwo8Nc.mjs.map → material-viewer-BJs0W2Gk.mjs.map} +1 -1
- package/lib/packages-D6zM0aDK.mjs +4 -0
- package/lib/{planner-OgIPgZ1m.mjs → planner-B9YA9cmz.mjs} +3 -3
- package/lib/{planner-OgIPgZ1m.mjs.map → planner-B9YA9cmz.mjs.map} +1 -1
- package/lib/planner-DJnqYqvP.mjs +2 -0
- package/lib/{plugin-system-DlME_5b_.mjs → plugin-system-DRpL0Rer.mjs} +3 -3
- package/lib/{plugin-system-DlME_5b_.mjs.map → plugin-system-DRpL0Rer.mjs.map} +1 -1
- package/lib/{roomle-headless-setup-CMK-quZI.mjs → roomle-headless-setup-Cc8EAnVe.mjs} +1 -1
- package/lib/{roomle-headless-setup-CMK-quZI.mjs.map → roomle-headless-setup-Cc8EAnVe.mjs.map} +1 -1
- package/lib/roomle-headless.d.ts +69 -29
- package/lib/roomle-headless.js +9 -9
- package/lib/{roomle-renderer-DYQvV88j.mjs → roomle-renderer-BD3ZmpLS.mjs} +23 -5
- package/lib/roomle-renderer-BD3ZmpLS.mjs.map +1 -0
- package/lib/roomle-sdk.d.ts +69 -29
- package/lib/roomle-sdk.js +7 -7
- package/lib/{roomle-webgpu-renderer-5-aG3CMs.mjs → roomle-webgpu-renderer-NhCn2iM-.mjs} +386 -240
- package/lib/roomle-webgpu-renderer-NhCn2iM-.mjs.map +1 -0
- package/lib/{scene-renderer-DvXjoKHZ.mjs → scene-renderer-DbHi1plp.mjs} +367 -1467
- package/lib/scene-renderer-DbHi1plp.mjs.map +1 -0
- package/lib/{script-loader-CScqyQhc.mjs → script-loader-CXa3RiUa.mjs} +3 -3
- package/lib/{script-loader-CScqyQhc.mjs.map → script-loader-CXa3RiUa.mjs.map} +1 -1
- package/lib/shading-settings-BWeccIZv.mjs +1108 -0
- package/lib/shading-settings-BWeccIZv.mjs.map +1 -0
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/package.json +1 -1
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/ConfiguratorKernel.wasm +0 -0
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleCore.wasm +0 -0
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleToolsCore.wasm +0 -0
- package/lib/{stats-helper-BYi5TI_H.mjs → stats-helper-CPeojJW2.mjs} +3 -3
- package/lib/{stats-helper-BYi5TI_H.mjs.map → stats-helper-CPeojJW2.mjs.map} +1 -1
- package/lib/{three.tsl-S0OKwamA.mjs → three.tsl-Bb8l7rD7.mjs} +1 -1
- package/lib/{three.tsl-CAEdYyg3.mjs → three.tsl-Caqi2VRr.mjs} +2 -2
- package/lib/{three.tsl-CAEdYyg3.mjs.map → three.tsl-Caqi2VRr.mjs.map} +1 -1
- package/lib/{three.webgpu-CkP2nkXM.mjs → three.webgpu-CT4fuV2X.mjs} +1 -1
- package/lib/{three.webgpu-CkP2nkXM.mjs.map → three.webgpu-CT4fuV2X.mjs.map} +1 -1
- package/lib/{three.webgpu-qrxDA_v0.mjs → three.webgpu-CxNhl3k-.mjs} +1 -1
- package/lib/{threejs-utils-C4J_TZ0o.mjs → threejs-utils-E4yVZATI.mjs} +4 -4
- package/lib/threejs-utils-E4yVZATI.mjs.map +1 -0
- package/lib/{tools-core-BCkbEbim.mjs → tools-core-GNj0UaiE.mjs} +3 -3
- package/lib/{tools-core-BCkbEbim.mjs.map → tools-core-GNj0UaiE.mjs.map} +1 -1
- package/lib/workers-Dc-RTL8D.mjs +6 -0
- package/lib/{workers-HXGCmmZS.mjs.map → workers-Dc-RTL8D.mjs.map} +1 -1
- package/package.json +1 -1
- package/lib/budgeteer.sw-D3VxiASa.mjs.map +0 -1
- package/lib/configurator-BIyxKNI0.mjs +0 -2
- package/lib/dimensioning-helper-pPTkh8pl.mjs +0 -2
- package/lib/glb-viewer-DfMzLkqg.mjs +0 -2
- package/lib/main-D2BulNeN.mjs.map +0 -1
- package/lib/packages-BtLLQZLz.mjs +0 -4
- package/lib/planner-BF94NrwH.mjs +0 -2
- package/lib/roomle-renderer-DYQvV88j.mjs.map +0 -1
- package/lib/roomle-webgpu-renderer-5-aG3CMs.mjs.map +0 -1
- package/lib/scene-renderer-DvXjoKHZ.mjs.map +0 -1
- package/lib/threejs-utils-C4J_TZ0o.mjs.map +0 -1
- package/lib/workers-HXGCmmZS.mjs +0 -6
|
@@ -1,920 +1,16 @@
|
|
|
1
|
-
import { k as e } from "./threejs-utils-
|
|
2
|
-
import { An as t, Ci as n, E as r, Ei as i, En as a, Gn as o,
|
|
3
|
-
import { r as
|
|
4
|
-
import { n as
|
|
5
|
-
import "./
|
|
6
|
-
import
|
|
7
|
-
//#region packages/common-core/src/webgl/renderer/
|
|
8
|
-
var
|
|
9
|
-
uniforms: {
|
|
10
|
-
tDiffuse: { value: null },
|
|
11
|
-
colorTransform: { value: new L() },
|
|
12
|
-
colorBase: { value: new n(0, 0, 0, 0) },
|
|
13
|
-
multiplyChannels: { value: 0 },
|
|
14
|
-
uvTransform: { value: new N() }
|
|
15
|
-
},
|
|
16
|
-
vertexShader: "\n varying vec2 vUv;\n uniform mat3 uvTransform;\n\n void main() {\n vUv = (uvTransform * vec3(uv, 1.0)).xy;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",
|
|
17
|
-
fragmentShader: "\n uniform sampler2D tDiffuse;\n uniform mat4 colorTransform;\n uniform vec4 colorBase;\n uniform float multiplyChannels;\n varying vec2 vUv;\n\n void main() {\n vec4 color = texture2D(tDiffuse, vUv);\n #if PREMULTIPLIED_ALPHA == 1\n if (color.a > 0.0) color.rgb /= color.a;\n #endif\n color = colorTransform * color + colorBase;\n color.rgb = mix(color.rgb, vec3(color.r * color.g * color.b), multiplyChannels);\n #if LINEAR_TO_SRGB == 1\n color.rgb = mix(color.rgb * 12.92, 1.055 * pow(color.rgb, vec3(0.41666)) - 0.055, step(0.0031308, color.rgb));\n #endif\n gl_FragColor = color;\n }"
|
|
18
|
-
}, B = new L(), ye = new L().set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0), be = new L().set(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0), xe = new L().set(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1);
|
|
19
|
-
new L().set(0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1), new L().set(0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
|
20
|
-
var V = new L().set(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1), H = new n(0, 0, 0, 0), U = new n(0, 0, 0, 1), W = new N(), Se = new N().set(1, 0, 0, 0, -1, 1, 0, 0, 1), Ce = {
|
|
21
|
-
DEFAULT: "default",
|
|
22
|
-
ADDITIVE: "additive"
|
|
23
|
-
}, G = class extends m {
|
|
24
|
-
constructor(e, t = Ce.ADDITIVE, n = !1, r = !1) {
|
|
25
|
-
let i = t === Ce.ADDITIVE ? {
|
|
26
|
-
blendSrc: 208,
|
|
27
|
-
blendDst: 200,
|
|
28
|
-
blendEquation: 100,
|
|
29
|
-
blendSrcAlpha: 206,
|
|
30
|
-
blendDstAlpha: 200,
|
|
31
|
-
blendEquationAlpha: 100
|
|
32
|
-
} : {};
|
|
33
|
-
super({
|
|
34
|
-
uniforms: D.clone(ve.uniforms),
|
|
35
|
-
vertexShader: ve.vertexShader,
|
|
36
|
-
fragmentShader: ve.fragmentShader,
|
|
37
|
-
defines: {
|
|
38
|
-
LINEAR_TO_SRGB: n ? 1 : 0,
|
|
39
|
-
PREMULTIPLIED_ALPHA: r ? 1 : 0
|
|
40
|
-
},
|
|
41
|
-
transparent: !0,
|
|
42
|
-
depthTest: !1,
|
|
43
|
-
depthWrite: !1,
|
|
44
|
-
...i
|
|
45
|
-
}), this.update(e);
|
|
46
|
-
}
|
|
47
|
-
update(e) {
|
|
48
|
-
return e?.texture !== void 0 && (this.uniforms.tDiffuse.value = e?.texture), e?.colorTransform !== void 0 && (this.uniforms.colorTransform.value = e?.colorTransform), e?.colorBase !== void 0 && (this.uniforms.colorBase.value = e?.colorBase), e?.multiplyChannels !== void 0 && (this.uniforms.multiplyChannels.value = e?.multiplyChannels), e?.uvTransform !== void 0 && (this.uniforms.uvTransform.value = e?.uvTransform), e?.blending !== void 0 && (this.blending = e?.blending), e?.blendSrc !== void 0 && (this.blendSrc = e?.blendSrc), e?.blendDst !== void 0 && (this.blendDst = e?.blendDst), e?.blendEquation !== void 0 && (this.blendEquation = e?.blendEquation), e?.blendSrcAlpha !== void 0 && (this.blendSrcAlpha = e?.blendSrcAlpha), e?.blendDstAlpha !== void 0 && (this.blendDstAlpha = e?.blendDstAlpha), e?.blendEquationAlpha !== void 0 && (this.blendEquationAlpha = e?.blendEquationAlpha), this;
|
|
49
|
-
}
|
|
50
|
-
}, we = {
|
|
51
|
-
uniforms: {
|
|
52
|
-
tDiffuse: { value: null },
|
|
53
|
-
rangeMin: { value: new z(1 / 512, 1 / 512) },
|
|
54
|
-
rangeMax: { value: new z(1 / 512, 1 / 512) }
|
|
55
|
-
},
|
|
56
|
-
vertexShader: "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",
|
|
57
|
-
fragmentShader: "\n uniform sampler2D tDiffuse;\n uniform vec2 rangeMin;\n uniform vec2 rangeMax;\n varying vec2 vUv;\n\n void main() {\n vec4 baseColor = texture2D(tDiffuse, vUv);\n vec2 blur = mix(rangeMax, rangeMin, baseColor.a);\n vec4 sum = vec4( 0.0 );\n sum += texture2D(tDiffuse, vUv - 1.0 * blur) * 0.051;\n sum += texture2D(tDiffuse, vUv - 0.75 * blur) * 0.0918;\n sum += texture2D(tDiffuse, vUv - 0.5 * blur) * 0.12245;\n sum += texture2D(tDiffuse, vUv - 0.25 * blur) * 0.1531;\n sum += baseColor * 0.1633;\n sum += texture2D(tDiffuse, vUv + 0.25 * blur) * 0.1531;\n sum += texture2D(tDiffuse, vUv + 0.5 * blur) * 0.12245;\n sum += texture2D(tDiffuse, vUv + 0.75 * blur) * 0.0918;\n sum += texture2D(tDiffuse, vUv + 1.0 * blur) * 0.051;\n gl_FragColor = sum;\n }"
|
|
58
|
-
};
|
|
59
|
-
new z(.1, .9), new z(.1, .9);
|
|
60
|
-
var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }", Ee = "uniform sampler2D tDepth;\n uniform vec4 depthFilter;\n uniform float cameraNear;\n uniform float cameraFar;\n varying vec2 vUv;\n\n #include <packing>\n\n float getLinearDepth(const in vec2 screenPosition) {\n float fragCoordZ = dot(texture2D(tDepth, screenPosition), depthFilter);\n #if PERSPECTIVE_CAMERA == 1\n float viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\n return viewZToOrthographicDepth(viewZ, cameraNear, cameraFar);\n #else\n return fragCoordZ;\n #endif\n }\n\n void main() {\n float depth = getLinearDepth(vUv);\n gl_FragColor = vec4(vec3(1.0 - depth), 1.0);\n }", De = class e extends m {
|
|
61
|
-
static {
|
|
62
|
-
this._linearDepthShader = {
|
|
63
|
-
uniforms: {
|
|
64
|
-
tDepth: { value: null },
|
|
65
|
-
depthFilter: { value: new n(1, 0, 0, 0) },
|
|
66
|
-
cameraNear: { value: .1 },
|
|
67
|
-
cameraFar: { value: 1 }
|
|
68
|
-
},
|
|
69
|
-
defines: {
|
|
70
|
-
PERSPECTIVE_CAMERA: 1,
|
|
71
|
-
ALPHA_DEPTH: 0
|
|
72
|
-
},
|
|
73
|
-
vertexShader: Te,
|
|
74
|
-
fragmentShader: Ee
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
constructor(t) {
|
|
78
|
-
super({
|
|
79
|
-
defines: Object.assign({}, e._linearDepthShader.defines),
|
|
80
|
-
uniforms: D.clone(e._linearDepthShader.uniforms),
|
|
81
|
-
vertexShader: e._linearDepthShader.vertexShader,
|
|
82
|
-
fragmentShader: e._linearDepthShader.fragmentShader,
|
|
83
|
-
blending: 0
|
|
84
|
-
}), this.update(t);
|
|
85
|
-
}
|
|
86
|
-
update(e) {
|
|
87
|
-
if (e?.depthTexture !== void 0 && (this.uniforms.tDepth.value = e?.depthTexture), e?.camera !== void 0) {
|
|
88
|
-
let t = e?.camera || e?.camera;
|
|
89
|
-
this.uniforms.cameraNear.value = t.near, this.uniforms.cameraFar.value = t.far;
|
|
90
|
-
}
|
|
91
|
-
return e?.depthFilter !== void 0 && (this.uniforms.depthFilter.value = e?.depthFilter), this;
|
|
92
|
-
}
|
|
93
|
-
}, K = class {
|
|
94
|
-
constructor() {
|
|
95
|
-
this.isPass = !0, this.enabled = !0, this.needsSwap = !0, this.clear = !1, this.renderToScreen = !1;
|
|
96
|
-
}
|
|
97
|
-
setSize() {}
|
|
98
|
-
render() {
|
|
99
|
-
console.error("THREE.Pass: .render() must be implemented in derived pass.");
|
|
100
|
-
}
|
|
101
|
-
dispose() {}
|
|
102
|
-
}, Oe = new a(-1, 1, 1, -1, 0, 1), ke = new class extends k {
|
|
103
|
-
constructor() {
|
|
104
|
-
super(), this.setAttribute("position", new ce([
|
|
105
|
-
-1,
|
|
106
|
-
3,
|
|
107
|
-
0,
|
|
108
|
-
-1,
|
|
109
|
-
-1,
|
|
110
|
-
0,
|
|
111
|
-
3,
|
|
112
|
-
-1,
|
|
113
|
-
0
|
|
114
|
-
], 3)), this.setAttribute("uv", new ce([
|
|
115
|
-
0,
|
|
116
|
-
2,
|
|
117
|
-
0,
|
|
118
|
-
0,
|
|
119
|
-
2,
|
|
120
|
-
0
|
|
121
|
-
], 2));
|
|
122
|
-
}
|
|
123
|
-
}(), Ae = class {
|
|
124
|
-
constructor(e) {
|
|
125
|
-
this._mesh = new C(ke, e);
|
|
126
|
-
}
|
|
127
|
-
dispose() {
|
|
128
|
-
this._mesh.geometry.dispose();
|
|
129
|
-
}
|
|
130
|
-
render(e) {
|
|
131
|
-
e.render(this._mesh, Oe);
|
|
132
|
-
}
|
|
133
|
-
get material() {
|
|
134
|
-
return this._mesh.material;
|
|
135
|
-
}
|
|
136
|
-
set material(e) {
|
|
137
|
-
this._mesh.material = e;
|
|
138
|
-
}
|
|
139
|
-
}, je = class {
|
|
140
|
-
constructor(e = Math) {
|
|
141
|
-
this.grad3 = [
|
|
142
|
-
[
|
|
143
|
-
1,
|
|
144
|
-
1,
|
|
145
|
-
0
|
|
146
|
-
],
|
|
147
|
-
[
|
|
148
|
-
-1,
|
|
149
|
-
1,
|
|
150
|
-
0
|
|
151
|
-
],
|
|
152
|
-
[
|
|
153
|
-
1,
|
|
154
|
-
-1,
|
|
155
|
-
0
|
|
156
|
-
],
|
|
157
|
-
[
|
|
158
|
-
-1,
|
|
159
|
-
-1,
|
|
160
|
-
0
|
|
161
|
-
],
|
|
162
|
-
[
|
|
163
|
-
1,
|
|
164
|
-
0,
|
|
165
|
-
1
|
|
166
|
-
],
|
|
167
|
-
[
|
|
168
|
-
-1,
|
|
169
|
-
0,
|
|
170
|
-
1
|
|
171
|
-
],
|
|
172
|
-
[
|
|
173
|
-
1,
|
|
174
|
-
0,
|
|
175
|
-
-1
|
|
176
|
-
],
|
|
177
|
-
[
|
|
178
|
-
-1,
|
|
179
|
-
0,
|
|
180
|
-
-1
|
|
181
|
-
],
|
|
182
|
-
[
|
|
183
|
-
0,
|
|
184
|
-
1,
|
|
185
|
-
1
|
|
186
|
-
],
|
|
187
|
-
[
|
|
188
|
-
0,
|
|
189
|
-
-1,
|
|
190
|
-
1
|
|
191
|
-
],
|
|
192
|
-
[
|
|
193
|
-
0,
|
|
194
|
-
1,
|
|
195
|
-
-1
|
|
196
|
-
],
|
|
197
|
-
[
|
|
198
|
-
0,
|
|
199
|
-
-1,
|
|
200
|
-
-1
|
|
201
|
-
]
|
|
202
|
-
], this.grad4 = [
|
|
203
|
-
[
|
|
204
|
-
0,
|
|
205
|
-
1,
|
|
206
|
-
1,
|
|
207
|
-
1
|
|
208
|
-
],
|
|
209
|
-
[
|
|
210
|
-
0,
|
|
211
|
-
1,
|
|
212
|
-
1,
|
|
213
|
-
-1
|
|
214
|
-
],
|
|
215
|
-
[
|
|
216
|
-
0,
|
|
217
|
-
1,
|
|
218
|
-
-1,
|
|
219
|
-
1
|
|
220
|
-
],
|
|
221
|
-
[
|
|
222
|
-
0,
|
|
223
|
-
1,
|
|
224
|
-
-1,
|
|
225
|
-
-1
|
|
226
|
-
],
|
|
227
|
-
[
|
|
228
|
-
0,
|
|
229
|
-
-1,
|
|
230
|
-
1,
|
|
231
|
-
1
|
|
232
|
-
],
|
|
233
|
-
[
|
|
234
|
-
0,
|
|
235
|
-
-1,
|
|
236
|
-
1,
|
|
237
|
-
-1
|
|
238
|
-
],
|
|
239
|
-
[
|
|
240
|
-
0,
|
|
241
|
-
-1,
|
|
242
|
-
-1,
|
|
243
|
-
1
|
|
244
|
-
],
|
|
245
|
-
[
|
|
246
|
-
0,
|
|
247
|
-
-1,
|
|
248
|
-
-1,
|
|
249
|
-
-1
|
|
250
|
-
],
|
|
251
|
-
[
|
|
252
|
-
1,
|
|
253
|
-
0,
|
|
254
|
-
1,
|
|
255
|
-
1
|
|
256
|
-
],
|
|
257
|
-
[
|
|
258
|
-
1,
|
|
259
|
-
0,
|
|
260
|
-
1,
|
|
261
|
-
-1
|
|
262
|
-
],
|
|
263
|
-
[
|
|
264
|
-
1,
|
|
265
|
-
0,
|
|
266
|
-
-1,
|
|
267
|
-
1
|
|
268
|
-
],
|
|
269
|
-
[
|
|
270
|
-
1,
|
|
271
|
-
0,
|
|
272
|
-
-1,
|
|
273
|
-
-1
|
|
274
|
-
],
|
|
275
|
-
[
|
|
276
|
-
-1,
|
|
277
|
-
0,
|
|
278
|
-
1,
|
|
279
|
-
1
|
|
280
|
-
],
|
|
281
|
-
[
|
|
282
|
-
-1,
|
|
283
|
-
0,
|
|
284
|
-
1,
|
|
285
|
-
-1
|
|
286
|
-
],
|
|
287
|
-
[
|
|
288
|
-
-1,
|
|
289
|
-
0,
|
|
290
|
-
-1,
|
|
291
|
-
1
|
|
292
|
-
],
|
|
293
|
-
[
|
|
294
|
-
-1,
|
|
295
|
-
0,
|
|
296
|
-
-1,
|
|
297
|
-
-1
|
|
298
|
-
],
|
|
299
|
-
[
|
|
300
|
-
1,
|
|
301
|
-
1,
|
|
302
|
-
0,
|
|
303
|
-
1
|
|
304
|
-
],
|
|
305
|
-
[
|
|
306
|
-
1,
|
|
307
|
-
1,
|
|
308
|
-
0,
|
|
309
|
-
-1
|
|
310
|
-
],
|
|
311
|
-
[
|
|
312
|
-
1,
|
|
313
|
-
-1,
|
|
314
|
-
0,
|
|
315
|
-
1
|
|
316
|
-
],
|
|
317
|
-
[
|
|
318
|
-
1,
|
|
319
|
-
-1,
|
|
320
|
-
0,
|
|
321
|
-
-1
|
|
322
|
-
],
|
|
323
|
-
[
|
|
324
|
-
-1,
|
|
325
|
-
1,
|
|
326
|
-
0,
|
|
327
|
-
1
|
|
328
|
-
],
|
|
329
|
-
[
|
|
330
|
-
-1,
|
|
331
|
-
1,
|
|
332
|
-
0,
|
|
333
|
-
-1
|
|
334
|
-
],
|
|
335
|
-
[
|
|
336
|
-
-1,
|
|
337
|
-
-1,
|
|
338
|
-
0,
|
|
339
|
-
1
|
|
340
|
-
],
|
|
341
|
-
[
|
|
342
|
-
-1,
|
|
343
|
-
-1,
|
|
344
|
-
0,
|
|
345
|
-
-1
|
|
346
|
-
],
|
|
347
|
-
[
|
|
348
|
-
1,
|
|
349
|
-
1,
|
|
350
|
-
1,
|
|
351
|
-
0
|
|
352
|
-
],
|
|
353
|
-
[
|
|
354
|
-
1,
|
|
355
|
-
1,
|
|
356
|
-
-1,
|
|
357
|
-
0
|
|
358
|
-
],
|
|
359
|
-
[
|
|
360
|
-
1,
|
|
361
|
-
-1,
|
|
362
|
-
1,
|
|
363
|
-
0
|
|
364
|
-
],
|
|
365
|
-
[
|
|
366
|
-
1,
|
|
367
|
-
-1,
|
|
368
|
-
-1,
|
|
369
|
-
0
|
|
370
|
-
],
|
|
371
|
-
[
|
|
372
|
-
-1,
|
|
373
|
-
1,
|
|
374
|
-
1,
|
|
375
|
-
0
|
|
376
|
-
],
|
|
377
|
-
[
|
|
378
|
-
-1,
|
|
379
|
-
1,
|
|
380
|
-
-1,
|
|
381
|
-
0
|
|
382
|
-
],
|
|
383
|
-
[
|
|
384
|
-
-1,
|
|
385
|
-
-1,
|
|
386
|
-
1,
|
|
387
|
-
0
|
|
388
|
-
],
|
|
389
|
-
[
|
|
390
|
-
-1,
|
|
391
|
-
-1,
|
|
392
|
-
-1,
|
|
393
|
-
0
|
|
394
|
-
]
|
|
395
|
-
], this.p = [];
|
|
396
|
-
for (let t = 0; t < 256; t++) this.p[t] = Math.floor(e.random() * 256);
|
|
397
|
-
this.perm = [];
|
|
398
|
-
for (let e = 0; e < 512; e++) this.perm[e] = this.p[e & 255];
|
|
399
|
-
this.simplex = [
|
|
400
|
-
[
|
|
401
|
-
0,
|
|
402
|
-
1,
|
|
403
|
-
2,
|
|
404
|
-
3
|
|
405
|
-
],
|
|
406
|
-
[
|
|
407
|
-
0,
|
|
408
|
-
1,
|
|
409
|
-
3,
|
|
410
|
-
2
|
|
411
|
-
],
|
|
412
|
-
[
|
|
413
|
-
0,
|
|
414
|
-
0,
|
|
415
|
-
0,
|
|
416
|
-
0
|
|
417
|
-
],
|
|
418
|
-
[
|
|
419
|
-
0,
|
|
420
|
-
2,
|
|
421
|
-
3,
|
|
422
|
-
1
|
|
423
|
-
],
|
|
424
|
-
[
|
|
425
|
-
0,
|
|
426
|
-
0,
|
|
427
|
-
0,
|
|
428
|
-
0
|
|
429
|
-
],
|
|
430
|
-
[
|
|
431
|
-
0,
|
|
432
|
-
0,
|
|
433
|
-
0,
|
|
434
|
-
0
|
|
435
|
-
],
|
|
436
|
-
[
|
|
437
|
-
0,
|
|
438
|
-
0,
|
|
439
|
-
0,
|
|
440
|
-
0
|
|
441
|
-
],
|
|
442
|
-
[
|
|
443
|
-
1,
|
|
444
|
-
2,
|
|
445
|
-
3,
|
|
446
|
-
0
|
|
447
|
-
],
|
|
448
|
-
[
|
|
449
|
-
0,
|
|
450
|
-
2,
|
|
451
|
-
1,
|
|
452
|
-
3
|
|
453
|
-
],
|
|
454
|
-
[
|
|
455
|
-
0,
|
|
456
|
-
0,
|
|
457
|
-
0,
|
|
458
|
-
0
|
|
459
|
-
],
|
|
460
|
-
[
|
|
461
|
-
0,
|
|
462
|
-
3,
|
|
463
|
-
1,
|
|
464
|
-
2
|
|
465
|
-
],
|
|
466
|
-
[
|
|
467
|
-
0,
|
|
468
|
-
3,
|
|
469
|
-
2,
|
|
470
|
-
1
|
|
471
|
-
],
|
|
472
|
-
[
|
|
473
|
-
0,
|
|
474
|
-
0,
|
|
475
|
-
0,
|
|
476
|
-
0
|
|
477
|
-
],
|
|
478
|
-
[
|
|
479
|
-
0,
|
|
480
|
-
0,
|
|
481
|
-
0,
|
|
482
|
-
0
|
|
483
|
-
],
|
|
484
|
-
[
|
|
485
|
-
0,
|
|
486
|
-
0,
|
|
487
|
-
0,
|
|
488
|
-
0
|
|
489
|
-
],
|
|
490
|
-
[
|
|
491
|
-
1,
|
|
492
|
-
3,
|
|
493
|
-
2,
|
|
494
|
-
0
|
|
495
|
-
],
|
|
496
|
-
[
|
|
497
|
-
0,
|
|
498
|
-
0,
|
|
499
|
-
0,
|
|
500
|
-
0
|
|
501
|
-
],
|
|
502
|
-
[
|
|
503
|
-
0,
|
|
504
|
-
0,
|
|
505
|
-
0,
|
|
506
|
-
0
|
|
507
|
-
],
|
|
508
|
-
[
|
|
509
|
-
0,
|
|
510
|
-
0,
|
|
511
|
-
0,
|
|
512
|
-
0
|
|
513
|
-
],
|
|
514
|
-
[
|
|
515
|
-
0,
|
|
516
|
-
0,
|
|
517
|
-
0,
|
|
518
|
-
0
|
|
519
|
-
],
|
|
520
|
-
[
|
|
521
|
-
0,
|
|
522
|
-
0,
|
|
523
|
-
0,
|
|
524
|
-
0
|
|
525
|
-
],
|
|
526
|
-
[
|
|
527
|
-
0,
|
|
528
|
-
0,
|
|
529
|
-
0,
|
|
530
|
-
0
|
|
531
|
-
],
|
|
532
|
-
[
|
|
533
|
-
0,
|
|
534
|
-
0,
|
|
535
|
-
0,
|
|
536
|
-
0
|
|
537
|
-
],
|
|
538
|
-
[
|
|
539
|
-
0,
|
|
540
|
-
0,
|
|
541
|
-
0,
|
|
542
|
-
0
|
|
543
|
-
],
|
|
544
|
-
[
|
|
545
|
-
1,
|
|
546
|
-
2,
|
|
547
|
-
0,
|
|
548
|
-
3
|
|
549
|
-
],
|
|
550
|
-
[
|
|
551
|
-
0,
|
|
552
|
-
0,
|
|
553
|
-
0,
|
|
554
|
-
0
|
|
555
|
-
],
|
|
556
|
-
[
|
|
557
|
-
1,
|
|
558
|
-
3,
|
|
559
|
-
0,
|
|
560
|
-
2
|
|
561
|
-
],
|
|
562
|
-
[
|
|
563
|
-
0,
|
|
564
|
-
0,
|
|
565
|
-
0,
|
|
566
|
-
0
|
|
567
|
-
],
|
|
568
|
-
[
|
|
569
|
-
0,
|
|
570
|
-
0,
|
|
571
|
-
0,
|
|
572
|
-
0
|
|
573
|
-
],
|
|
574
|
-
[
|
|
575
|
-
0,
|
|
576
|
-
0,
|
|
577
|
-
0,
|
|
578
|
-
0
|
|
579
|
-
],
|
|
580
|
-
[
|
|
581
|
-
2,
|
|
582
|
-
3,
|
|
583
|
-
0,
|
|
584
|
-
1
|
|
585
|
-
],
|
|
586
|
-
[
|
|
587
|
-
2,
|
|
588
|
-
3,
|
|
589
|
-
1,
|
|
590
|
-
0
|
|
591
|
-
],
|
|
592
|
-
[
|
|
593
|
-
1,
|
|
594
|
-
0,
|
|
595
|
-
2,
|
|
596
|
-
3
|
|
597
|
-
],
|
|
598
|
-
[
|
|
599
|
-
1,
|
|
600
|
-
0,
|
|
601
|
-
3,
|
|
602
|
-
2
|
|
603
|
-
],
|
|
604
|
-
[
|
|
605
|
-
0,
|
|
606
|
-
0,
|
|
607
|
-
0,
|
|
608
|
-
0
|
|
609
|
-
],
|
|
610
|
-
[
|
|
611
|
-
0,
|
|
612
|
-
0,
|
|
613
|
-
0,
|
|
614
|
-
0
|
|
615
|
-
],
|
|
616
|
-
[
|
|
617
|
-
0,
|
|
618
|
-
0,
|
|
619
|
-
0,
|
|
620
|
-
0
|
|
621
|
-
],
|
|
622
|
-
[
|
|
623
|
-
2,
|
|
624
|
-
0,
|
|
625
|
-
3,
|
|
626
|
-
1
|
|
627
|
-
],
|
|
628
|
-
[
|
|
629
|
-
0,
|
|
630
|
-
0,
|
|
631
|
-
0,
|
|
632
|
-
0
|
|
633
|
-
],
|
|
634
|
-
[
|
|
635
|
-
2,
|
|
636
|
-
1,
|
|
637
|
-
3,
|
|
638
|
-
0
|
|
639
|
-
],
|
|
640
|
-
[
|
|
641
|
-
0,
|
|
642
|
-
0,
|
|
643
|
-
0,
|
|
644
|
-
0
|
|
645
|
-
],
|
|
646
|
-
[
|
|
647
|
-
0,
|
|
648
|
-
0,
|
|
649
|
-
0,
|
|
650
|
-
0
|
|
651
|
-
],
|
|
652
|
-
[
|
|
653
|
-
0,
|
|
654
|
-
0,
|
|
655
|
-
0,
|
|
656
|
-
0
|
|
657
|
-
],
|
|
658
|
-
[
|
|
659
|
-
0,
|
|
660
|
-
0,
|
|
661
|
-
0,
|
|
662
|
-
0
|
|
663
|
-
],
|
|
664
|
-
[
|
|
665
|
-
0,
|
|
666
|
-
0,
|
|
667
|
-
0,
|
|
668
|
-
0
|
|
669
|
-
],
|
|
670
|
-
[
|
|
671
|
-
0,
|
|
672
|
-
0,
|
|
673
|
-
0,
|
|
674
|
-
0
|
|
675
|
-
],
|
|
676
|
-
[
|
|
677
|
-
0,
|
|
678
|
-
0,
|
|
679
|
-
0,
|
|
680
|
-
0
|
|
681
|
-
],
|
|
682
|
-
[
|
|
683
|
-
0,
|
|
684
|
-
0,
|
|
685
|
-
0,
|
|
686
|
-
0
|
|
687
|
-
],
|
|
688
|
-
[
|
|
689
|
-
2,
|
|
690
|
-
0,
|
|
691
|
-
1,
|
|
692
|
-
3
|
|
693
|
-
],
|
|
694
|
-
[
|
|
695
|
-
0,
|
|
696
|
-
0,
|
|
697
|
-
0,
|
|
698
|
-
0
|
|
699
|
-
],
|
|
700
|
-
[
|
|
701
|
-
0,
|
|
702
|
-
0,
|
|
703
|
-
0,
|
|
704
|
-
0
|
|
705
|
-
],
|
|
706
|
-
[
|
|
707
|
-
0,
|
|
708
|
-
0,
|
|
709
|
-
0,
|
|
710
|
-
0
|
|
711
|
-
],
|
|
712
|
-
[
|
|
713
|
-
3,
|
|
714
|
-
0,
|
|
715
|
-
1,
|
|
716
|
-
2
|
|
717
|
-
],
|
|
718
|
-
[
|
|
719
|
-
3,
|
|
720
|
-
0,
|
|
721
|
-
2,
|
|
722
|
-
1
|
|
723
|
-
],
|
|
724
|
-
[
|
|
725
|
-
0,
|
|
726
|
-
0,
|
|
727
|
-
0,
|
|
728
|
-
0
|
|
729
|
-
],
|
|
730
|
-
[
|
|
731
|
-
3,
|
|
732
|
-
1,
|
|
733
|
-
2,
|
|
734
|
-
0
|
|
735
|
-
],
|
|
736
|
-
[
|
|
737
|
-
2,
|
|
738
|
-
1,
|
|
739
|
-
0,
|
|
740
|
-
3
|
|
741
|
-
],
|
|
742
|
-
[
|
|
743
|
-
0,
|
|
744
|
-
0,
|
|
745
|
-
0,
|
|
746
|
-
0
|
|
747
|
-
],
|
|
748
|
-
[
|
|
749
|
-
0,
|
|
750
|
-
0,
|
|
751
|
-
0,
|
|
752
|
-
0
|
|
753
|
-
],
|
|
754
|
-
[
|
|
755
|
-
0,
|
|
756
|
-
0,
|
|
757
|
-
0,
|
|
758
|
-
0
|
|
759
|
-
],
|
|
760
|
-
[
|
|
761
|
-
3,
|
|
762
|
-
1,
|
|
763
|
-
0,
|
|
764
|
-
2
|
|
765
|
-
],
|
|
766
|
-
[
|
|
767
|
-
0,
|
|
768
|
-
0,
|
|
769
|
-
0,
|
|
770
|
-
0
|
|
771
|
-
],
|
|
772
|
-
[
|
|
773
|
-
3,
|
|
774
|
-
2,
|
|
775
|
-
0,
|
|
776
|
-
1
|
|
777
|
-
],
|
|
778
|
-
[
|
|
779
|
-
3,
|
|
780
|
-
2,
|
|
781
|
-
1,
|
|
782
|
-
0
|
|
783
|
-
]
|
|
784
|
-
];
|
|
785
|
-
}
|
|
786
|
-
noise(e, t) {
|
|
787
|
-
let n, r, i, a = .5 * (Math.sqrt(3) - 1), o = (e + t) * a, s = Math.floor(e + o), c = Math.floor(t + o), l = (3 - Math.sqrt(3)) / 6, u = (s + c) * l, d = s - u, f = c - u, p = e - d, m = t - f, h, g;
|
|
788
|
-
p > m ? (h = 1, g = 0) : (h = 0, g = 1);
|
|
789
|
-
let _ = p - h + l, v = m - g + l, y = p - 1 + 2 * l, b = m - 1 + 2 * l, x = s & 255, S = c & 255, C = this.perm[x + this.perm[S]] % 12, w = this.perm[x + h + this.perm[S + g]] % 12, T = this.perm[x + 1 + this.perm[S + 1]] % 12, E = .5 - p * p - m * m;
|
|
790
|
-
E < 0 ? n = 0 : (E *= E, n = E * E * this._dot(this.grad3[C], p, m));
|
|
791
|
-
let D = .5 - _ * _ - v * v;
|
|
792
|
-
D < 0 ? r = 0 : (D *= D, r = D * D * this._dot(this.grad3[w], _, v));
|
|
793
|
-
let O = .5 - y * y - b * b;
|
|
794
|
-
return O < 0 ? i = 0 : (O *= O, i = O * O * this._dot(this.grad3[T], y, b)), 70 * (n + r + i);
|
|
795
|
-
}
|
|
796
|
-
noise3d(e, t, n) {
|
|
797
|
-
let r, i, a, o, s = (e + t + n) * (1 / 3), c = Math.floor(e + s), l = Math.floor(t + s), u = Math.floor(n + s), d = 1 / 6, f = (c + l + u) * d, p = c - f, m = l - f, h = u - f, g = e - p, _ = t - m, v = n - h, y, b, x, S, C, w;
|
|
798
|
-
g >= _ ? _ >= v ? (y = 1, b = 0, x = 0, S = 1, C = 1, w = 0) : g >= v ? (y = 1, b = 0, x = 0, S = 1, C = 0, w = 1) : (y = 0, b = 0, x = 1, S = 1, C = 0, w = 1) : _ < v ? (y = 0, b = 0, x = 1, S = 0, C = 1, w = 1) : g < v ? (y = 0, b = 1, x = 0, S = 0, C = 1, w = 1) : (y = 0, b = 1, x = 0, S = 1, C = 1, w = 0);
|
|
799
|
-
let T = g - y + d, E = _ - b + d, D = v - x + d, O = g - S + 2 * d, ee = _ - C + 2 * d, k = v - w + 2 * d, te = g - 1 + 3 * d, ne = _ - 1 + 3 * d, re = v - 1 + 3 * d, A = c & 255, j = l & 255, M = u & 255, ie = this.perm[A + this.perm[j + this.perm[M]]] % 12, ae = this.perm[A + y + this.perm[j + b + this.perm[M + x]]] % 12, oe = this.perm[A + S + this.perm[j + C + this.perm[M + w]]] % 12, se = this.perm[A + 1 + this.perm[j + 1 + this.perm[M + 1]]] % 12, N = .6 - g * g - _ * _ - v * v;
|
|
800
|
-
N < 0 ? r = 0 : (N *= N, r = N * N * this._dot3(this.grad3[ie], g, _, v));
|
|
801
|
-
let P = .6 - T * T - E * E - D * D;
|
|
802
|
-
P < 0 ? i = 0 : (P *= P, i = P * P * this._dot3(this.grad3[ae], T, E, D));
|
|
803
|
-
let F = .6 - O * O - ee * ee - k * k;
|
|
804
|
-
F < 0 ? a = 0 : (F *= F, a = F * F * this._dot3(this.grad3[oe], O, ee, k));
|
|
805
|
-
let I = .6 - te * te - ne * ne - re * re;
|
|
806
|
-
return I < 0 ? o = 0 : (I *= I, o = I * I * this._dot3(this.grad3[se], te, ne, re)), 32 * (r + i + a + o);
|
|
807
|
-
}
|
|
808
|
-
noise4d(e, t, n, r) {
|
|
809
|
-
let i = this.grad4, a = this.simplex, o = this.perm, s = (Math.sqrt(5) - 1) / 4, c = (5 - Math.sqrt(5)) / 20, l, u, d, f, p, m = (e + t + n + r) * s, h = Math.floor(e + m), g = Math.floor(t + m), _ = Math.floor(n + m), v = Math.floor(r + m), y = (h + g + _ + v) * c, b = h - y, x = g - y, S = _ - y, C = v - y, w = e - b, T = t - x, E = n - S, D = r - C, O = w > T ? 32 : 0, ee = w > E ? 16 : 0, k = T > E ? 8 : 0, te = w > D ? 4 : 0, ne = T > D ? 2 : 0, re = E > D ? 1 : 0, A = O + ee + k + te + ne + re, j = a[A][0] >= 3 ? 1 : 0, M = a[A][1] >= 3 ? 1 : 0, ie = a[A][2] >= 3 ? 1 : 0, ae = a[A][3] >= 3 ? 1 : 0, oe = a[A][0] >= 2 ? 1 : 0, se = a[A][1] >= 2 ? 1 : 0, N = a[A][2] >= 2 ? 1 : 0, P = a[A][3] >= 2 ? 1 : 0, F = a[A][0] >= 1 ? 1 : 0, I = a[A][1] >= 1 ? 1 : 0, L = a[A][2] >= 1 ? 1 : 0, ce = a[A][3] >= 1 ? 1 : 0, le = w - j + c, R = T - M + c, z = E - ie + c, ue = D - ae + c, de = w - oe + 2 * c, fe = T - se + 2 * c, pe = E - N + 2 * c, me = D - P + 2 * c, he = w - F + 3 * c, ge = T - I + 3 * c, _e = E - L + 3 * c, ve = D - ce + 3 * c, B = w - 1 + 4 * c, ye = T - 1 + 4 * c, be = E - 1 + 4 * c, xe = D - 1 + 4 * c, V = h & 255, H = g & 255, U = _ & 255, W = v & 255, Se = o[V + o[H + o[U + o[W]]]] % 32, Ce = o[V + j + o[H + M + o[U + ie + o[W + ae]]]] % 32, G = o[V + oe + o[H + se + o[U + N + o[W + P]]]] % 32, we = o[V + F + o[H + I + o[U + L + o[W + ce]]]] % 32, Te = o[V + 1 + o[H + 1 + o[U + 1 + o[W + 1]]]] % 32, Ee = .6 - w * w - T * T - E * E - D * D;
|
|
810
|
-
Ee < 0 ? l = 0 : (Ee *= Ee, l = Ee * Ee * this._dot4(i[Se], w, T, E, D));
|
|
811
|
-
let De = .6 - le * le - R * R - z * z - ue * ue;
|
|
812
|
-
De < 0 ? u = 0 : (De *= De, u = De * De * this._dot4(i[Ce], le, R, z, ue));
|
|
813
|
-
let K = .6 - de * de - fe * fe - pe * pe - me * me;
|
|
814
|
-
K < 0 ? d = 0 : (K *= K, d = K * K * this._dot4(i[G], de, fe, pe, me));
|
|
815
|
-
let Oe = .6 - he * he - ge * ge - _e * _e - ve * ve;
|
|
816
|
-
Oe < 0 ? f = 0 : (Oe *= Oe, f = Oe * Oe * this._dot4(i[we], he, ge, _e, ve));
|
|
817
|
-
let ke = .6 - B * B - ye * ye - be * be - xe * xe;
|
|
818
|
-
return ke < 0 ? p = 0 : (ke *= ke, p = ke * ke * this._dot4(i[Te], B, ye, be, xe)), 27 * (l + u + d + f + p);
|
|
819
|
-
}
|
|
820
|
-
_dot(e, t, n) {
|
|
821
|
-
return e[0] * t + e[1] * n;
|
|
822
|
-
}
|
|
823
|
-
_dot3(e, t, n, r) {
|
|
824
|
-
return e[0] * t + e[1] * n + e[2] * r;
|
|
825
|
-
}
|
|
826
|
-
_dot4(e, t, n, r, i) {
|
|
827
|
-
return e[0] * t + e[1] * n + e[2] * r + e[3] * i;
|
|
828
|
-
}
|
|
829
|
-
}, Me = (e, t) => {
|
|
830
|
-
e.left = t.min.x, e.right = t.max.x, e.bottom = t.min.y, e.top = t.max.y, e.near = Math.min(-t.min.z, -t.max.z), e.far = Math.max(-t.min.z, -t.max.z), e.updateProjectionMatrix();
|
|
831
|
-
}, Ne = (e, t) => {
|
|
832
|
-
let n = Math.min(-t.min.z, -t.max.z), r = Math.max(-t.min.z, -t.max.z);
|
|
833
|
-
if (n < .001) return;
|
|
834
|
-
let i = Math.max(Math.abs(t.min.x), Math.abs(t.max.x)), a = Math.max(Math.abs(t.min.y), Math.abs(t.max.y));
|
|
835
|
-
e.aspect = i / a, e.fov = A.radToDeg(Math.atan2(a, n) * 2), e.near = n, e.far = r, e.updateProjectionMatrix();
|
|
836
|
-
}, Pe = class {
|
|
837
|
-
constructor() {
|
|
838
|
-
this.bounds = new E(new f(-1, -1, -1), new f(1, 1, 1)), this.size = new f(2, 2, 2), this.center = new f(0, 0, 0), this.maxSceneDistanceFromCenter = Math.sqrt(3), this.maxSceneDistanceFrom0 = Math.sqrt(3);
|
|
839
|
-
}
|
|
840
|
-
updateFromBox(e) {
|
|
841
|
-
this.bounds !== e && this.bounds.copy(e), this.bounds.getSize(this.size), this.bounds.getCenter(this.center), this.maxSceneDistanceFromCenter = this.size.length() / 2, this.maxSceneDistanceFrom0 = new f(Math.max(Math.abs(this.bounds.min.x), Math.abs(this.bounds.max.x)), Math.max(Math.abs(this.bounds.min.y), Math.abs(this.bounds.max.y)), Math.max(Math.abs(this.bounds.min.z), Math.abs(this.bounds.max.z))).length();
|
|
842
|
-
}
|
|
843
|
-
updateCameraViewVolumeFromBounds(e) {
|
|
844
|
-
e.updateMatrixWorld();
|
|
845
|
-
let t = this.bounds.clone().applyMatrix4(e.matrixWorldInverse);
|
|
846
|
-
e instanceof a ? Me(e, t) : e instanceof u && Ne(e, t);
|
|
847
|
-
}
|
|
848
|
-
getNearAndFarForPerspectiveCamera(e, t = 1) {
|
|
849
|
-
let n = e.clone().sub(this.center).length();
|
|
850
|
-
return [Math.max(.01, n - this.maxSceneDistanceFromCenter - .01), n + this.maxSceneDistanceFromCenter * t + .01];
|
|
851
|
-
}
|
|
852
|
-
}, Fe = class {
|
|
853
|
-
changed(e) {
|
|
854
|
-
let t = !this._lastCameraProjection?.equals(e.projectionMatrix) || !this._lastCameraWorld?.equals(e.matrixWorld);
|
|
855
|
-
return this._lastCameraProjection = e.projectionMatrix?.clone(), this._lastCameraWorld = e.matrixWorld?.clone(), t;
|
|
856
|
-
}
|
|
857
|
-
}, Ie = (e) => {
|
|
858
|
-
let t = Math.floor(e) % 2 == 0 ? Math.floor(e) + 1 : Math.floor(e), n = t * t, r = Array(n).fill(0), i = Math.floor(t / 2), a = t - 1;
|
|
859
|
-
for (let e = 1; e <= n;) {
|
|
860
|
-
if (i === -1 && a === t ? (a = t - 2, i = 0) : (a === t && (a = 0), i < 0 && (i = t - 1)), r[i * t + a] !== 0) {
|
|
861
|
-
a -= 2, i++;
|
|
862
|
-
continue;
|
|
863
|
-
} else r[i * t + a] = e++;
|
|
864
|
-
a++, i--;
|
|
865
|
-
}
|
|
866
|
-
return r;
|
|
867
|
-
}, Le = (e) => {
|
|
868
|
-
let t = new je(), n = Math.floor(e) % 2 == 0 ? Math.floor(e) + 1 : Math.floor(e), r = Ie(n), i = r.length, a = new Uint8Array(i * 4);
|
|
869
|
-
for (let n = 0; n < i; ++n) {
|
|
870
|
-
let o = r[n], s = 2 * Math.PI * o / i, c = new f(Math.cos(s), Math.sin(s), 0).normalize();
|
|
871
|
-
a[n * 4] = (c.x * .5 + .5) * 255, a[n * 4 + 1] = (c.y * .5 + .5) * 255, a[n * 4 + 2] = 127, a[n * 4 + 3] = (t.noise(n / e, n % e) * .5 + .5) * 255;
|
|
872
|
-
}
|
|
873
|
-
let o = new h(a, n, n);
|
|
874
|
-
return o.wrapS = l, o.wrapT = l, o.needsUpdate = !0, o;
|
|
875
|
-
}, Re = class {
|
|
876
|
-
constructor() {
|
|
877
|
-
this._originalClearColor = new R(), this._originalClearAlpha = 0, this._originalAutoClear = !1, this._originalRenderTarget = null, this._screenSpaceQuad = new Ae(void 0), this._emptyScene = new s(), this._defaultCamera = new u();
|
|
878
|
-
}
|
|
879
|
-
renderWithOverrideMaterial(e, t, n, r, i, a, o) {
|
|
880
|
-
this._backup(e), this._prepareRenderer(e, i, a, o);
|
|
881
|
-
let s = t.overrideMaterial;
|
|
882
|
-
t.overrideMaterial = r, e.render(t, n), t.overrideMaterial = s, this._restore(e);
|
|
883
|
-
}
|
|
884
|
-
clear(e, t, n, r) {
|
|
885
|
-
this._backup(e), this._prepareRenderer(e, t, n, r), e.render(this._emptyScene, this._defaultCamera), this._restore(e);
|
|
886
|
-
}
|
|
887
|
-
render(e, t, n, r, i, a) {
|
|
888
|
-
this._backup(e), this._prepareRenderer(e, r, i, a), e.render(t, n), this._restore(e);
|
|
889
|
-
}
|
|
890
|
-
renderScreenSpace(e, t, n, r, i) {
|
|
891
|
-
this._backup(e), this._prepareRenderer(e, n, r, i), this._screenSpaceQuad.material = t, this._screenSpaceQuad.render(e), this._restore(e);
|
|
892
|
-
}
|
|
893
|
-
_prepareRenderer(e, t, n, r) {
|
|
894
|
-
e.setRenderTarget(t), e.autoClear = !1, n != null && (e.setClearColor(n), e.setClearAlpha(r || 0), e.clear());
|
|
895
|
-
}
|
|
896
|
-
_backup(e) {
|
|
897
|
-
e.getClearColor(this._originalClearColor), this._originalClearAlpha = e.getClearAlpha(), this._originalAutoClear = e.autoClear, this._originalRenderTarget = e.getRenderTarget();
|
|
898
|
-
}
|
|
899
|
-
_restore(e) {
|
|
900
|
-
e.setClearColor(this._originalClearColor), e.setClearAlpha(this._originalClearAlpha), e.setRenderTarget(this._originalRenderTarget), e.autoClear = this._originalAutoClear;
|
|
901
|
-
}
|
|
902
|
-
}, ze = class {
|
|
903
|
-
constructor(e, t) {
|
|
904
|
-
this._passRenderer = t?.passRenderer ?? new Re(), this._blurMaterial = new m(e ?? we), this._blurMaterial.depthTest = !1;
|
|
905
|
-
}
|
|
906
|
-
dispose() {
|
|
907
|
-
this._blurMaterial.dispose();
|
|
908
|
-
}
|
|
909
|
-
render(e, t, n, r) {
|
|
910
|
-
this._blurMaterial.uniforms.tDiffuse.value = t[0].texture, this._blurMaterial.uniforms.rangeMin.value.x = n[0], this._blurMaterial.uniforms.rangeMin.value.y = 0, this._blurMaterial.uniforms.rangeMax.value.x = r[0], this._blurMaterial.uniforms.rangeMax.value.y = 0, this._passRenderer.renderScreenSpace(e, this._blurMaterial, t[1]), this._blurMaterial.uniforms.tDiffuse.value = t[1].texture, this._blurMaterial.uniforms.rangeMin.value.x = 0, this._blurMaterial.uniforms.rangeMin.value.y = n[1], this._blurMaterial.uniforms.rangeMax.value.x = 0, this._blurMaterial.uniforms.rangeMax.value.y = r[1], this._passRenderer.renderScreenSpace(e, this._blurMaterial, t[2]);
|
|
911
|
-
}
|
|
912
|
-
}, Be = class e extends C {
|
|
1
|
+
import { k as e } from "./threejs-utils-E4yVZATI.mjs";
|
|
2
|
+
import { An as t, Ci as n, E as r, Ei as i, En as a, Gn as o, J as s, Mr as c, On as l, S as u, Si as d, Tr as f, Ur as p, V as m, Vt as h, Wr as g, Y as _, Z as ee, _n as v, at as te, bn as y, cn as b, ct as x, en as ne, f as re, fi as S, fn as ie, gn as ae, h as oe, hi as se, hn as ce, ht as le, kr as ue, ln as C, mn as de, mt as fe, ni as pe, oi as me, pi as w, qt as T, si as he, sn as E, st as ge, un as _e, w as D, xi as O, y as ve, z as k, zt as ye } from "./three.core-tV_4n8Wg.mjs";
|
|
3
|
+
import { r as be } from "./three.module-DC5fF9Zl.mjs";
|
|
4
|
+
import { A, C as j, D as xe, E as Se, O as Ce, S as M, T as N, _ as P, a as we, b as Te, d as Ee, f as F, g as I, h as De, i as Oe, k as ke, l as L, m as Ae, n as je, o as Me, p as Ne, r as Pe, s as Fe, t as Ie, u as R, v as z, w as B, x as Le, y as Re } from "./shading-settings-BWeccIZv.mjs";
|
|
5
|
+
import { n as ze, r as Be, t as Ve } from "./decorate-CTUwswpM.mjs";
|
|
6
|
+
import "./dimensioning-helper-DMop5qcu.mjs";
|
|
7
|
+
//#region packages/common-core/src/webgl/renderer/objects/shadow-ground-plane.ts
|
|
8
|
+
var He = class e extends b {
|
|
913
9
|
static {
|
|
914
10
|
this.alphaMap = !0;
|
|
915
11
|
}
|
|
916
12
|
constructor(n, r) {
|
|
917
|
-
super(new t(1, 1, 10, 10), new
|
|
13
|
+
super(new t(1, 1, 10, 10), new ae({
|
|
918
14
|
color: e.alphaMap ? 0 : 16777215,
|
|
919
15
|
transparent: !0,
|
|
920
16
|
depthWrite: !1,
|
|
@@ -943,7 +39,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
943
39
|
let t = this.material;
|
|
944
40
|
e.opacity && t.opacity !== e.opacity && (t.opacity = e.opacity), e.polygonOffset && t.polygonOffsetFactor !== e.polygonOffset && (t.polygonOffset = !0, t.polygonOffsetFactor = e.polygonOffset, t.polygonOffsetUnits = e.polygonOffset), t.needsUpdate = !0;
|
|
945
41
|
}
|
|
946
|
-
},
|
|
42
|
+
}, V = class extends P {
|
|
947
43
|
get renderPassManager() {
|
|
948
44
|
return this._renderPassManager;
|
|
949
45
|
}
|
|
@@ -968,165 +64,19 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
968
64
|
render(e, t, n, r, i) {
|
|
969
65
|
this.renderPass(e);
|
|
970
66
|
}
|
|
971
|
-
},
|
|
972
|
-
INPUT_RGB_NORMAL: "inputRgbNormal",
|
|
973
|
-
FLOAT_BUFFER_NORMAL: "floatBufferNormal",
|
|
974
|
-
CONSTANT_Z: "constantZ"
|
|
975
|
-
}, Y = {
|
|
976
|
-
SEPARATE_BUFFER: "separateBuffer",
|
|
977
|
-
NORMAL_VECTOR_ALPHA: "normalVectorAlpha"
|
|
978
|
-
}, X = {
|
|
979
|
-
SSAO: 0,
|
|
980
|
-
SAO: 1,
|
|
981
|
-
N8AO: 2,
|
|
982
|
-
HBAO: 3,
|
|
983
|
-
GTAO: 4
|
|
984
|
-
}, Ve = (e, t) => {
|
|
985
|
-
let n = He(e, t), r = "vec4[SAMPLES](";
|
|
986
|
-
for (let t = 0; t < e; t++) {
|
|
987
|
-
let i = n[t];
|
|
988
|
-
r += `vec4(${i.x}, ${i.y}, ${i.z}, ${i.w})${t < e - 1 ? "," : ")"}`;
|
|
989
|
-
}
|
|
990
|
-
return r;
|
|
991
|
-
}, He = (e, t) => {
|
|
992
|
-
let r = [];
|
|
993
|
-
for (let i = 0; i < e; i++) {
|
|
994
|
-
let a = i * Math.PI * (3 - Math.sqrt(5)), o = .01 + i / (e - 1) * .99, s = t ? Math.sqrt(1 - o * o) : 1 - o, c = Math.cos(a) * s, l = Math.sin(a) * s, u = Math.floor(e / 4), d = 1 - (Math.floor(i / 4) + i % 4 * u) / e;
|
|
995
|
-
d = .1 + .9 * d, r.push(new n(c, l, o, d));
|
|
996
|
-
}
|
|
997
|
-
return r;
|
|
998
|
-
}, Ue = {
|
|
999
|
-
name: "AOShader",
|
|
1000
|
-
defines: {
|
|
1001
|
-
PERSPECTIVE_CAMERA: 1,
|
|
1002
|
-
SAMPLES: 16,
|
|
1003
|
-
SAMPLE_VECTORS: Ve(16, !1),
|
|
1004
|
-
NORMAL_VECTOR_TYPE: 1,
|
|
1005
|
-
DEPTH_SWIZZLING: "x",
|
|
1006
|
-
AO_ALGORITHM: X.GTAO,
|
|
1007
|
-
NV_ALIGNED_SAMPLES: 1,
|
|
1008
|
-
SCREEN_SPACE_RADIUS: 0,
|
|
1009
|
-
SCREEN_SPACE_RADIUS_SCALE: 100,
|
|
1010
|
-
SCENE_CLIP_BOX: 0,
|
|
1011
|
-
NORMAL_VECTOR_ANTIALIAS: 2,
|
|
1012
|
-
DEPTH_BUFFER_ANTIALIAS: 1
|
|
1013
|
-
},
|
|
1014
|
-
uniforms: {
|
|
1015
|
-
tNormal: { value: null },
|
|
1016
|
-
tDepth: { value: null },
|
|
1017
|
-
tNoise: { value: null },
|
|
1018
|
-
resolution: { value: new z() },
|
|
1019
|
-
cameraNear: { value: null },
|
|
1020
|
-
cameraFar: { value: null },
|
|
1021
|
-
cameraProjectionMatrix: { value: new L() },
|
|
1022
|
-
cameraProjectionMatrixInverse: { value: new L() },
|
|
1023
|
-
cameraWorldMatrix: { value: new L() },
|
|
1024
|
-
radius: { value: 1 },
|
|
1025
|
-
distanceExponent: { value: 1 },
|
|
1026
|
-
thickness: { value: 1 },
|
|
1027
|
-
distanceFallOff: { value: 1 },
|
|
1028
|
-
bias: { value: .001 },
|
|
1029
|
-
scale: { value: 1 },
|
|
1030
|
-
sceneBoxMin: { value: new f(-1, -1, -1) },
|
|
1031
|
-
sceneBoxMax: { value: new f(1, 1, 1) }
|
|
1032
|
-
},
|
|
1033
|
-
vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
1034
|
-
fragmentShader: "\n\n varying vec2 vUv;\n uniform highp sampler2D tNormal;\n uniform highp sampler2D tDepth;\n uniform sampler2D tNoise;\n uniform vec2 resolution;\n uniform float cameraNear;\n uniform float cameraFar;\n uniform mat4 cameraProjectionMatrix;\n uniform mat4 cameraProjectionMatrixInverse;\n uniform mat4 cameraWorldMatrix;\n uniform float radius;\n uniform float distanceExponent;\n uniform float thickness;\n uniform float distanceFallOff;\n uniform float bias;\n uniform float scale;\n #if SCENE_CLIP_BOX == 1\n uniform vec3 sceneBoxMin;\n uniform vec3 sceneBoxMax;\n #endif\n\n #include <common>\n #include <packing>\n\n #ifndef FRAGMENT_OUTPUT\n #define FRAGMENT_OUTPUT vec4(vec3(ao), 1.)\n #endif\n\n const vec4 sampleKernel[SAMPLES] = SAMPLE_VECTORS;\n\n vec3 getViewPosition(const in vec2 screenPosition, const in float depth) {\n vec4 clipSpacePosition = vec4(vec3(screenPosition, depth) * 2.0 - 1.0, 1.0);\n vec4 viewSpacePosition = cameraProjectionMatrixInverse * clipSpacePosition;\n return viewSpacePosition.xyz / viewSpacePosition.w;\n }\n\n float getDepth(const vec2 uv) {\n #if DEPTH_BUFFER_ANTIALIAS == 1\n vec2 size = vec2(textureSize(tDepth, 0));\n ivec2 p = ivec2(uv * size);\n float d0 = texelFetch(tDepth, p, 0).DEPTH_SWIZZLING;\n vec2 depth = vec2(d0, 1.0);\n float d1 = texelFetch(tDepth, p + ivec2(1, 0), 0).DEPTH_SWIZZLING;\n depth += vec2(d1, 1.0) * step(abs(d1 - d0), 0.1);\n float d2 = texelFetch(tDepth, p - ivec2(1, 0), 0).DEPTH_SWIZZLING;\n depth += vec2(d2, 1.0) * step(abs(d2 - d0), 0.1);\n float d3 = texelFetch(tDepth, p + ivec2(0, 1), 0).DEPTH_SWIZZLING;\n depth += vec2(d3, 1.0) * step(abs(d3 - d0), 0.1);\n float d4 = texelFetch(tDepth, p - ivec2(0, 1), 0).DEPTH_SWIZZLING;\n depth += vec2(d4, 1.0) * step(abs(d4 - d0), 0.1);\n return depth.x / depth.y;\n #else\n return textureLod(tDepth, uv.xy, 0.0).DEPTH_SWIZZLING;\n #endif\n }\n\n float fetchDepth(const ivec2 uv) {\n return texelFetch(tDepth, uv.xy, 0).DEPTH_SWIZZLING;\n }\n\n float getViewZ(const in float depth) {\n #if PERSPECTIVE_CAMERA == 1\n return perspectiveDepthToViewZ(depth, cameraNear, cameraFar);\n #else\n return orthographicDepthToViewZ(depth, cameraNear, cameraFar);\n #endif\n }\n\n vec3 computeNormalFromDepth(const vec2 uv) {\n vec2 size = vec2(textureSize(tDepth, 0));\n ivec2 p = ivec2(uv * size);\n float c0 = fetchDepth(p);\n float l2 = fetchDepth(p - ivec2(2, 0));\n float l1 = fetchDepth(p - ivec2(1, 0));\n float r1 = fetchDepth(p + ivec2(1, 0));\n float r2 = fetchDepth(p + ivec2(2, 0));\n float b2 = fetchDepth(p - ivec2(0, 2));\n float b1 = fetchDepth(p - ivec2(0, 1));\n float t1 = fetchDepth(p + ivec2(0, 1));\n float t2 = fetchDepth(p + ivec2(0, 2));\n float dl = abs((2.0 * l1 - l2) - c0);\n float dr = abs((2.0 * r1 - r2) - c0);\n float db = abs((2.0 * b1 - b2) - c0);\n float dt = abs((2.0 * t1 - t2) - c0);\n vec3 ce = getViewPosition(uv, c0).xyz;\n vec3 dpdx = (dl < dr) ? ce - getViewPosition((uv - vec2(1.0 / size.x, 0.0)), l1).xyz\n : -ce + getViewPosition((uv + vec2(1.0 / size.x, 0.0)), r1).xyz;\n vec3 dpdy = (db < dt) ? ce - getViewPosition((uv - vec2(0.0, 1.0 / size.y)), b1).xyz\n : -ce + getViewPosition((uv + vec2(0.0, 1.0 / size.y)), t1).xyz;\n return normalize(cross(dpdx, dpdy));\n }\n\n vec3 getViewNormal(const vec2 uv) {\n #if NORMAL_VECTOR_TYPE == 2\n return normalize(textureLod(tNormal, uv, 0.).rgb);\n #elif NORMAL_VECTOR_TYPE == 1\n return unpackRGBToNormal(textureLod(tNormal, uv, 0.).rgb);\n #else\n return computeNormalFromDepth(uv);\n #endif\n }\n\n vec3 getAntiAliasedViewNormal(const in vec2 screenPosition) {\n #if NORMAL_VECTOR_TYPE == 2\n #if NORMAL_VECTOR_ANTIALIAS == 1\n vec2 uv = screenPosition;\n vec2 size = vec2(textureSize(tNormal, 0));\n ivec2 p = ivec2(screenPosition * size);\n float c0 = texelFetch(tNormal, p, 0).a;\n float l2 = texelFetch(tNormal, p - ivec2(2, 0), 0).a;\n float l1 = texelFetch(tNormal, p - ivec2(1, 0), 0).a;\n float r1 = texelFetch(tNormal, p + ivec2(1, 0), 0).a;\n float r2 = texelFetch(tNormal, p + ivec2(2, 0), 0).a;\n float b2 = texelFetch(tNormal, p - ivec2(0, 2), 0).a;\n float b1 = texelFetch(tNormal, p - ivec2(0, 1), 0).a;\n float t1 = texelFetch(tNormal, p + ivec2(0, 1), 0).a;\n float t2 = texelFetch(tNormal, p + ivec2(0, 2), 0).a;\n float dl = abs((2.0 * l1 - l2) - c0);\n float dr = abs((2.0 * r1 - r2) - c0);\n float db = abs((2.0 * b1 - b2) - c0);\n float dt = abs((2.0 * t1 - t2) - c0);\n vec3 ce = getViewPosition(uv, c0).xyz;\n vec3 dpdx = (dl < dr) ? ce - getViewPosition((uv - vec2(1.0 / size.x, 0.0)), l1).xyz\n : -ce + getViewPosition((uv + vec2(1.0 / size.x, 0.0)), r1).xyz;\n vec3 dpdy = (db < dt) ? ce - getViewPosition((uv - vec2(0.0, 1.0 / size.y)), b1).xyz\n : -ce + getViewPosition((uv + vec2(0.0, 1.0 / size.y)), t1).xyz;\n return normalize(cross(dpdx, dpdy));\n #elif NORMAL_VECTOR_ANTIALIAS == 2\n vec2 size = vec2(textureSize(tNormal, 0));\n ivec2 p = ivec2(screenPosition * size);\n vec3 normalVector = texelFetch(tNormal, p, 0).xyz;\n normalVector += texelFetch(tNormal, p + ivec2(1, 0), 0).xyz;\n normalVector += texelFetch(tNormal, p - ivec2(1, 0), 0).xyz;\n normalVector += texelFetch(tNormal, p + ivec2(0, 1), 0).xyz;\n normalVector += texelFetch(tNormal, p - ivec2(0, 1), 0).xyz;\n return normalize(normalVector);\n #else\n return texture2D(tNormal, screenPosition).xyz;\n #endif\n #elif NORMAL_VECTOR_TYPE == 1\n return unpackRGBToNormal(textureLod(tNormal, screenPosition, 0.).rgb);\n #else\n return computeNormalFromDepth(screenPosition);\n #endif\n }\n\n vec3 getSceneUvAndDepth(vec3 sampleViewPos) {\n vec4 sampleClipPos = cameraProjectionMatrix * vec4(sampleViewPos, 1.);\n vec2 sampleUv = sampleClipPos.xy / sampleClipPos.w * 0.5 + 0.5;\n float sampleSceneDepth = getDepth(sampleUv);\n return vec3(sampleUv, sampleSceneDepth);\n }\n\n float sinusToPlane(vec3 pointOnPlane, vec3 planeNormal, vec3 point) {\n vec3 delta = point - pointOnPlane;\n float sinV = dot(planeNormal, normalize(delta));\n return sinV;\n }\n\n float getFallOff(float delta, float falloffDistance) {\n float fallOff = smoothstep(0., 1., 1. - distanceFallOff * abs(delta) / falloffDistance);\n return fallOff;\n }\n\n void main() {\n float depth = getDepth(vUv.xy);\n if (depth >= 1.0) {\n discard;\n return;\n }\n vec3 viewPos = getViewPosition(vUv, depth);\n vec3 viewNormal = getAntiAliasedViewNormal(vUv);\n\n float radiusToUse = radius;\n float distanceFalloffToUse = thickness;\n #if SCREEN_SPACE_RADIUS == 1\n float radiusScale = getViewPosition(vec2(0.5 + float(SCREEN_SPACE_RADIUS_SCALE) / resolution.x, 0.0), depth).x;\n radiusToUse *= radiusScale;\n distanceFalloffToUse *= radiusScale;\n #endif\n\n #if SCENE_CLIP_BOX == 1\n vec3 worldPos = (cameraWorldMatrix * vec4(viewPos, 1.0)).xyz;\n float boxDistance = length(max(vec3(0.0), max(sceneBoxMin - worldPos, worldPos - sceneBoxMax)));\n if (boxDistance > radiusToUse) {\n discard;\n return;\n }\n #endif\n\n vec2 noiseResolution = vec2(textureSize(tNoise, 0));\n vec2 noiseUv = vUv * resolution / noiseResolution;\n vec4 noiseTexel = textureLod(tNoise, noiseUv, 0.0);\n vec3 randomVec = noiseTexel.xyz * 2.0 - 1.0;\n\n #if NV_ALIGNED_SAMPLES == 1\n vec3 tangent = normalize(randomVec - viewNormal * dot(randomVec, viewNormal));\n vec3 bitangent = cross(viewNormal, tangent);\n mat3 kernelMatrix = mat3(tangent, bitangent, viewNormal);\n #else\n vec3 tangent = normalize(vec3(randomVec.xy, 0.));\n vec3 bitangent = vec3(-tangent.y, tangent.x, 0.);\n mat3 kernelMatrix = mat3(tangent, bitangent, vec3(0., 0., 1.));\n #endif\n\n #if AO_ALGORITHM == 4\n const int DIRECTIONS = SAMPLES < 30 ? 3 : 5;\n const int STEPS = (SAMPLES + DIRECTIONS - 1) / DIRECTIONS;\n #elif AO_ALGORITHM == 3\n const int DIRECTIONS = SAMPLES < 16 ? 3 : 5;\n const int STEPS = (SAMPLES + DIRECTIONS - 1) / DIRECTIONS;\n #else\n const int DIRECTIONS = SAMPLES;\n const int STEPS = 1;\n #endif\n\n float ao = 0.0, totalWeight = 0.0;\n for (int i = 0; i < DIRECTIONS; ++i) {\n\n #if AO_ALGORITHM == 4\n float angle = float(i) / float(DIRECTIONS) * PI;\n vec4 sampleDir = vec4(cos(angle), sin(angle), 0., 0.5 + 0.5 * noiseTexel.w);\n #elif AO_ALGORITHM == 3\n float angle = float(i) / float(DIRECTIONS) * 2. * PI;\n vec4 sampleDir = vec4(cos(angle), sin(angle), 0., 0.5 + 0.5 * noiseTexel.w);\n #else\n vec4 sampleDir = sampleKernel[i];\n #endif\n sampleDir.xyz = normalize(kernelMatrix * sampleDir.xyz);\n\n vec3 viewDir = normalize(-viewPos.xyz);\n vec3 sliceBitangent = normalize(cross(sampleDir.xyz, viewDir));\n vec3 sliceTangent = cross(sliceBitangent, viewDir);\n vec3 normalInSlice = normalize(viewNormal - sliceBitangent * dot(viewNormal, sliceBitangent));\n\n #if (AO_ALGORITHM == 3 || AO_ALGORITHM == 4)\n vec3 tangentToNormalInSlice = cross(normalInSlice, sliceBitangent);\n #if AO_ALGORITHM == 4\n vec2 cosHorizons = vec2(dot(viewDir, tangentToNormalInSlice), dot(viewDir, -tangentToNormalInSlice));\n #else\n vec2 cosHorizons = vec2(dot(viewDir, tangentToNormalInSlice));\n #endif\n for (int j = 0; j < STEPS; ++j) {\n vec3 sampleViewOffset = sampleDir.xyz * radiusToUse * sampleDir.w * pow(float(j + 1) / float(STEPS), distanceExponent);\n vec3 sampleViewPos = viewPos + sampleViewOffset;\n #else\n vec3 sampleViewPos = viewPos + sampleDir.xyz * radiusToUse * pow(sampleDir.w, distanceExponent);\n #endif\n\n vec3 sampleSceneUvDepth = getSceneUvAndDepth(sampleViewPos);\n vec3 sampleSceneViewPos = getViewPosition(sampleSceneUvDepth.xy, sampleSceneUvDepth.z);\n float sceneSampleDist = abs(sampleSceneViewPos.z);\n float sampleDist = abs(sampleViewPos.z);\n\n #if (AO_ALGORITHM == 3 || AO_ALGORITHM == 4)\n // HBAO || GTAO\n vec3 viewDelta = sampleSceneViewPos - viewPos;\n if (abs(viewDelta.z) < thickness) {\n vec2 clipRangeCheck = step(0., sampleSceneUvDepth.xy) * step(sampleSceneUvDepth.xy, vec2(1.));\n float sampleCosHorizon = dot(viewDir, normalize(viewDelta));\n cosHorizons.x += max(0., (sampleCosHorizon - cosHorizons.x) * mix(1., 2. / float(j + 2), distanceFallOff) * clipRangeCheck.x * clipRangeCheck.y);\n }\n #if AO_ALGORITHM == 4\n sampleSceneUvDepth = getSceneUvAndDepth(viewPos - sampleViewOffset);\n sampleSceneViewPos = getViewPosition(sampleSceneUvDepth.xy, sampleSceneUvDepth.z);\n viewDelta = sampleSceneViewPos - viewPos;\n if (abs(viewDelta.z) < thickness) {\n vec2 clipRangeCheck = step(0., sampleSceneUvDepth.xy) * step(sampleSceneUvDepth.xy, vec2(1.));\n float sampleCosHorizon = dot(viewDir, normalize(viewDelta));\n cosHorizons.y += max(0., (sampleCosHorizon - cosHorizons.y) * mix(1., 2. / float(j + 2), distanceFallOff) * clipRangeCheck.x * clipRangeCheck.y);\n }\n #endif\n #elif AO_ALGORITHM == 2\n // N8AO\n float weight = dot(viewNormal, sampleDir.xyz);\n float occlusion = weight * step(sceneSampleDist + bias, sampleDist);\n #elif AO_ALGORITHM == 1\n // SAO\n vec3 viewDelta = sampleSceneViewPos - viewPos;\n float minResolution = 0.; // ?\n float scaledViewDist = length( viewDelta ) / scale;\n float weight = 1.;\n float occlusion = max(0., (dot(viewNormal, viewDelta) - minResolution) / scaledViewDist - bias) / (1. + scaledViewDist * scaledViewDist );\n #else\n // SSAO\n float weight = 1.;\n float occlusion = step(sceneSampleDist + bias, sampleDist);\n #endif\n\n #if AO_ALGORITHM == 4\n }\n // GTAO\n vec2 sinHorizons = sqrt(1. - cosHorizons * cosHorizons);\n float nx = dot(normalInSlice, sliceTangent);\n float ny = dot(normalInSlice, viewDir);\n float nxb = 1. / 2. * (acos(cosHorizons.y) - acos(cosHorizons.x) + sinHorizons.x * cosHorizons.x - sinHorizons.y * cosHorizons.y);\n float nyb = 1. / 2. * (2. - cosHorizons.x * cosHorizons.x - cosHorizons.y * cosHorizons.y);\n float occlusion = nx * nxb + ny * nyb;\n ao += occlusion;\n }\n ao = clamp(ao / float(DIRECTIONS), 0., 1.);\n #elif AO_ALGORITHM == 3\n }\n totalWeight += 1.;\n ao += max(0., cosHorizons.x - max(0., cosHorizons.y));\n }\n ao /= totalWeight + 1. - step(0., totalWeight);\n ao = clamp(1. - ao, 0., 1.);\n #else\n\n float fallOff = getFallOff(sceneSampleDist - sampleDist, distanceFalloffToUse);\n occlusion *= fallOff;\n vec2 diff = (vUv - sampleSceneUvDepth.xy) * resolution;\n occlusion *= step(1., dot(diff, diff));\n vec2 clipRangeCheck = step(0., sampleSceneUvDepth.xy) * step(sampleSceneUvDepth.xy, vec2(1.));\n occlusion *= clipRangeCheck.x * clipRangeCheck.y;\n weight *= clipRangeCheck.x * clipRangeCheck.y;\n totalWeight += weight;\n ao += occlusion;\n }\n ao /= totalWeight + 1. - step(0., totalWeight);\n ao = clamp(1. - ao, 0., 1.);\n #endif\n\n #if SCENE_CLIP_BOX == 1\n ao = mix(ao, 1., smoothstep(0., radiusToUse, boxDistance));\n #endif\n #if AO_ALGORITHM != 1\n ao = pow(ao, scale);\n #endif\n gl_FragColor = FRAGMENT_OUTPUT;\n }"
|
|
1035
|
-
}, We = {
|
|
1036
|
-
resolutionScale: 1,
|
|
1037
|
-
algorithm: X.SSAO,
|
|
1038
|
-
samples: 32,
|
|
1039
|
-
radius: .25,
|
|
1040
|
-
distanceExponent: 2,
|
|
1041
|
-
thickness: .5,
|
|
1042
|
-
distanceFallOff: .5,
|
|
1043
|
-
scale: 1,
|
|
1044
|
-
bias: .01,
|
|
1045
|
-
screenSpaceRadius: !1
|
|
1046
|
-
}, Ge = class {
|
|
1047
|
-
get texture() {
|
|
1048
|
-
return this._renderTarget ? this._renderTarget?.texture : null;
|
|
1049
|
-
}
|
|
1050
|
-
constructor(e, t, n, r, i) {
|
|
1051
|
-
this.needsUpdate = !0, this.parameters = { ...We }, this._width = 0, this._height = 0, this._samples = 0, this._gBufferAntiAliasing = !1, this._normalVectorSourceType = J.FLOAT_BUFFER_NORMAL, this._depthValueSourceType = Y.NORMAL_VECTOR_ALPHA, this._modulateRedChannel = !1, this.depthTexture = null, this.normalTexture = null, this._noiseTexture = null, this._renderTarget = null, this._passRenderer = new Re(), this._sceneClipBox = new E(new f(-1, -1, -1), new f(1, 1, 1)), this._sceneScale = 1, this._width = e, this._height = t, this._samples = n, this._gBufferAntiAliasing = r, this._normalVectorSourceType = i?.normalVectorSourceType || J.FLOAT_BUFFER_NORMAL, this._depthValueSourceType = i?.depthValueSourceType || Y.NORMAL_VECTOR_ALPHA, this._modulateRedChannel = i?.modulateRedChannel || !1, i?.aoParameters && (this.parameters = i.aoParameters), i && this.updateTextures(i);
|
|
1052
|
-
}
|
|
1053
|
-
_getNoiseTexture(e = 64) {
|
|
1054
|
-
if (!this._noiseTexture) {
|
|
1055
|
-
let t = new je(), n = new Uint8Array(e * e * 4);
|
|
1056
|
-
for (let r = 0; r < e; r++) for (let i = 0; i < e; i++) {
|
|
1057
|
-
let a = r, o = i;
|
|
1058
|
-
n[(r * e + i) * 4] = (t.noise(a, o) + 1) * 127.5, n[(r * e + i) * 4 + 1] = (t.noise(a + e, o) + 1) * 127.5, n[(r * e + i) * 4 + 2] = (t.noise(a, o + e) + 1) * 127.5, n[(r * e + i) * 4 + 3] = (t.noise(a + e, o + e) + 1) * 127.5;
|
|
1059
|
-
}
|
|
1060
|
-
this._noiseTexture = new h(n, e, e, o, P), this._noiseTexture.wrapS = l, this._noiseTexture.wrapT = l, this._noiseTexture.needsUpdate = !0;
|
|
1061
|
-
}
|
|
1062
|
-
return this._noiseTexture;
|
|
1063
|
-
}
|
|
1064
|
-
_getMaterial(e, t) {
|
|
1065
|
-
let n = t;
|
|
1066
|
-
return this._aoMaterial || (this._aoMaterial = this._newAoMaterial(), n = !0), n && (this._updateShader(this._aoMaterial, e), this._aoMaterial.needsUpdate = !0), this._updateUniforms(this._aoMaterial, e, n), this._aoMaterial;
|
|
1067
|
-
}
|
|
1068
|
-
_newAoMaterial() {
|
|
1069
|
-
let e = new m({
|
|
1070
|
-
defines: Object.assign({}, Ue.defines),
|
|
1071
|
-
uniforms: D.clone(Ue.uniforms),
|
|
1072
|
-
vertexShader: Ue.vertexShader,
|
|
1073
|
-
fragmentShader: Ue.fragmentShader,
|
|
1074
|
-
depthTest: !1,
|
|
1075
|
-
depthWrite: !1
|
|
1076
|
-
});
|
|
1077
|
-
return this._modulateRedChannel && (e.blending = 5, e.blendEquation = 103, e.blendEquationAlpha = null, e.blendSrc = 201, e.blendSrcAlpha = null, e.blendDst = 201, e.blendDstAlpha = null), e.defines.FRAGMENT_OUTPUT = this._modulateRedChannel ? "vec4(ao, 1., 1., 1.)" : void 0, e.uniforms.tNoise.value = Le(5), e;
|
|
1078
|
-
}
|
|
1079
|
-
_updateShader(e, t) {
|
|
1080
|
-
e.defines.PERSPECTIVE_CAMERA = t.isPerspectiveCamera ? 1 : 0, e.defines.SAMPLES = this.parameters.samples, e.defines.SAMPLE_VECTORS = Ve(this.parameters.samples, this.parameters.algorithm === X.SSAO), e.defines.NORMAL_VECTOR_TYPE = this._normalVectorSourceType === J.FLOAT_BUFFER_NORMAL ? 2 : 1, e.defines.DEPTH_SWIZZLING = this._depthValueSourceType === Y.NORMAL_VECTOR_ALPHA ? "a" : "x", e.defines.AO_ALGORITHM = this.parameters.algorithm, e.defines.NV_ALIGNED_SAMPLES = this.parameters.algorithm === X.HBAO || this.parameters.algorithm === X.GTAO ? 0 : 1, e.defines.SCREEN_SPACE_RADIUS = this.parameters.screenSpaceRadius ? 1 : 0, e.defines.SCENE_CLIP_BOX = 1, e.defines.NORMAL_VECTOR_ANTIALIAS = this._gBufferAntiAliasing ? 2 : 0, e.defines.DEPTH_BUFFER_ANTIALIAS = this._gBufferAntiAliasing ? 1 : 0;
|
|
1081
|
-
}
|
|
1082
|
-
_updateUniforms(e, t, n) {
|
|
1083
|
-
let r = this.parameters.screenSpaceRadius ? 1 : this._sceneScale, i = this._depthValueSourceType === Y.NORMAL_VECTOR_ALPHA ? this.normalTexture : this.depthTexture;
|
|
1084
|
-
e.uniforms.tNormal.value = this.normalTexture, e.uniforms.tDepth.value = i, e.uniforms.resolution.value.set(this._width, this._height), e.uniforms.cameraProjectionMatrix.value.copy(t.projectionMatrix), e.uniforms.cameraProjectionMatrixInverse.value.copy(t.projectionMatrixInverse), e.uniforms.cameraWorldMatrix.value.copy(t.matrixWorld);
|
|
1085
|
-
let a = t;
|
|
1086
|
-
e.uniforms.cameraNear.value = a.near, e.uniforms.cameraFar.value = a.far, n && (e.uniforms.radius.value = this.parameters.radius * r, e.uniforms.distanceExponent.value = this.parameters.distanceExponent, e.uniforms.thickness.value = this.parameters.thickness * r, e.uniforms.distanceFallOff.value = this.parameters.distanceFallOff, e.uniforms.scale.value = this.parameters.scale, this._sceneClipBox && (e.uniforms.sceneBoxMin.value.copy(this._sceneClipBox.min), e.uniforms.sceneBoxMax.value.copy(this._sceneClipBox.max)));
|
|
1087
|
-
}
|
|
1088
|
-
_getRenderTargets() {
|
|
1089
|
-
return this._renderTarget ||= new i(this._width, this._height, {
|
|
1090
|
-
samples: this._samples,
|
|
1091
|
-
magFilter: this._samples > 1 ? F : S,
|
|
1092
|
-
minFilter: this._samples > 1 ? F : S
|
|
1093
|
-
}), this._renderTarget;
|
|
1094
|
-
}
|
|
1095
|
-
dispose() {
|
|
1096
|
-
this._noiseTexture?.dispose(), this._aoMaterial?.dispose(), this._renderTarget?.dispose();
|
|
1097
|
-
}
|
|
1098
|
-
setSize(e, t) {
|
|
1099
|
-
this._width = e, this._height = t, this._renderTarget?.setSize(e, t), this.needsUpdate = !0;
|
|
1100
|
-
}
|
|
1101
|
-
updateBounds(e, t) {
|
|
1102
|
-
this._sceneClipBox = new E().copy(e), this._sceneScale = t ?? 1, this.needsUpdate = !0;
|
|
1103
|
-
}
|
|
1104
|
-
updateParameters(e) {
|
|
1105
|
-
for (let t in e) this.parameters.hasOwnProperty(t) && (this.parameters[t] = e[t], this.needsUpdate = !0);
|
|
1106
|
-
}
|
|
1107
|
-
updateTextures(e) {
|
|
1108
|
-
e.depthTexture && (this.depthTexture = e.depthTexture, this.needsUpdate = !0), e.normalTexture && (this.normalTexture = e.normalTexture, this.needsUpdate = !0);
|
|
1109
|
-
}
|
|
1110
|
-
clear(e, t) {
|
|
1111
|
-
this._passRenderer.clear(e, t || this._getRenderTargets(), 16777215, 1);
|
|
1112
|
-
}
|
|
1113
|
-
render(e, t, n, r) {
|
|
1114
|
-
let i = this._getMaterial(t, this.needsUpdate);
|
|
1115
|
-
this.needsUpdate = !1, this._passRenderer.renderScreenSpace(e, i, r || this._getRenderTargets());
|
|
1116
|
-
}
|
|
1117
|
-
}, Ke = {
|
|
67
|
+
}, H = {
|
|
1118
68
|
uniforms: {
|
|
1119
69
|
tDiffuse: { value: null },
|
|
1120
|
-
intensity: { value: new
|
|
70
|
+
intensity: { value: new O(1, 1) }
|
|
1121
71
|
},
|
|
1122
72
|
vertexShader: "\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",
|
|
1123
73
|
fragmentShader: "\n uniform sampler2D tDiffuse;\n uniform vec2 intensity;\n varying vec2 vUv;\n\n void main() {\n vec4 textureColor = texture2D(tDiffuse, vUv);\n vec2 aoAndShadow = vec2(1.0) - intensity + intensity * textureColor.rg;\n gl_FragColor = vec4(vec3(aoAndShadow.r * aoAndShadow.g), 1.0);\n }"
|
|
1124
|
-
},
|
|
74
|
+
}, Ue = class extends p {
|
|
1125
75
|
constructor(e) {
|
|
1126
76
|
super({
|
|
1127
|
-
uniforms:
|
|
1128
|
-
vertexShader:
|
|
1129
|
-
fragmentShader:
|
|
77
|
+
uniforms: S.clone(H.uniforms),
|
|
78
|
+
vertexShader: H.vertexShader,
|
|
79
|
+
fragmentShader: H.fragmentShader,
|
|
1130
80
|
transparent: !0,
|
|
1131
81
|
depthTest: !1,
|
|
1132
82
|
depthWrite: !1,
|
|
@@ -1136,30 +86,30 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1136
86
|
blendSrcAlpha: 206,
|
|
1137
87
|
blendDstAlpha: 200,
|
|
1138
88
|
blendEquationAlpha: 100
|
|
1139
|
-
}), this._intensity = new
|
|
89
|
+
}), this._intensity = new O(1, 1), this.uniforms.intensity.value = this._intensity, this.update(e);
|
|
1140
90
|
}
|
|
1141
91
|
update(e) {
|
|
1142
92
|
return e?.texture !== void 0 && (this.uniforms.tDiffuse.value = e.texture), e?.blending !== void 0 && (this.blending = e.blending), e?.aoIntensity !== void 0 && (this._intensity.x = e.aoIntensity), e?.shadowIntensity !== void 0 && (this._intensity.y = e.shadowIntensity), this;
|
|
1143
93
|
}
|
|
1144
|
-
},
|
|
1145
|
-
let i =
|
|
94
|
+
}, We = (e, t, n, r) => {
|
|
95
|
+
let i = Ge(e, t, n, r), a = "vec3[SAMPLES](";
|
|
1146
96
|
for (let t = 0; t < e; t++) {
|
|
1147
97
|
let n = i[t];
|
|
1148
98
|
a += `vec3(${n.x}, ${n.y}, ${n.z})${t < e - 1 ? "," : ")"}`;
|
|
1149
99
|
}
|
|
1150
100
|
return a;
|
|
1151
|
-
},
|
|
101
|
+
}, Ge = (e, t, n, r) => {
|
|
1152
102
|
let i = [];
|
|
1153
103
|
for (let a = 0; a < e; a++) {
|
|
1154
104
|
let o = 2 * Math.PI * t * a / e, s = (1 + (n - 1) * (a / (e - 1)) ** r) / n;
|
|
1155
|
-
i.push(new
|
|
105
|
+
i.push(new d(Math.cos(o), Math.sin(o), s));
|
|
1156
106
|
}
|
|
1157
107
|
return i;
|
|
1158
|
-
},
|
|
108
|
+
}, U = {
|
|
1159
109
|
name: "PoissonDenoiseShader",
|
|
1160
110
|
defines: {
|
|
1161
111
|
SAMPLES: 16,
|
|
1162
|
-
SAMPLE_VECTORS:
|
|
112
|
+
SAMPLE_VECTORS: We(16, 2.89, 4, 1.3),
|
|
1163
113
|
NV_ALIGNED_SAMPLES: 0,
|
|
1164
114
|
SAMPLE_DISTRIBUTION: 0,
|
|
1165
115
|
DEPTH_VALUE_SOURCE: 0,
|
|
@@ -1174,10 +124,10 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1174
124
|
tNormal: { value: null },
|
|
1175
125
|
tDepth: { value: null },
|
|
1176
126
|
tNoise: { value: null },
|
|
1177
|
-
resolution: { value: new
|
|
1178
|
-
cameraProjectionMatrix: { value: new
|
|
1179
|
-
cameraProjectionMatrixInverse: { value: new
|
|
1180
|
-
cameraWorldMatrix: { value: new
|
|
127
|
+
resolution: { value: new O() },
|
|
128
|
+
cameraProjectionMatrix: { value: new E() },
|
|
129
|
+
cameraProjectionMatrixInverse: { value: new E() },
|
|
130
|
+
cameraWorldMatrix: { value: new E() },
|
|
1181
131
|
lumaPhi: { value: 5 },
|
|
1182
132
|
depthPhi: { value: 1 },
|
|
1183
133
|
normalPhi: { value: 1 },
|
|
@@ -1185,12 +135,12 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1185
135
|
radiusExponent: { value: 1.3 },
|
|
1186
136
|
iteration: { value: 0 },
|
|
1187
137
|
noOfIterations: { value: 2 },
|
|
1188
|
-
sceneBoxMin: { value: new
|
|
1189
|
-
sceneBoxMax: { value: new
|
|
138
|
+
sceneBoxMin: { value: new d(-1, -1, -1) },
|
|
139
|
+
sceneBoxMax: { value: new d(1, 1, 1) }
|
|
1190
140
|
},
|
|
1191
141
|
vertexShader: "\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
1192
142
|
fragmentShader: "\nvarying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tDepth;\nuniform sampler2D tNoise;\nuniform vec2 resolution;\nuniform mat4 cameraProjectionMatrix;\nuniform mat4 cameraProjectionMatrixInverse;\nuniform mat4 cameraWorldMatrix;\nuniform float lumaPhi;\nuniform float depthPhi;\nuniform float normalPhi;\nuniform float radius;\nuniform float radiusExponent;\nuniform int iteration;\nuniform int noOfIterations;\n#if SCENE_CLIP_BOX == 1\n uniform vec3 sceneBoxMin;\n uniform vec3 sceneBoxMax;\n#endif\n\n#include <common>\n#include <packing>\n\n#if LUMINANCE_WEIGHTED == 1 \n\n#ifndef LUMINANCE_TYPE\n#define LUMINANCE_TYPE float\n#endif\n#ifndef SAMPLE_LUMINANCE\n#define SAMPLE_LUMINANCE dot(vec3(0.2125, 0.7154, 0.0721), a)\n#endif\n#define WEIGHT_TYPE LUMINANCE_TYPE\n\n#else\n#define WEIGHT_TYPE float\n#endif\n\n#ifndef FRAGMENT_OUTPUT\n#define FRAGMENT_OUTPUT vec4(vec3(denoised), 1.)\n#endif\n\nLUMINANCE_TYPE getLuminance(const in vec3 a) {\n return SAMPLE_LUMINANCE;\n}\n\nconst vec3 poissonDisk[SAMPLES] = SAMPLE_VECTORS;\n\nvec3 getViewPosition(const in vec2 screenPosition, const in float depth) {\n vec4 clipSpacePosition = vec4(vec3(screenPosition, depth) * 2.0 - 1.0, 1.0);\n vec4 viewSpacePosition = cameraProjectionMatrixInverse * clipSpacePosition;\n return viewSpacePosition.xyz / viewSpacePosition.w;\n}\n\nfloat getDepth(const vec2 uv) {\n#if DEPTH_VALUE_SOURCE == 1 \n return textureLod(tDepth, uv.xy, 0.0).a;\n#else\n return textureLod(tDepth, uv.xy, 0.0).r;\n#endif\n}\n\nfloat fetchDepth(const ivec2 uv) {\n#if DEPTH_VALUE_SOURCE == 1 \n return texelFetch(tDepth, uv.xy, 0).a;\n#else\n return texelFetch(tDepth, uv.xy, 0).r;\n#endif\n}\n\nvec3 computeNormalFromDepth(const vec2 uv) {\n vec2 size = vec2(textureSize(tDepth, 0));\n ivec2 p = ivec2(uv * size);\n float c0 = fetchDepth(p);\n float l2 = fetchDepth(p - ivec2(2, 0));\n float l1 = fetchDepth(p - ivec2(1, 0));\n float r1 = fetchDepth(p + ivec2(1, 0));\n float r2 = fetchDepth(p + ivec2(2, 0));\n float b2 = fetchDepth(p - ivec2(0, 2));\n float b1 = fetchDepth(p - ivec2(0, 1));\n float t1 = fetchDepth(p + ivec2(0, 1));\n float t2 = fetchDepth(p + ivec2(0, 2));\n float dl = abs((2.0 * l1 - l2) - c0);\n float dr = abs((2.0 * r1 - r2) - c0);\n float db = abs((2.0 * b1 - b2) - c0);\n float dt = abs((2.0 * t1 - t2) - c0);\n vec3 ce = getViewPosition(uv, c0).xyz;\n vec3 dpdx = (dl < dr) ? ce - getViewPosition((uv - vec2(1.0 / size.x, 0.0)), l1).xyz\n : -ce + getViewPosition((uv + vec2(1.0 / size.x, 0.0)), r1).xyz;\n vec3 dpdy = (db < dt) ? ce - getViewPosition((uv - vec2(0.0, 1.0 / size.y)), b1).xyz\n : -ce + getViewPosition((uv + vec2(0.0, 1.0 / size.y)), t1).xyz;\n return normalize(cross(dpdx, dpdy));\n}\n\nvec3 getViewNormal(const vec2 uv) {\n#if NORMAL_VECTOR_TYPE == 2\n return normalize(textureLod(tNormal, uv, 0.).rgb);\n#elif NORMAL_VECTOR_TYPE == 1\n return unpackRGBToNormal(textureLod(tNormal, uv, 0.).rgb);\n#else\n return computeNormalFromDepth(uv);\n#endif\n}\n\nvoid denoiseSample(in vec3 center, in vec3 viewNormal, in vec3 viewPos, in vec2 sampleUv, inout vec3 denoised, inout WEIGHT_TYPE totalWeight) {\n vec4 sampleTexel = textureLod(tDiffuse, sampleUv, 0.0);\n float sampleDepth = getDepth(sampleUv);\n vec3 sampleNormal = getViewNormal(sampleUv);\n vec3 neighborColor = sampleTexel.rgb;\n vec3 viewPosSample = getViewPosition(sampleUv, sampleDepth);\n \n float normalDiff = dot(viewNormal, sampleNormal);\n float normalSimilarity = pow(max(normalDiff, 0.), normalPhi);\n float depthDiff = abs(dot(normalize(viewPos - viewPosSample), viewNormal));\n float depthSimilarity = max(1. - depthDiff / depthPhi, 0.);\n #if LUMINANCE_WEIGHTED == 1 \n LUMINANCE_TYPE lumaDiff = abs(getLuminance(neighborColor) - getLuminance(center));\n LUMINANCE_TYPE lumaSimilarity = max(1. - lumaDiff / lumaPhi, 0.);\n LUMINANCE_TYPE w = lumaSimilarity * depthSimilarity * normalSimilarity;\n #else\n WEIGHT_TYPE w = depthSimilarity * normalSimilarity;\n #endif\n\n denoised += w * neighborColor;\n totalWeight += w;\n}\n\nvoid main() {\n float depth = fetchDepth(ivec2(vec2(textureSize(tDepth, 0)) * vUv.xy)); \n vec3 viewNormal = getViewNormal(vUv); \n if (depth == 1. || dot(viewNormal, viewNormal) == 0.) {\n discard;\n return;\n }\n vec4 texel = textureLod(tDiffuse, vUv, 0.0);\n vec3 center = texel.rgb;\n vec3 viewPos = getViewPosition(vUv, depth);\n\n #if SCENE_CLIP_BOX == 1\n vec3 worldPos = (cameraWorldMatrix * vec4(viewPos, 1.0)).xyz;\n float boxDistance = length(max(vec3(0.0), max(sceneBoxMin - worldPos, worldPos - sceneBoxMax)));\n if (boxDistance > radius * 2.) {\n discard;\n return;\n }\n #endif\n\n vec2 noiseResolution = vec2(textureSize(tNoise, 0));\n vec2 noiseUv = vUv * resolution / noiseResolution;\n vec4 noiseTexel = textureLod(tNoise, noiseUv, 0.0);\n vec2 noiseVec = vec2(sin(noiseTexel[iteration % 4] * 2. * PI), cos(noiseTexel[iteration % 4] * 2. * PI));\n #if SAMPLE_DISTRIBUTION == 1\n vec3 randomVec = normalize(vec3(noiseVec.xy, 0.));\n vec3 tangent = normalize(randomVec - viewNormal * dot(randomVec, viewNormal));\n vec3 bitangent = cross(viewNormal, tangent);\n mat3 kernelMatrix = mat3(tangent, bitangent, viewNormal);\n #else\n mat2 rotationMatrix = mat2(noiseVec.x, -noiseVec.y, noiseVec.x, noiseVec.y);\n #endif\n\n WEIGHT_TYPE totalWeight = WEIGHT_TYPE(1.);\n vec3 denoised = texel.rgb;\n for (int i = 0; i < SAMPLES; i++) {\n vec3 sampleDir = poissonDisk[i];\n #if SAMPLE_DISTRIBUTION == 1\n vec3 offsetViewPos = viewPos + normalize(kernelMatrix * vec3(sampleDir.xy, 0.)) * sampleDir.z * radius * radius;\n vec4 samplePointNDC = cameraProjectionMatrix * vec4(offsetViewPos, 1.0); \n vec2 sampleUv = (samplePointNDC.xy / samplePointNDC.w * 0.5 + 0.5);\n #else\n vec2 offset = rotationMatrix * sampleDir.xy * (1. + sampleDir.z * (radius - 1.));\n offset *= mix(vec2(1.0), sqrt(1.0 - viewNormal.xy * viewNormal.xy), float(iteration) / float(noOfIterations-1));\n offset *= max(1.0, 1.0 / length(offset));\n vec2 sampleUv = vUv + offset / resolution;\n #endif\n denoiseSample(center, viewNormal, viewPos, sampleUv, denoised, totalWeight);\n }\n\n denoised /= totalWeight + 1.0 - step(0.0, totalWeight);\n gl_FragColor = FRAGMENT_OUTPUT;\n}"
|
|
1193
|
-
},
|
|
143
|
+
}, Ke = {
|
|
1194
144
|
iterations: 2,
|
|
1195
145
|
samples: 16,
|
|
1196
146
|
rings: 2.89,
|
|
@@ -1200,7 +150,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1200
150
|
depthPhi: 2.5,
|
|
1201
151
|
normalPhi: .5,
|
|
1202
152
|
nvOrientatedSamples: !1
|
|
1203
|
-
},
|
|
153
|
+
}, qe = class {
|
|
1204
154
|
get texture() {
|
|
1205
155
|
return this.parameters.iterations > 0 && this._renderTargets.length > 0 ? this._renderTargets[this._outputRenderTargetIndex].texture : this._inputTexture;
|
|
1206
156
|
}
|
|
@@ -1208,50 +158,50 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1208
158
|
this._inputTexture = e;
|
|
1209
159
|
}
|
|
1210
160
|
constructor(e, t, n, r) {
|
|
1211
|
-
this.needsUpdate = !0, this.parameters = { ...
|
|
161
|
+
this.needsUpdate = !0, this.parameters = { ...Ke }, this._width = 0, this._height = 0, this._samples = 0, this._normalVectorSourceType = R.FLOAT_BUFFER_NORMAL, this._depthValueSourceType = L.NORMAL_VECTOR_ALPHA, this._inputTexture = null, this.depthTexture = null, this.normalTexture = null, this._noiseTexture = null, this._renderTargets = [], this._outputRenderTargetIndex = 0, this._passRenderer = new Ne(), this._rgInputTexture = !1, this._luminanceWeighted = !0, this._width = e, this._height = t, this._samples = n, this._normalVectorSourceType = r?.normalVectorSourceType || R.FLOAT_BUFFER_NORMAL, this._depthValueSourceType = r?.depthValueSourceType || L.NORMAL_VECTOR_ALPHA, this._inputTexture = r?.inputTexture || null, this.depthTexture = r?.depthTexture || null, this.normalTexture = r?.normalTexture || null, this._rgInputTexture = r?.rgInputTexture || !1, this._luminanceWeighted = r?.luminanceWeighted === !0, this._luminanceType = r?.luminanceType || "vec3", this._sampleLuminance = r?.sampleLuminance || "a", this._fragmentOutput = r?.fragmentOutput || "vec4(denoised.xyz, 1.)", r?.poissonDenoisePassParameters && (this.parameters = r.poissonDenoisePassParameters), r && this.updateTextures(r);
|
|
1212
162
|
}
|
|
1213
163
|
_getNoiseTexture(e = 64) {
|
|
1214
164
|
if (!this._noiseTexture) {
|
|
1215
|
-
let t = new
|
|
165
|
+
let t = new De(), n = new Uint8Array(e * e * 4);
|
|
1216
166
|
for (let r = 0; r < e; r++) for (let i = 0; i < e; i++) {
|
|
1217
167
|
let a = r, o = i;
|
|
1218
168
|
n[(r * e + i) * 4] = (t.noise(a, o) + 1) * 127.5, n[(r * e + i) * 4 + 1] = (t.noise(a + e, o) + 1) * 127.5, n[(r * e + i) * 4 + 2] = (t.noise(a, o + e) + 1) * 127.5, n[(r * e + i) * 4 + 3] = (t.noise(a + e, o + e) + 1) * 127.5;
|
|
1219
169
|
}
|
|
1220
|
-
this._noiseTexture = new
|
|
170
|
+
this._noiseTexture = new m(n, e, e, o, w), this._noiseTexture.wrapS = c, this._noiseTexture.wrapT = c, this._noiseTexture.needsUpdate = !0;
|
|
1221
171
|
}
|
|
1222
172
|
return this._noiseTexture;
|
|
1223
173
|
}
|
|
1224
174
|
_getMaterial(e, t) {
|
|
1225
175
|
let n = t;
|
|
1226
|
-
return this._pdMaterial || (this._pdMaterial = new
|
|
1227
|
-
defines: Object.assign({},
|
|
1228
|
-
uniforms:
|
|
1229
|
-
vertexShader:
|
|
1230
|
-
fragmentShader:
|
|
176
|
+
return this._pdMaterial || (this._pdMaterial = new p({
|
|
177
|
+
defines: Object.assign({}, U.defines),
|
|
178
|
+
uniforms: S.clone(U.uniforms),
|
|
179
|
+
vertexShader: U.vertexShader,
|
|
180
|
+
fragmentShader: U.fragmentShader,
|
|
1231
181
|
depthTest: !1,
|
|
1232
182
|
depthWrite: !1
|
|
1233
183
|
}), this._pdMaterial.uniforms.tNoise.value = this._getNoiseTexture(), n = !0), n && this._updateShader(this._pdMaterial), this._updateUniforms(this._pdMaterial, e, n), this._pdMaterial;
|
|
1234
184
|
}
|
|
1235
185
|
_updateShader(e) {
|
|
1236
|
-
e.defines.SAMPLES = this.parameters.samples, e.defines.SAMPLE_VECTORS =
|
|
186
|
+
e.defines.SAMPLES = this.parameters.samples, e.defines.SAMPLE_VECTORS = We(this.parameters.samples, this.parameters.rings, this.parameters.radius, this.parameters.radiusExponent), e.defines.SAMPLE_DISTRIBUTION = this.parameters.nvOrientatedSamples ? 1 : 0, e.defines.NORMAL_VECTOR_TYPE = this._normalVectorSourceType === R.FLOAT_BUFFER_NORMAL ? 2 : 1, e.defines.DEPTH_VALUE_SOURCE = this._depthValueSourceType === L.NORMAL_VECTOR_ALPHA ? 1 : 0, e.needsUpdate = !0, e.defines.LUMINANCE_WEIGHTED = this._luminanceWeighted ? 1 : 0, e.defines.LUMINANCE_TYPE = this._luminanceType, e.defines.SAMPLE_LUMINANCE = this._sampleLuminance, e.defines.FRAGMENT_OUTPUT = this._fragmentOutput, e.defines.SCENE_CLIP_BOX = this._sceneClipBox ? 1 : 0, e.needsUpdate = !0;
|
|
1237
187
|
}
|
|
1238
188
|
_updateUniforms(e, t, n) {
|
|
1239
|
-
let r = this._depthValueSourceType ===
|
|
189
|
+
let r = this._depthValueSourceType === L.NORMAL_VECTOR_ALPHA ? this.normalTexture : this.depthTexture;
|
|
1240
190
|
e.uniforms.tDiffuse.value = this._inputTexture, e.uniforms.tNormal.value = this.normalTexture, e.uniforms.tDepth.value = r, e.uniforms.resolution.value.set(this._width, this._height), t.projectionMatrix && e.uniforms.cameraProjectionMatrix.value.copy(t.projectionMatrix), t.projectionMatrixInverse && e.uniforms.cameraProjectionMatrixInverse.value.copy(t.projectionMatrixInverse), t.matrixWorld && e.uniforms.cameraWorldMatrix.value.copy(t.matrixWorld), n && (e.uniforms.lumaPhi.value = this.parameters.lumaPhi, e.uniforms.depthPhi.value = this.parameters.depthPhi, e.uniforms.normalPhi.value = this.parameters.normalPhi, e.uniforms.radius.value = this.parameters.radius, e.uniforms.radiusExponent.value = this.parameters.radiusExponent, this._sceneClipBox && (e.uniforms.sceneBoxMin.value.copy(this._sceneClipBox.min), e.uniforms.sceneBoxMax.value.copy(this._sceneClipBox.max)));
|
|
1241
191
|
}
|
|
1242
192
|
_getRenderTargets() {
|
|
1243
193
|
return this._renderTargets.length < 2 && (this._renderTargets = [new i(this._width, this._height, {
|
|
1244
194
|
samples: this._samples,
|
|
1245
195
|
format: o,
|
|
1246
|
-
type:
|
|
1247
|
-
magFilter:
|
|
1248
|
-
minFilter:
|
|
196
|
+
type: le,
|
|
197
|
+
magFilter: y,
|
|
198
|
+
minFilter: y
|
|
1249
199
|
}), new i(this._width, this._height, {
|
|
1250
200
|
samples: this._samples,
|
|
1251
201
|
format: o,
|
|
1252
|
-
type:
|
|
1253
|
-
magFilter:
|
|
1254
|
-
minFilter:
|
|
202
|
+
type: le,
|
|
203
|
+
magFilter: y,
|
|
204
|
+
minFilter: y
|
|
1255
205
|
})]), this._renderTargets;
|
|
1256
206
|
}
|
|
1257
207
|
dispose() {
|
|
@@ -1261,7 +211,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1261
211
|
this._width = e, this._height = t, this._renderTargets.forEach((n) => n.setSize(e, t)), this.needsUpdate = !0;
|
|
1262
212
|
}
|
|
1263
213
|
updateBounds(e) {
|
|
1264
|
-
this._sceneClipBox = new
|
|
214
|
+
this._sceneClipBox = new re().copy(e), this.needsUpdate = !0;
|
|
1265
215
|
}
|
|
1266
216
|
updateParameters(e) {
|
|
1267
217
|
for (let t in e) this.parameters.hasOwnProperty(t) && (this.parameters[t] = e[t], this.needsUpdate = !0);
|
|
@@ -1285,12 +235,12 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1285
235
|
let r = this._getMaterial(t, this.needsUpdate);
|
|
1286
236
|
this.needsUpdate = !1, this._passRenderer.renderScreenSpace(e, r, n, 16777215, 1);
|
|
1287
237
|
}
|
|
1288
|
-
},
|
|
238
|
+
}, W = {
|
|
1289
239
|
OFF: "off",
|
|
1290
240
|
HARD: "hard",
|
|
1291
241
|
POISSON: "poisson",
|
|
1292
242
|
FULL: "full"
|
|
1293
|
-
},
|
|
243
|
+
}, Je = { shadowRadius: .05 }, G = {
|
|
1294
244
|
enabled: !0,
|
|
1295
245
|
applyToMaterial: !0,
|
|
1296
246
|
aoIntensity: .5,
|
|
@@ -1299,9 +249,9 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1299
249
|
shadowOnGround: !1,
|
|
1300
250
|
alwaysUpdate: !1,
|
|
1301
251
|
progressiveDenoiseIterations: 0
|
|
1302
|
-
},
|
|
252
|
+
}, K = class extends V {
|
|
1303
253
|
static {
|
|
1304
|
-
this.shadowTransform = new
|
|
254
|
+
this.shadowTransform = new E().set(0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1);
|
|
1305
255
|
}
|
|
1306
256
|
get aoAndSoftShadowRenderTarget() {
|
|
1307
257
|
return this._aoAndSoftShadowRenderTarget = this._aoAndSoftShadowRenderTarget ?? new i(this._width, this._height, {
|
|
@@ -1312,20 +262,20 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1312
262
|
}), this._aoAndSoftShadowRenderTarget;
|
|
1313
263
|
}
|
|
1314
264
|
get aoRenderPass() {
|
|
1315
|
-
return this._aoPass ||= new
|
|
1316
|
-
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
1317
|
-
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
265
|
+
return this._aoPass ||= new Me(this._width, this._height, this._samples, !this.parameters.applyToMaterial, {
|
|
266
|
+
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? R.FLOAT_BUFFER_NORMAL : R.INPUT_RGB_NORMAL,
|
|
267
|
+
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? L.NORMAL_VECTOR_ALPHA : L.SEPARATE_BUFFER,
|
|
1318
268
|
modulateRedChannel: !0,
|
|
1319
269
|
aoParameters: this.parameters.ao
|
|
1320
270
|
}), this._aoPass;
|
|
1321
271
|
}
|
|
1322
272
|
get softShadowPass() {
|
|
1323
|
-
if (!this._softShadowPass) this._softShadowPass = new
|
|
273
|
+
if (!this._softShadowPass) this._softShadowPass = new qe(this._width, this._height, this._samples, {
|
|
1324
274
|
inputTexture: void 0,
|
|
1325
275
|
depthTexture: this.gBufferTextures.depthBufferTexture,
|
|
1326
276
|
normalTexture: this.gBufferTextures.gBufferTexture,
|
|
1327
|
-
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
1328
|
-
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
277
|
+
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? R.FLOAT_BUFFER_NORMAL : R.INPUT_RGB_NORMAL,
|
|
278
|
+
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? L.NORMAL_VECTOR_ALPHA : L.SEPARATE_BUFFER,
|
|
1329
279
|
rgInputTexture: !0,
|
|
1330
280
|
luminanceWeighted: !1,
|
|
1331
281
|
fragmentOutput: "vec4(1.0, denoised.x, 0.0, 1.0)",
|
|
@@ -1356,12 +306,12 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1356
306
|
}), this._fadeRenderTarget;
|
|
1357
307
|
}
|
|
1358
308
|
get denoisePass() {
|
|
1359
|
-
if (!this._poissonDenoisePass) this._poissonDenoisePass = new
|
|
309
|
+
if (!this._poissonDenoisePass) this._poissonDenoisePass = new qe(this._width, this._height, this._samples, {
|
|
1360
310
|
inputTexture: this.aoAndSoftShadowRenderTarget.texture,
|
|
1361
311
|
depthTexture: this.gBufferTextures.depthBufferTexture,
|
|
1362
312
|
normalTexture: this.gBufferTextures.gBufferTexture,
|
|
1363
|
-
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
1364
|
-
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
313
|
+
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? R.FLOAT_BUFFER_NORMAL : R.INPUT_RGB_NORMAL,
|
|
314
|
+
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? L.NORMAL_VECTOR_ALPHA : L.SEPARATE_BUFFER,
|
|
1365
315
|
rgInputTexture: !0,
|
|
1366
316
|
luminanceWeighted: !1,
|
|
1367
317
|
fragmentOutput: "vec4(denoised.xy, vec2(fract(depth * 1024.0), floor(depth * 1024.0)))",
|
|
@@ -1382,23 +332,23 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1382
332
|
constructor(e, t, n, r, i) {
|
|
1383
333
|
super(e), this.needsUpdate = !0, this.renderToRenderTarget = !1, this.shadowAndAoPassSettings = {
|
|
1384
334
|
shadowMapTexture: null,
|
|
1385
|
-
shadowBlurType:
|
|
1386
|
-
shadowFadeInBlurType:
|
|
335
|
+
shadowBlurType: W.FULL,
|
|
336
|
+
shadowFadeInBlurType: W.FULL,
|
|
1387
337
|
shadowFadeInMix: 0,
|
|
1388
338
|
noOStaticFrames: 0
|
|
1389
|
-
}, this._cameraUpdate = new
|
|
1390
|
-
enabled: i?.enabled ??
|
|
1391
|
-
applyToMaterial: i?.applyToMaterial ??
|
|
1392
|
-
aoIntensity: i?.aoIntensity ??
|
|
1393
|
-
shadowIntensity: i?.shadowIntensity ??
|
|
1394
|
-
aoOnGround: i?.aoOnGround ??
|
|
1395
|
-
shadowOnGround: i?.shadowOnGround ??
|
|
1396
|
-
alwaysUpdate: i?.alwaysUpdate ??
|
|
1397
|
-
progressiveDenoiseIterations: i?.progressiveDenoiseIterations ??
|
|
1398
|
-
shadow: {
|
|
1399
|
-
ao: { ...
|
|
1400
|
-
poissonDenoise: { ...
|
|
1401
|
-
}, this._copyMaterial = new
|
|
339
|
+
}, this._cameraUpdate = new F(), this._finalTexture = null, this._onlyHardShadow = !1, this._width = t, this._height = n, this._samples = r, this.parameters = {
|
|
340
|
+
enabled: i?.enabled ?? G.enabled,
|
|
341
|
+
applyToMaterial: i?.applyToMaterial ?? G.applyToMaterial,
|
|
342
|
+
aoIntensity: i?.aoIntensity ?? G.aoIntensity,
|
|
343
|
+
shadowIntensity: i?.shadowIntensity ?? G.shadowIntensity,
|
|
344
|
+
aoOnGround: i?.aoOnGround ?? G.aoOnGround,
|
|
345
|
+
shadowOnGround: i?.shadowOnGround ?? G.shadowOnGround,
|
|
346
|
+
alwaysUpdate: i?.alwaysUpdate ?? G.alwaysUpdate,
|
|
347
|
+
progressiveDenoiseIterations: i?.progressiveDenoiseIterations ?? G.progressiveDenoiseIterations,
|
|
348
|
+
shadow: { ...Je },
|
|
349
|
+
ao: { ...Fe },
|
|
350
|
+
poissonDenoise: { ...Ke }
|
|
351
|
+
}, this._copyMaterial = new M(), this._blendMaterial = new M({}, Le.DEFAULT), this._blendAoAndShadowMaterial = new Ue();
|
|
1402
352
|
}
|
|
1403
353
|
dispose() {
|
|
1404
354
|
super.dispose(), this._aoAndSoftShadowRenderTarget?.dispose(), this._softShadowPass?.dispose(), this._aoPass?.dispose(), this._fadeRenderTarget?.dispose(), this._poissonDenoisePass?.dispose(), this._copyMaterial?.dispose(), this._blendMaterial?.dispose(), this._blendAoAndShadowMaterial?.dispose();
|
|
@@ -1424,19 +374,19 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1424
374
|
updateBounds(e, t) {
|
|
1425
375
|
this._softShadowPass?.updateBounds(e.bounds), this._aoPass?.updateBounds(e.bounds, t);
|
|
1426
376
|
}
|
|
1427
|
-
_getRenderConditions(e =
|
|
1428
|
-
let r = e ===
|
|
377
|
+
_getRenderConditions(e = W.FULL, t = 0, n = 0) {
|
|
378
|
+
let r = e === W.POISSON && t > .001, i = e === W.HARD && t > .001 && t < .999;
|
|
1429
379
|
return {
|
|
1430
380
|
fadeInPoissonShadow: r,
|
|
1431
381
|
fadeInHardShadow: i,
|
|
1432
|
-
onlyHardShadow: e ===
|
|
382
|
+
onlyHardShadow: e === W.HARD && !i,
|
|
1433
383
|
progressiveDenoise: !r && !i && n > 1 && n <= this.parameters.progressiveDenoiseIterations + 1
|
|
1434
384
|
};
|
|
1435
385
|
}
|
|
1436
386
|
renderPass(e) {
|
|
1437
387
|
if (!this._setRenderState()) return;
|
|
1438
388
|
let t = this._getRenderConditions(this.shadowAndAoPassSettings.shadowFadeInBlurType, this.shadowAndAoPassSettings.shadowFadeInMix, this.shadowAndAoPassSettings.noOStaticFrames), n = !1;
|
|
1439
|
-
!t.onlyHardShadow && this.shadowAndAoPassSettings.shadowBlurType ===
|
|
389
|
+
!t.onlyHardShadow && this.shadowAndAoPassSettings.shadowBlurType === W.FULL && this._evaluateIfUpdateIsNeeded(this.camera) && (this._renderShadowAndAo(e, this.scene, this.camera, this.shadowAndAoPassSettings.shadowMapTexture), n = !0);
|
|
1440
390
|
let r = t.onlyHardShadow ? this.shadowAndAoPassSettings.shadowMapTexture : this.denoiseRenderTargetTexture;
|
|
1441
391
|
t.fadeInPoissonShadow && (r = this._renderDynamicShadow(e, this.aoAndSoftShadowRenderTarget.texture, this.shadowAndAoPassSettings.shadowMapTexture, this.shadowAndAoPassSettings.shadowFadeInMix), n = !0), n ? r = this._renderDenoise(e, this.camera, t.fadeInPoissonShadow, !1) : t.progressiveDenoise && (r = this._renderDenoise(e, this.camera, !1, !0)), t.fadeInHardShadow && (r = this._renderDynamicShadow(e, this.denoiseRenderTargetTexture, this.shadowAndAoPassSettings.shadowMapTexture, this.shadowAndAoPassSettings.shadowFadeInMix)), this._finalTexture = r, this._onlyHardShadow = t.onlyHardShadow, this.renderToRenderTarget && this.renderToTarget(e);
|
|
1442
392
|
}
|
|
@@ -1467,13 +417,13 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1467
417
|
return i && (this._copyMaterial.update({
|
|
1468
418
|
texture: t,
|
|
1469
419
|
blending: 0,
|
|
1470
|
-
colorTransform:
|
|
1471
|
-
colorBase:
|
|
420
|
+
colorTransform: j,
|
|
421
|
+
colorBase: A,
|
|
1472
422
|
multiplyChannels: 0
|
|
1473
423
|
}), this.passRenderer.renderScreenSpace(e, this._copyMaterial, this.fadeRenderTarget)), r > .001 && (this._blendMaterial.update({
|
|
1474
424
|
texture: n,
|
|
1475
425
|
blending: i ? 5 : 0,
|
|
1476
|
-
colorTransform: new
|
|
426
|
+
colorTransform: new E().set(0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, i ? r : 1),
|
|
1477
427
|
multiplyChannels: 0
|
|
1478
428
|
}), this.passRenderer.renderScreenSpace(e, this._blendMaterial, this.fadeRenderTarget)), this.fadeRenderTarget.texture;
|
|
1479
429
|
}
|
|
@@ -1490,7 +440,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1490
440
|
shadowIntensity: n
|
|
1491
441
|
}), e.getRenderTarget());
|
|
1492
442
|
}
|
|
1493
|
-
},
|
|
443
|
+
}, Ye = class {
|
|
1494
444
|
get isOutlinePassActivated() {
|
|
1495
445
|
return this.outlinePassActivated;
|
|
1496
446
|
}
|
|
@@ -1530,57 +480,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1530
480
|
updateOutline(e, t, n) {
|
|
1531
481
|
n.length > 0 ? (this._parameterNeedsUpdate && this.applyParameters(), this.activateOutline(e, t), this.outlinePass && (this.outlinePass.selectedObjects = n)) : this.deactivateOutline();
|
|
1532
482
|
}
|
|
1533
|
-
},
|
|
1534
|
-
DEFAULT: "default",
|
|
1535
|
-
BRIGHT: "bright"
|
|
1536
|
-
}, rt = {
|
|
1537
|
-
shadowType: "PCFShadowMap",
|
|
1538
|
-
shAndAoPassParameters: {
|
|
1539
|
-
aoIntensity: .3,
|
|
1540
|
-
shadow: { shadowRadius: .1 },
|
|
1541
|
-
ao: {
|
|
1542
|
-
algorithm: X.SSAO,
|
|
1543
|
-
samples: 32,
|
|
1544
|
-
radius: .02,
|
|
1545
|
-
distanceExponent: 2,
|
|
1546
|
-
thickness: .1,
|
|
1547
|
-
distanceFallOff: 1,
|
|
1548
|
-
bias: .01
|
|
1549
|
-
},
|
|
1550
|
-
poissonDenoise: {
|
|
1551
|
-
iterations: 2,
|
|
1552
|
-
samples: 16,
|
|
1553
|
-
rings: 2.89,
|
|
1554
|
-
radius: 4,
|
|
1555
|
-
radiusExponent: 1.3,
|
|
1556
|
-
depthPhi: 2.5,
|
|
1557
|
-
normalPhi: .5
|
|
1558
|
-
}
|
|
1559
|
-
},
|
|
1560
|
-
groundReflectionParameters: { brightness: .5 }
|
|
1561
|
-
}, it = (...e) => {
|
|
1562
|
-
if (e.length === 0) return null;
|
|
1563
|
-
if (e.length === 1) return e[0];
|
|
1564
|
-
let t = e[0];
|
|
1565
|
-
for (let n = 1; n < e.length; n++) t = _e(t, e[n]);
|
|
1566
|
-
return t;
|
|
1567
|
-
}, at = (e) => e ? { groundReflectionParameters: { enabled: !1 } } : null, ot = (e) => !e || e === nt.DEFAULT ? null : e === nt.BRIGHT ? rt : null, $ = (e) => Math.max(0, Math.min(1, e)), st = (e) => {
|
|
1568
|
-
let t = {
|
|
1569
|
-
shAndAoPassParameters: {
|
|
1570
|
-
ao: {},
|
|
1571
|
-
shadow: {}
|
|
1572
|
-
},
|
|
1573
|
-
groundReflectionParameters: {},
|
|
1574
|
-
bakedGroundContactShadowParameters: {}
|
|
1575
|
-
};
|
|
1576
|
-
return ct(t, e), lt(t, e), ut(t, e), t;
|
|
1577
|
-
}, ct = (e, t) => {
|
|
1578
|
-
t.aoIntensity !== void 0 && (e.shAndAoPassParameters.aoIntensity = $(t.aoIntensity)), t.aoExtent !== void 0 && (e.shAndAoPassParameters.ao.radius = $(t.aoExtent) * .3, e.shAndAoPassParameters.ao.thickness = .1 + $(t.aoExtent) * .2);
|
|
1579
|
-
}, lt = (e, t) => {
|
|
1580
|
-
t.shBakedOnGround ? (e.bakedGroundContactShadowParameters.enabled = !0, e.shAndAoPassParameters.shadowIntensity = 0, t.shadowIntensity !== void 0 && (e.bakedGroundContactShadowParameters.opacity = $(t.shadowIntensity)), t.shadowIntensity !== void 0 && (e.bakedGroundContactShadowParameters.blurMax = $(t.shadowIntensity) * .1, e.bakedGroundContactShadowParameters.blurMin = e.bakedGroundContactShadowParameters.blurMax * .01)) : (t.shBakedOnGround !== void 0 && (e.bakedGroundContactShadowParameters.enabled = !1), t.shadowIntensity !== void 0 && (e.shAndAoPassParameters.shadowIntensity = $(t.shadowIntensity)), t.shadowSoftening !== void 0 && (e.shAndAoPassParameters.shadow.shadowRadius = .001 + $(t.shadowSoftening) * .2));
|
|
1581
|
-
}, ut = (e, t) => {
|
|
1582
|
-
t.grReflectIntensity !== void 0 && (e.groundReflectionParameters.enabled = t.grReflectIntensity > 0, e.groundReflectionParameters.intensity = $(t.grReflectIntensity)), t.grReflectFadeOut !== void 0 && (e.groundReflectionParameters.fadeOutDistance = (1 - $(t.grReflectFadeOut)) * 4);
|
|
1583
|
-
}, dt = (e, t) => Array.isArray(e) ? e.some((e) => dt(e, t)) : e.transparent && e.opacity < t || e.alphaTest > 0, ft = (e) => Array.isArray(e) ? e.some((e) => ft(e)) : e instanceof ee && e.transmission > 0, pt = class {
|
|
483
|
+
}, q = (e, t) => Array.isArray(e) ? e.some((e) => q(e, t)) : e.transparent && e.opacity < t || e.alphaTest > 0, J = (e) => Array.isArray(e) ? e.some((e) => J(e)) : e instanceof ae && e.transmission > 0, Xe = class {
|
|
1584
484
|
constructor(e) {
|
|
1585
485
|
this.needsUpdate = !0, this._cache = null, this._cache = e;
|
|
1586
486
|
}
|
|
@@ -1601,7 +501,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1601
501
|
onAfterRender() {
|
|
1602
502
|
this._cache?.onAfterRender();
|
|
1603
503
|
}
|
|
1604
|
-
},
|
|
504
|
+
}, Ze = class {
|
|
1605
505
|
constructor() {
|
|
1606
506
|
this._cacheMap = /* @__PURE__ */ new Map();
|
|
1607
507
|
}
|
|
@@ -1611,7 +511,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1611
511
|
});
|
|
1612
512
|
}
|
|
1613
513
|
registerCache(e, t) {
|
|
1614
|
-
this._cacheMap.set(e, new
|
|
514
|
+
this._cacheMap.set(e, new Xe(t));
|
|
1615
515
|
}
|
|
1616
516
|
clearCache() {
|
|
1617
517
|
this._cacheMap.forEach((e) => {
|
|
@@ -1634,7 +534,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1634
534
|
let r = this._cacheMap.get(e);
|
|
1635
535
|
r && (r.update(t), r.onBeforeRender()), n(), r && r.onAfterRender();
|
|
1636
536
|
}
|
|
1637
|
-
},
|
|
537
|
+
}, Y = class {
|
|
1638
538
|
constructor(e) {
|
|
1639
539
|
this._visibilityCache = /* @__PURE__ */ new Map(), this._isObjectInvisible = e;
|
|
1640
540
|
}
|
|
@@ -1663,7 +563,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1663
563
|
t.visible = e;
|
|
1664
564
|
});
|
|
1665
565
|
}
|
|
1666
|
-
},
|
|
566
|
+
}, Qe = class {
|
|
1667
567
|
constructor(e) {
|
|
1668
568
|
this._depthWriteCache = /* @__PURE__ */ new Set(), this._doNotWriteDepth = e;
|
|
1669
569
|
}
|
|
@@ -1676,7 +576,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1676
576
|
addLineOrPoint(e) {}
|
|
1677
577
|
addObject(e) {}
|
|
1678
578
|
addMesh(e) {
|
|
1679
|
-
this._doNotWriteDepth && this._doNotWriteDepth(e) && e.material instanceof
|
|
579
|
+
this._doNotWriteDepth && this._doNotWriteDepth(e) && e.material instanceof v && e.material.depthWrite && this._depthWriteCache.add(e.material);
|
|
1680
580
|
}
|
|
1681
581
|
onBeforeRender() {
|
|
1682
582
|
this._depthWriteCache.forEach((e) => {
|
|
@@ -1688,7 +588,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1688
588
|
e.depthWrite = !0;
|
|
1689
589
|
});
|
|
1690
590
|
}
|
|
1691
|
-
},
|
|
591
|
+
}, $e = class {
|
|
1692
592
|
constructor() {
|
|
1693
593
|
this._objectCache = /* @__PURE__ */ new Map();
|
|
1694
594
|
}
|
|
@@ -1697,7 +597,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1697
597
|
}
|
|
1698
598
|
onBeforeRender() {
|
|
1699
599
|
this._objectCache.forEach((e, t) => {
|
|
1700
|
-
t instanceof
|
|
600
|
+
t instanceof b && (t.material !== e.originalObjectData.material && t.material !== e.updateObjectData.material && (e.originalObjectData.material = t.material), t.receiveShadow !== e.originalObjectData.receiveShadow && (e.originalObjectData.receiveShadow = t.receiveShadow), t.castShadow !== e.originalObjectData.castShadow && (e.originalObjectData.castShadow = t.castShadow), t.visible !== e.originalObjectData.visible && (e.originalObjectData.visible = t.visible)), this._updateObject(t, e.updateObjectData);
|
|
1701
601
|
});
|
|
1702
602
|
}
|
|
1703
603
|
onAfterRender() {
|
|
@@ -1710,35 +610,35 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1710
610
|
originalObjectData: {
|
|
1711
611
|
visible: e.visible,
|
|
1712
612
|
castShadow: e.castShadow,
|
|
1713
|
-
receiveShadow: e instanceof
|
|
1714
|
-
material: e instanceof
|
|
613
|
+
receiveShadow: e instanceof b ? e.receiveShadow : void 0,
|
|
614
|
+
material: e instanceof b ? e.material : void 0
|
|
1715
615
|
},
|
|
1716
616
|
updateObjectData: t
|
|
1717
617
|
});
|
|
1718
618
|
}
|
|
1719
619
|
_updateObject(e, t) {
|
|
1720
|
-
t.visible !== void 0 && (e.visible = t.visible), t.castShadow !== void 0 && (e.castShadow = t.castShadow), e instanceof
|
|
620
|
+
t.visible !== void 0 && (e.visible = t.visible), t.castShadow !== void 0 && (e.castShadow = t.castShadow), e instanceof b && t.receiveShadow !== void 0 && (e.receiveShadow = t.receiveShadow), e instanceof b && t.material !== void 0 && (e.material = t.material);
|
|
1721
621
|
}
|
|
1722
|
-
},
|
|
622
|
+
}, et = (e) => {
|
|
1723
623
|
if (!e.isMesh || !e.castShadow && !e.userData?.meshId) return !1;
|
|
1724
624
|
let t = e.material;
|
|
1725
625
|
return !t.transparent || t.opacity > .5;
|
|
1726
|
-
},
|
|
626
|
+
}, tt = class extends V {
|
|
1727
627
|
static {
|
|
1728
628
|
this.addTestMesh = !1;
|
|
1729
629
|
}
|
|
1730
630
|
get shadowGroundPlane() {
|
|
1731
631
|
let e = this._sharedShadowGroundPlane;
|
|
1732
|
-
return e ||= (this._shadowGroundPlane ??= new
|
|
632
|
+
return e ||= (this._shadowGroundPlane ??= new He(this.renderTarget.texture, this.parameters), this._shadowGroundPlane), e.parent !== this._groundGroup && this._groundGroup.add(e), e;
|
|
1733
633
|
}
|
|
1734
634
|
constructor(e, t, n, r) {
|
|
1735
|
-
super(e), this.limitPlaneSize = !0, this.needsUpdate = !0, this.noNeedOfUpdateCount = 0, this._blurScale = 1, this._shadowScale = 1, this._groundGroup = n, this.shadowMapSize = r.shadowMapSize ?? 2048, this.parameters = this._getDefaultParameters(r), this._groundShadowFar = this.parameters.cameraFar, this._renderer = t, this.renderCacheManager?.registerCache(this, new
|
|
635
|
+
super(e), this.limitPlaneSize = !0, this.needsUpdate = !0, this.noNeedOfUpdateCount = 0, this._blurScale = 1, this._shadowScale = 1, this._groundGroup = n, this.shadowMapSize = r.shadowMapSize ?? 2048, this.parameters = this._getDefaultParameters(r), this._groundShadowFar = this.parameters.cameraFar, this._renderer = t, this.renderCacheManager?.registerCache(this, new Y((e) => e.isMesh && !et(e) || e.name !== void 0 && ["Ground", "Floor"].includes(e.name))), this.renderTarget = new i(this.shadowMapSize, this.shadowMapSize), this.renderTarget.texture.generateMipmaps = !1, this._renderTargetBlur = new i(this.shadowMapSize, this.shadowMapSize), this._renderTargetBlur.texture.generateMipmaps = !1, this._sharedShadowGroundPlane = r?.sharedShadowGroundPlane, this.shadowGroundPlane.setShadowMap(this.renderTarget.texture), this.shadowGroundPlane.updateMaterial(this.parameters), this._groundContactCamera = new nt(), this._groundGroup.add(this._groundContactCamera), this._depthMaterial = new _e(), this._depthMaterial.userData.fadeoutBias = { value: this.parameters.fadeoutBias }, this._depthMaterial.userData.fadeoutFalloff = { value: this.parameters.fadeoutFalloff }, this._depthMaterial.onBeforeCompile = (e) => {
|
|
1736
636
|
e.uniforms.fadeoutBias = this._depthMaterial.userData.fadeoutBias, e.uniforms.fadeoutFalloff = this._depthMaterial.userData.fadeoutFalloff, e.fragmentShader = `
|
|
1737
637
|
uniform float fadeoutBias;
|
|
1738
638
|
uniform float fadeoutFalloff;
|
|
1739
|
-
${e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );",
|
|
639
|
+
${e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );", He.alphaMap ? "gl_FragColor = vec4(clamp(pow(1.0 + fadeoutBias - fragCoordZ, 1.0/(1.0-fadeoutFalloff)), 0.0, 1.0));" : "gl_FragColor = vec4(vec3(0.0), clamp(pow(1.0 + fadeoutBias - fragCoordZ, 1.0/(1.0-fadeoutFalloff)), 0.0, 1.0));")}
|
|
1740
640
|
`;
|
|
1741
|
-
}, this._depthMaterial.side = 2, this._depthMaterial.depthTest = !0, this._depthMaterial.depthWrite = !0, this._blurPass = new
|
|
641
|
+
}, this._depthMaterial.side = 2, this._depthMaterial.depthTest = !0, this._depthMaterial.depthWrite = !0, this._blurPass = new Ee(Te, {
|
|
1742
642
|
...r,
|
|
1743
643
|
passRenderer: this.renderPassManager.passRenderer
|
|
1744
644
|
}), this.updatePlaneAndShadowCamera();
|
|
@@ -1828,7 +728,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1828
728
|
this.renderTarget
|
|
1829
729
|
], [e, e], [t, t]);
|
|
1830
730
|
}
|
|
1831
|
-
},
|
|
731
|
+
}, nt = class extends a {
|
|
1832
732
|
constructor() {
|
|
1833
733
|
super(-1, 1, -1, 1, -1, 1), this.rotation.x = Math.PI;
|
|
1834
734
|
}
|
|
@@ -1839,12 +739,12 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1839
739
|
this.far = e, this.updateProjectionMatrix(), this.cameraHelper?.update();
|
|
1840
740
|
}
|
|
1841
741
|
updateCameraHelper(e, t) {
|
|
1842
|
-
e ? (this.cameraHelper = this.cameraHelper ?? new
|
|
742
|
+
e ? (this.cameraHelper = this.cameraHelper ?? new ve(this), this.cameraHelper.visible = !0, t?.add(this.cameraHelper)) : this.cameraHelper?.parent && this.cameraHelper?.removeFromParent();
|
|
1843
743
|
}
|
|
1844
744
|
setCameraHelperVisibility(e) {
|
|
1845
745
|
this.cameraHelper && (this.cameraHelper.visible = e);
|
|
1846
746
|
}
|
|
1847
|
-
},
|
|
747
|
+
}, rt = "varying vec3 vNormal;\n#if LINEAR_DEPTH == 1\n varying float vZ; \n#endif\n\n void main() {\n vNormal = normalMatrix * normal;\n vec4 viewPosition = modelViewMatrix * vec4(position, 1.0);\n #if LINEAR_DEPTH == 1\n vZ = viewPosition.z; \n #endif\n gl_Position = projectionMatrix * viewPosition;\n }", it = "varying vec3 vNormal;\n#if LINEAR_DEPTH == 1\n varying float vZ; \n uniform float cameraNear;\n uniform float cameraFar;\n#endif\n\n void main() {\n #if FLOAT_BUFFER == 1\n vec3 normal = normalize(vNormal);\n #else\n vec3 normal = normalize(vNormal) * 0.5 + 0.5;\n #endif\n #if LINEAR_DEPTH == 1\n float depth = (-vZ - cameraNear) / (cameraFar - cameraNear);\n #else\n float depth = gl_FragCoord.z;\n #endif\n gl_FragColor = vec4(normal, depth);\n }", at = class e extends p {
|
|
1848
748
|
static {
|
|
1849
749
|
this._normalAndDepthShader = {
|
|
1850
750
|
uniforms: {
|
|
@@ -1855,8 +755,8 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1855
755
|
FLOAT_BUFFER: 0,
|
|
1856
756
|
LINEAR_DEPTH: 0
|
|
1857
757
|
},
|
|
1858
|
-
vertexShader:
|
|
1859
|
-
fragmentShader:
|
|
758
|
+
vertexShader: rt,
|
|
759
|
+
fragmentShader: it
|
|
1860
760
|
};
|
|
1861
761
|
}
|
|
1862
762
|
constructor(t) {
|
|
@@ -1866,7 +766,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1866
766
|
FLOAT_BUFFER: t?.floatBufferType ? 1 : 0,
|
|
1867
767
|
LINEAR_DEPTH: t?.linearDepth ? 1 : 0
|
|
1868
768
|
}),
|
|
1869
|
-
uniforms:
|
|
769
|
+
uniforms: S.clone(e._normalAndDepthShader.uniforms),
|
|
1870
770
|
vertexShader: e._normalAndDepthShader.vertexShader,
|
|
1871
771
|
fragmentShader: e._normalAndDepthShader.fragmentShader,
|
|
1872
772
|
blending: t?.blending ?? 0
|
|
@@ -1879,7 +779,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1879
779
|
}
|
|
1880
780
|
return this;
|
|
1881
781
|
}
|
|
1882
|
-
},
|
|
782
|
+
}, ot = class extends V {
|
|
1883
783
|
set groundDepthWrite(e) {
|
|
1884
784
|
this._gBufferMaterialCache && (this._gBufferMaterialCache.groundDepthWrite = e);
|
|
1885
785
|
}
|
|
@@ -1896,22 +796,22 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1896
796
|
return this.floatRgbNormalAlphaDepth ? this.depthNormalRenderTarget.texture : this.depthNormalRenderTarget.depthTexture;
|
|
1897
797
|
}
|
|
1898
798
|
updateGBufferRenderMaterial(e) {
|
|
1899
|
-
return this._gBufferRenderMaterial = this._gBufferRenderMaterial ?? (this.floatRgbNormalAlphaDepth ? new
|
|
799
|
+
return this._gBufferRenderMaterial = this._gBufferRenderMaterial ?? (this.floatRgbNormalAlphaDepth ? new at({
|
|
1900
800
|
blending: 0,
|
|
1901
801
|
floatBufferType: !0,
|
|
1902
802
|
linearDepth: !1
|
|
1903
|
-
}) : new
|
|
803
|
+
}) : new de({ blending: 0 })), this._gBufferRenderMaterial instanceof at && this._gBufferRenderMaterial.update({ camera: e }), this._gBufferRenderMaterial;
|
|
1904
804
|
}
|
|
1905
805
|
get depthNormalRenderTarget() {
|
|
1906
806
|
if (!this._depthNormalRenderTarget) if (this.floatRgbNormalAlphaDepth) this._depthNormalRenderTarget = new i(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale, {
|
|
1907
807
|
minFilter: this._targetMinificationTextureFilter,
|
|
1908
808
|
magFilter: this._targetMagnificationTextureFilter,
|
|
1909
|
-
type:
|
|
809
|
+
type: x,
|
|
1910
810
|
samples: this._samples
|
|
1911
811
|
});
|
|
1912
812
|
else {
|
|
1913
|
-
let e = new
|
|
1914
|
-
e.format =
|
|
813
|
+
let e = new _(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale);
|
|
814
|
+
e.format = s, e.type = se, this._depthNormalRenderTarget = new i(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale, {
|
|
1915
815
|
minFilter: this._targetMinificationTextureFilter,
|
|
1916
816
|
magFilter: this._targetMagnificationTextureFilter,
|
|
1917
817
|
depthTexture: e
|
|
@@ -1923,12 +823,12 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1923
823
|
return this._separateDeptRenderTarget ||= new i(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale, {
|
|
1924
824
|
minFilter: this._targetMinificationTextureFilter,
|
|
1925
825
|
magFilter: this._targetMagnificationTextureFilter,
|
|
1926
|
-
type:
|
|
826
|
+
type: x,
|
|
1927
827
|
samples: 0
|
|
1928
828
|
}), this._separateDeptRenderTarget;
|
|
1929
829
|
}
|
|
1930
830
|
constructor(e, t) {
|
|
1931
|
-
super(e), this.floatRgbNormalAlphaDepth = !1, this.linearDepth = !1, this.copyToSeparateDepthBuffer = !1, this.needsUpdate = !0, this.drawGround = !0, this.floatRgbNormalAlphaDepth = t?.capabilities?.isWebGL2 ?? !1, this.renderCacheManager && (this._gBufferMaterialCache = new
|
|
831
|
+
super(e), this.floatRgbNormalAlphaDepth = !1, this.linearDepth = !1, this.copyToSeparateDepthBuffer = !1, this.needsUpdate = !0, this.drawGround = !0, this.floatRgbNormalAlphaDepth = t?.capabilities?.isWebGL2 ?? !1, this.renderCacheManager && (this._gBufferMaterialCache = new st(), this.renderCacheManager.registerCache(this, this._gBufferMaterialCache)), this.parameters = { depthNormalScale: t?.depthNormalScale ?? 1 }, this._targetMinificationTextureFilter = t?.textureMinificationFilter ?? 1003, this._targetMagnificationTextureFilter = t?.textureMagnificationFilter ?? 1003, this._width = t?.width ?? 1024, this._height = t?.height ?? 1024, this._samples = t?.samples ?? 0, this._shared = t?.shared ?? !1;
|
|
1932
832
|
}
|
|
1933
833
|
dispose() {
|
|
1934
834
|
super.dispose(), this._gBufferRenderMaterial?.dispose(), this._depthNormalRenderTarget?.dispose();
|
|
@@ -1945,19 +845,19 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1945
845
|
this.passRenderer.renderWithOverrideMaterial(e, t, n, this.updateGBufferRenderMaterial(n), this.depthNormalRenderTarget, 7829503, 1);
|
|
1946
846
|
}
|
|
1947
847
|
getCopyMaterial(e) {
|
|
1948
|
-
return this._copyMaterial ??= new
|
|
848
|
+
return this._copyMaterial ??= new M(), this._copyMaterial.update(e);
|
|
1949
849
|
}
|
|
1950
850
|
_copyDepthToSeparateDepthTexture(e, t) {
|
|
1951
851
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1952
852
|
texture: t.texture,
|
|
1953
853
|
blending: 0,
|
|
1954
|
-
colorTransform:
|
|
1955
|
-
colorBase:
|
|
854
|
+
colorTransform: Re,
|
|
855
|
+
colorBase: z,
|
|
1956
856
|
multiplyChannels: 0,
|
|
1957
|
-
uvTransform:
|
|
857
|
+
uvTransform: B
|
|
1958
858
|
}), this.separateDeptRenderTarget);
|
|
1959
859
|
}
|
|
1960
|
-
},
|
|
860
|
+
}, st = class extends $e {
|
|
1961
861
|
set groundDepthWrite(e) {
|
|
1962
862
|
this._groundDepthWrite = e;
|
|
1963
863
|
}
|
|
@@ -1969,12 +869,12 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1969
869
|
this.addToCache(e, { visible: !1 });
|
|
1970
870
|
}
|
|
1971
871
|
addMesh(e) {
|
|
1972
|
-
e.userData.isFloor ? this.addToCache(e, { visible: this._groundDepthWrite }) : e.visible && (
|
|
872
|
+
e.userData.isFloor ? this.addToCache(e, { visible: this._groundDepthWrite }) : e.visible && (q(e.material, .7) || J(e.material)) && this.addToCache(e, { visible: !1 });
|
|
1973
873
|
}
|
|
1974
874
|
addObject(e) {
|
|
1975
875
|
e.name === "dimensioning" && this.addToCache(e, { visible: !1 });
|
|
1976
876
|
}
|
|
1977
|
-
},
|
|
877
|
+
}, ct = class extends V {
|
|
1978
878
|
get reflectionRenderTarget() {
|
|
1979
879
|
return this._reflectionRenderTarget = this._reflectionRenderTarget ?? this._newRenderTarget(!0), this._reflectionRenderTarget;
|
|
1980
880
|
}
|
|
@@ -1998,17 +898,17 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1998
898
|
groundReflectionScale: 1,
|
|
1999
899
|
renderTargetDownScale: 4,
|
|
2000
900
|
...i
|
|
2001
|
-
}, this._copyMaterial = new
|
|
901
|
+
}, this._copyMaterial = new M({}, Le.ADDITIVE, !0, !0), this._updateCopyMaterial(null), this._reflectionIntensityMaterial = new dt({
|
|
2002
902
|
width: this._width / this.parameters.renderTargetDownScale,
|
|
2003
903
|
height: this._height / this.parameters.renderTargetDownScale
|
|
2004
|
-
}), this._blurPass = new
|
|
904
|
+
}), this._blurPass = new Ee(Te, {
|
|
2005
905
|
...i,
|
|
2006
906
|
passRenderer: this.renderPassManager.passRenderer
|
|
2007
907
|
});
|
|
2008
908
|
}
|
|
2009
909
|
_newRenderTarget(e) {
|
|
2010
910
|
let t = this._width / this.parameters.renderTargetDownScale, n = this._height / this.parameters.renderTargetDownScale, r = {};
|
|
2011
|
-
return e ? (r.depthTexture = new
|
|
911
|
+
return e ? (r.depthTexture = new _(t, n), r.samples = this._samples) : r.samples = 1, new i(t, n, {
|
|
2012
912
|
format: o,
|
|
2013
913
|
...r
|
|
2014
914
|
});
|
|
@@ -2032,13 +932,13 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2032
932
|
let n = this.parameters.intensity * t, r = this.parameters.brightness;
|
|
2033
933
|
this._copyMaterial.update({
|
|
2034
934
|
texture: e?.texture ?? void 0,
|
|
2035
|
-
colorTransform: new
|
|
935
|
+
colorTransform: new E().set(r, 0, 0, 0, 0, r, 0, 0, 0, 0, r, 0, 0, 0, 0, n),
|
|
2036
936
|
multiplyChannels: 0,
|
|
2037
|
-
uvTransform:
|
|
937
|
+
uvTransform: N
|
|
2038
938
|
}), this._copyMaterial.depthTest = !0, this._copyMaterial.depthWrite = !1;
|
|
2039
939
|
}
|
|
2040
940
|
renderPass(e) {
|
|
2041
|
-
if (!this.parameters.enabled || !(this.camera instanceof
|
|
941
|
+
if (!this.parameters.enabled || !(this.camera instanceof l)) return;
|
|
2042
942
|
let t = this._createGroundReflectionCamera(this.camera);
|
|
2043
943
|
this.renderCacheManager.render("groundReflection", this.scene, () => {
|
|
2044
944
|
this._renderGroundReflection(e, this.scene, t, this.reflectionRenderTarget);
|
|
@@ -2064,7 +964,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2064
964
|
}), e.getRenderTarget()), e.setRenderTarget(r);
|
|
2065
965
|
}
|
|
2066
966
|
blurReflection(e, t, n) {
|
|
2067
|
-
let r = new
|
|
967
|
+
let r = new d(t.matrixWorld.elements[4], t.matrixWorld.elements[5], t.matrixWorld.elements[6]), i = this.parameters.blurHorizontal / this._width, a = this.parameters.blurVertical / this._height * Math.abs(r.dot(new d(0, 0, 1)));
|
|
2068
968
|
this._blurPass.render(e, n, [i * 4, a * 4], [i * 4 * (1 + this.parameters.blurAscent), a * 4 * (1 + this.parameters.blurAscent)]);
|
|
2069
969
|
}
|
|
2070
970
|
_createGroundReflectionCamera(e) {
|
|
@@ -2076,18 +976,18 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2076
976
|
bottom: 1 - n._offset.top
|
|
2077
977
|
}, t.position.set(e.position.x, -e.position.y + 2 * this.parameters.groundLevel, e.position.z), t.rotation.set(-e.rotation.x, e.rotation.y, -e.rotation.z), t.updateMatrixWorld(), t.updateProjectionMatrix(), t;
|
|
2078
978
|
}
|
|
2079
|
-
},
|
|
979
|
+
}, lt = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }", ut = "\n uniform sampler2D tDiffuse;\n uniform sampler2D tDepth;\n uniform vec2 resolution;\n uniform float cameraNear;\n uniform float cameraFar;\n uniform mat4 cameraProjectionMatrix;\n uniform mat4 cameraInverseProjectionMatrix;\n uniform mat4 inverseViewMatrix;\n uniform float groundLevel;\n uniform float fadeOutDistance;\n uniform float fadeOutExponent;\n varying vec2 vUv;\n\n #include <packing>\n\n float getDepth(const in vec2 screenPosition) {\n return texture2D(tDepth, screenPosition).x;\n }\n\n float getLinearDepth(const in vec2 screenPosition) {\n #if PERSPECTIVE_CAMERA == 1\n float fragCoordZ = texture2D(tDepth, screenPosition).x;\n float viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\n return viewZToOrthographicDepth(viewZ, cameraNear, cameraFar);\n #else\n return texture2D(tDepth, screenPosition).x;\n #endif\n }\n\n float getViewZ(const in float depth) {\n #if PERSPECTIVE_CAMERA == 1\n return perspectiveDepthToViewZ(depth, cameraNear, cameraFar);\n #else\n return 0.0;//orthographicDepthToViewZ(depth, cameraNear, cameraFar);\n #endif\n }\n\n vec3 getViewPosition(const in vec2 screenPosition, const in float depth, const in float viewZ ) {\n float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];\n vec4 clipPosition = vec4((vec3(screenPosition, depth) - 0.5) * 2.0, 1.0);\n clipPosition *= clipW;\n return (cameraInverseProjectionMatrix * clipPosition).xyz;\n }\n\n void main() {\n float verticalBias = 1.5 / resolution.y;\n vec2 uv = vUv.xy + vec2(0.0, verticalBias);\n float depth = getDepth(uv);\n float viewZ = getViewZ(depth);\n vec4 worldPosition = inverseViewMatrix * vec4(getViewPosition(uv, depth, viewZ), 1.0);\n float distance = worldPosition.y - groundLevel;\n vec2 diffuseTextureSize = vec2(textureSize(tDiffuse, 0 ));\n vec4 fragColor = texelFetch(tDiffuse, ivec2(uv * diffuseTextureSize), 0).rgba;\n #if LINEAR_TO_SRGB == 1\n fragColor.rgb = mix(fragColor.rgb * 12.92, 1.055 * pow(fragColor.rgb, vec3(0.41666)) - 0.055, step(0.0031308, fragColor.rgb));\n #endif\n float fadeOutAlpha = pow(clamp(1.0 - distance / fadeOutDistance, 0.0, 1.0), fadeOutExponent);\n fragColor.a *= fadeOutAlpha * step(depth, 0.9999);\n #if PREMULTIPLIED_ALPHA == 1\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n #else\n gl_FragColor = fragColor;\n #endif\n }", dt = class e extends p {
|
|
2080
980
|
static {
|
|
2081
981
|
this.shader = {
|
|
2082
982
|
uniforms: {
|
|
2083
983
|
tDiffuse: { value: null },
|
|
2084
984
|
tDepth: { value: null },
|
|
2085
|
-
resolution: { value: new
|
|
985
|
+
resolution: { value: new O() },
|
|
2086
986
|
cameraNear: { value: .1 },
|
|
2087
987
|
cameraFar: { value: 1 },
|
|
2088
|
-
cameraProjectionMatrix: { value: new
|
|
2089
|
-
cameraInverseProjectionMatrix: { value: new
|
|
2090
|
-
inverseViewMatrix: { value: new
|
|
988
|
+
cameraProjectionMatrix: { value: new E() },
|
|
989
|
+
cameraInverseProjectionMatrix: { value: new E() },
|
|
990
|
+
inverseViewMatrix: { value: new E() },
|
|
2091
991
|
groundLevel: { value: 0 },
|
|
2092
992
|
fadeOutDistance: { value: 1 },
|
|
2093
993
|
fadeOutExponent: { value: 1 }
|
|
@@ -2097,14 +997,14 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2097
997
|
LINEAR_TO_SRGB: 0,
|
|
2098
998
|
PREMULTIPLIED_ALPHA: 1
|
|
2099
999
|
},
|
|
2100
|
-
vertexShader:
|
|
2101
|
-
fragmentShader:
|
|
1000
|
+
vertexShader: lt,
|
|
1001
|
+
fragmentShader: ut
|
|
2102
1002
|
};
|
|
2103
1003
|
}
|
|
2104
1004
|
constructor(t) {
|
|
2105
1005
|
super({
|
|
2106
1006
|
defines: Object.assign({}, e.shader.defines),
|
|
2107
|
-
uniforms:
|
|
1007
|
+
uniforms: S.clone(e.shader.uniforms),
|
|
2108
1008
|
vertexShader: e.shader.vertexShader,
|
|
2109
1009
|
fragmentShader: e.shader.fragmentShader,
|
|
2110
1010
|
blending: 0
|
|
@@ -2121,7 +1021,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2121
1021
|
}
|
|
2122
1022
|
return e?.groundLevel !== void 0 && (this.uniforms.groundLevel.value = e?.groundLevel), e?.fadeOutDistance !== void 0 && (this.uniforms.fadeOutDistance.value = e?.fadeOutDistance), e?.fadeOutExponent !== void 0 && (this.uniforms.fadeOutExponent.value = e?.fadeOutExponent), this;
|
|
2123
1023
|
}
|
|
2124
|
-
},
|
|
1024
|
+
}, ft = class extends ye {
|
|
2125
1025
|
constructor(e, t) {
|
|
2126
1026
|
let n = [
|
|
2127
1027
|
1,
|
|
@@ -2139,9 +1039,9 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2139
1039
|
1,
|
|
2140
1040
|
1,
|
|
2141
1041
|
0
|
|
2142
|
-
], r = new
|
|
2143
|
-
r.setAttribute("position", new
|
|
2144
|
-
let i = new
|
|
1042
|
+
], r = new oe();
|
|
1043
|
+
r.setAttribute("position", new ge(n, 3)), r.computeBoundingSphere();
|
|
1044
|
+
let i = new h({ fog: !1 });
|
|
2145
1045
|
super(r, i), this.light = e, this.color = t, this.type = "RectAreaLightHelper";
|
|
2146
1046
|
let a = [
|
|
2147
1047
|
1,
|
|
@@ -2162,8 +1062,8 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2162
1062
|
1,
|
|
2163
1063
|
-1,
|
|
2164
1064
|
0
|
|
2165
|
-
], o = new
|
|
2166
|
-
o.setAttribute("position", new
|
|
1065
|
+
], o = new oe();
|
|
1066
|
+
o.setAttribute("position", new ge(a, 3)), o.computeBoundingSphere(), this.add(new b(o, new C({
|
|
2167
1067
|
side: 1,
|
|
2168
1068
|
fog: !1
|
|
2169
1069
|
})));
|
|
@@ -2180,18 +1080,18 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2180
1080
|
dispose() {
|
|
2181
1081
|
this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
|
|
2182
1082
|
}
|
|
2183
|
-
},
|
|
1083
|
+
}, pt = class e extends ie {
|
|
2184
1084
|
static {
|
|
2185
1085
|
this._enableGroundBoundary = !1;
|
|
2186
1086
|
}
|
|
2187
1087
|
static {
|
|
2188
|
-
this._shadowFadeOut = new
|
|
1088
|
+
this._shadowFadeOut = new O(.1, 20);
|
|
2189
1089
|
}
|
|
2190
1090
|
static {
|
|
2191
|
-
this._sceneBoxMin = new
|
|
1091
|
+
this._sceneBoxMin = new d(-1, -1, -1);
|
|
2192
1092
|
}
|
|
2193
1093
|
static {
|
|
2194
|
-
this._sceneBoxMax = new
|
|
1094
|
+
this._sceneBoxMax = new d(1, 1, 1);
|
|
2195
1095
|
}
|
|
2196
1096
|
static {
|
|
2197
1097
|
this._distributionProperties = new n(1, 1, 1, 1);
|
|
@@ -2209,7 +1109,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2209
1109
|
return e._enableGroundBoundary ? "GROUND_BOUNDARY" : "NO_GROUND_BOUNDARY";
|
|
2210
1110
|
}
|
|
2211
1111
|
_onBeforeCompile(t, n) {
|
|
2212
|
-
t.vertexShader =
|
|
1112
|
+
t.vertexShader = mt, t.fragmentShader = ht, t.defines = Object.assign({
|
|
2213
1113
|
...t.defines,
|
|
2214
1114
|
DYNAMIC_SHADOW_RADIUS: "",
|
|
2215
1115
|
GROUND_BOUNDARY: e._enableGroundBoundary ? 1 : 0
|
|
@@ -2217,22 +1117,22 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2217
1117
|
let r = t.uniforms;
|
|
2218
1118
|
r && (r.distributionProperties = { value: e._distributionProperties }, r.shadowFadeOut = { value: e._shadowFadeOut }, r.sceneBoxMin = { value: e._sceneBoxMin }, r.sceneBoxMax = { value: e._sceneBoxMax });
|
|
2219
1119
|
}
|
|
2220
|
-
},
|
|
1120
|
+
}, mt = "\n#define LAMBERT\n\nvarying vec3 vViewPosition;\nvarying vec3 vWorldPosition;\n\n#include <common>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n\n vViewPosition = - mvPosition.xyz;\n\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n\n#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vWorldPosition = worldPosition.xyz;\n#else\n vWorldPosition = (modelMatrix * vec4(transformed, 1.)).xyz;\n#endif\n}\n", ht = "\n#define LAMBERT\n\nuniform vec3 diffuse;\nuniform float opacity;\n\nvarying vec3 vViewPosition;\nvarying vec3 vWorldPosition;\n\n#ifdef DYNAMIC_SHADOW_RADIUS\n uniform vec2 shadowFadeOut;\n #define fadeOutDistance shadowFadeOut.x\n #define fadeOutBlur shadowFadeOut.y\n uniform vec3 sceneBoxMin;\n uniform vec3 sceneBoxMax;\n#endif\nuniform vec4 distributionProperties;\n#define directionalDependency distributionProperties.x\n#define directionalExponent distributionProperties.y\n#define groundBoundary distributionProperties.z\n#define groundMapScale distributionProperties.w\n\n#include <common>\n#include <packing>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvec2 getShadowDynamicScale() {\n vec2 dynamicScale = vec2(0.0, 1.0);\n#ifdef DYNAMIC_SHADOW_RADIUS\n if (fadeOutDistance > 0.0) {\n vec3 boxDistanceVec = max(vec3(0.0), max(sceneBoxMin - vWorldPosition, vWorldPosition - sceneBoxMax));\n float boxDistance = length(boxDistanceVec);\n float shadowBase = clamp(boxDistance / fadeOutDistance, 0.0, 1.0);\n dynamicScale = vec2(shadowBase, 1.0 - shadowBase);\n }\n#endif\n return dynamicScale;\n}\n\n\n#if defined( SHADOWMAP_TYPE_PCF )\nfloat getShadowDynamicRadius(sampler2DShadow shadowMap, float shadowBias, float shadowRadius, vec4 shadowCoord, vec2 shadowScale) {\n#else\nfloat getShadowDynamicRadius(sampler2D shadowMap, float shadowBias, float shadowRadius, vec4 shadowCoord, vec2 shadowScale) {\n#endif\n float dynamicRadius = shadowRadius;\n#ifdef DYNAMIC_SHADOW_RADIUS\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if (frustumTest && fadeOutDistance > 0.0) {\n dynamicRadius = shadowRadius + fadeOutBlur * max(0.0, shadowScale.x);\n }\n#endif\n return dynamicRadius;\n}\n\nvoid main() {\n\n #include <clipping_planes_fragment>\n\n vec4 diffuseColor = vec4( diffuse, opacity );\n\n #include <logdepthbuf_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n\n // accumulation\n\n vec3 geometryPosition = - vViewPosition;\n vec3 geometryNormal = normal;\n vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n vec3 accumulatedShadowLight = vec3(0.0);\n vec3 directionDependentShadowLight = vec3(1.0);\n float groundDistance = clamp((vWorldPosition.y - sceneBoxMin.y) * 100.0, 0.0, 1.0);\n vec2 dynamicScale = getShadowDynamicScale();\n\n #if ( NUM_DIR_LIGHTS > 0 )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n\n IncidentLight directLight;\n vec3 incidentLightSum = vec3(0.0);\n vec3 incidentShadowLight = vec3(0.0);\n float groundShadowFactor = 1.;\n float shadowFactor;\n float dynamicRadius;\n float dotNL;\n\n #pragma unroll_loop_start\n for ( int i = 0 ; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n\n #if defined( USE_SHADOWMAP ) && ( GROUND_BOUNDARY == 1 && UNROLLED_LOOP_INDEX == 0 )\n\n directionalLightShadow = directionalLightShadows[ i ];\n dynamicRadius = fadeOutDistance * groundMapScale;\n groundShadowFactor = groundDistance < 0.5 ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, dynamicRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n #elif defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\n directionalLightShadow = directionalLightShadows[ i ];\n dynamicRadius = getShadowDynamicRadius(directionalShadowMap[i], directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[i], dynamicScale);\n shadowFactor = ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, dynamicRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n accumulatedShadowLight += directLight.color * shadowFactor * saturate(min(dotNL * 10.0 + 0.9, 1.0));\n dotNL = dot(dot(geometryNormal, geometryPosition) >= 0.0 ? -geometryNormal : geometryNormal, directLight.direction);\n incidentLightSum += directLight.color;\n incidentShadowLight += directLight.color * mix(1.0, shadowFactor, pow(clamp(dotNL, 0.0, 1.0), directionalExponent));\n\n #endif\n }\n #pragma unroll_loop_end\n\n directionDependentShadowLight = incidentShadowLight / ( incidentLightSum + 1. - step(0., incidentLightSum) );\n #else\n accumulatedShadowLight = vec3(1.0);\n #endif\n\n // modulation\n\n vec3 outgoingLight = mix(accumulatedShadowLight, directionDependentShadowLight, max(directionalDependency, 1.0 - groundDistance));\n #if GROUND_BOUNDARY == 1\n float groundWeight = 1. - groundShadowFactor + groundDistance - (1. - groundShadowFactor) * groundDistance;\n outgoingLight = mix(vec3(1.), outgoingLight, mix(dynamicScale.y, groundWeight, groundBoundary));\n #else\n outgoingLight = mix(vec3(1.), outgoingLight, dynamicScale.y);\n #endif\n\n #include <opaque_fragment>\n #include <premultiplied_alpha_fragment>\n}\n", gt = {
|
|
2221
1121
|
DIRECTION_LIGHT_SHADOW: "DirectionalLightShadow",
|
|
2222
1122
|
SPOT_LIGHT_SHADOW: "SpotLightShadow"
|
|
2223
|
-
},
|
|
1123
|
+
}, _t = {
|
|
2224
1124
|
alwaysUpdate: !1,
|
|
2225
1125
|
enableShadowMap: !0,
|
|
2226
1126
|
enableGroundBoundary: !0,
|
|
2227
1127
|
layers: null,
|
|
2228
|
-
shadowLightSourceType:
|
|
1128
|
+
shadowLightSourceType: gt.DIRECTION_LIGHT_SHADOW,
|
|
2229
1129
|
maximumNumberOfLightSources: -1,
|
|
2230
1130
|
directionalDependency: 1,
|
|
2231
1131
|
directionalExponent: 1,
|
|
2232
1132
|
groundBoundary: 1,
|
|
2233
1133
|
fadeOutDistance: .1,
|
|
2234
1134
|
fadeOutBlur: 5
|
|
2235
|
-
},
|
|
1135
|
+
}, vt = class extends V {
|
|
2236
1136
|
get shadowTexture() {
|
|
2237
1137
|
return this._shadowRenderTarget.texture;
|
|
2238
1138
|
}
|
|
@@ -2240,18 +1140,18 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2240
1140
|
this._shadowMapPassOverrideMaterialCache.shadowOnGround = e;
|
|
2241
1141
|
}
|
|
2242
1142
|
constructor(e, t, n) {
|
|
2243
|
-
super(e), this.needsUpdate = !1, this.drawGround = !0, this.shadowTypeNeedsUpdate = !0, this.shadowConfiguration = new
|
|
1143
|
+
super(e), this.needsUpdate = !1, this.drawGround = !0, this.shadowTypeNeedsUpdate = !0, this.shadowConfiguration = new bt(), this._shadowLightSources = [], this._shadowScale = 1, this._groundMapScale = 1, this._cameraUpdate = new F(), this._viewportSize = new O(t.x, t.y), this._samples = n?.samples ?? 0, this._shadowMapSize = n?.shadowMapSize ?? 1024, this.parameters = this._getScreenSpaceShadowMapParameters(n), this.castShadow = this.parameters.enableShadowMap, this._shadowMapPassOverrideMaterialCache = new yt(), this.renderCacheManager?.registerCache(this, this._shadowMapPassOverrideMaterialCache);
|
|
2244
1144
|
let r = this._samples;
|
|
2245
1145
|
this._shadowRenderTarget = new i(this._viewportSize.x, this._viewportSize.y, {
|
|
2246
1146
|
samples: r,
|
|
2247
|
-
format:
|
|
2248
|
-
magFilter: this._samples > 0 ?
|
|
2249
|
-
minFilter: this._samples > 0 ?
|
|
1147
|
+
format: ue,
|
|
1148
|
+
magFilter: this._samples > 0 ? T : y,
|
|
1149
|
+
minFilter: this._samples > 0 ? T : y
|
|
2250
1150
|
});
|
|
2251
1151
|
}
|
|
2252
1152
|
_getScreenSpaceShadowMapParameters(e) {
|
|
2253
1153
|
return {
|
|
2254
|
-
...
|
|
1154
|
+
..._t,
|
|
2255
1155
|
...e
|
|
2256
1156
|
};
|
|
2257
1157
|
}
|
|
@@ -2279,7 +1179,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2279
1179
|
return this._shadowLightSources.find((t) => t.getOriginalLight() === e)?.getShadowLight();
|
|
2280
1180
|
}
|
|
2281
1181
|
addRectAreaLight(e, t) {
|
|
2282
|
-
let n = new
|
|
1182
|
+
let n = new Z(e, {
|
|
2283
1183
|
shadowMapSize: this._shadowMapSize,
|
|
2284
1184
|
shadowLightSourceType: this.parameters.shadowLightSourceType
|
|
2285
1185
|
});
|
|
@@ -2289,14 +1189,14 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2289
1189
|
let n = this._shadowLightSources;
|
|
2290
1190
|
this._shadowLightSources = this._createShadowLightSourceArray(!1);
|
|
2291
1191
|
for (let r of n) {
|
|
2292
|
-
if (r instanceof
|
|
1192
|
+
if (r instanceof Z) {
|
|
2293
1193
|
let t = r.getRectAreaLight();
|
|
2294
1194
|
e.includes(t) && (r.updatePositionAndTarget(), this._shadowLightSources.push(r));
|
|
2295
1195
|
}
|
|
2296
1196
|
r.removeFrom(t), r.dispose();
|
|
2297
1197
|
}
|
|
2298
1198
|
e.forEach((e) => {
|
|
2299
|
-
this._shadowLightSources.find((t) => t instanceof
|
|
1199
|
+
this._shadowLightSources.find((t) => t instanceof Z && t.getRectAreaLight() === e) || this.addRectAreaLight(e, t);
|
|
2300
1200
|
}), this.needsUpdate = !0, this.shadowTypeNeedsUpdate = !0;
|
|
2301
1201
|
}
|
|
2302
1202
|
createShadowFromLightSources(e, t) {
|
|
@@ -2311,7 +1211,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2311
1211
|
e.forEach((e) => {
|
|
2312
1212
|
let n = e.maxIntensity * t;
|
|
2313
1213
|
if (n >= .1 && e.position.z >= 0) {
|
|
2314
|
-
let t = new
|
|
1214
|
+
let t = new St(new d(e.position.x, e.position.z, e.position.y).multiplyScalar(7), n, {
|
|
2315
1215
|
shadowMapSize: this._shadowMapSize,
|
|
2316
1216
|
shadowLightSourceType: this.parameters.shadowLightSourceType
|
|
2317
1217
|
});
|
|
@@ -2322,13 +1222,13 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2322
1222
|
_createShadowLightSourceArray(e) {
|
|
2323
1223
|
let t = [];
|
|
2324
1224
|
if (e) {
|
|
2325
|
-
let e = new
|
|
1225
|
+
let e = new Ct(new d(0, 7, 0), { shadowMapSize: this._shadowMapSize });
|
|
2326
1226
|
t.push(e);
|
|
2327
1227
|
}
|
|
2328
1228
|
return this.parameters.enableGroundBoundary = e, t;
|
|
2329
1229
|
}
|
|
2330
1230
|
setSize(e, t) {
|
|
2331
|
-
this._viewportSize = new
|
|
1231
|
+
this._viewportSize = new O(e, t), this._shadowRenderTarget.setSize(this._viewportSize.x, this._viewportSize.y);
|
|
2332
1232
|
}
|
|
2333
1233
|
updatePositionAndTarget() {
|
|
2334
1234
|
this._shadowLightSources.forEach((e) => e.updatePositionAndTarget());
|
|
@@ -2366,12 +1266,12 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2366
1266
|
switchType(e) {
|
|
2367
1267
|
return this.shadowConfiguration.switchType(e) ? (this.needsUpdate = !0, this.shadowTypeNeedsUpdate = !0, !0) : !1;
|
|
2368
1268
|
}
|
|
2369
|
-
},
|
|
1269
|
+
}, X = {
|
|
2370
1270
|
DEFAULT: "default",
|
|
2371
1271
|
UNLIT: "unlit",
|
|
2372
1272
|
EMISSIVE: "emissive",
|
|
2373
1273
|
SHADOW: "shadow"
|
|
2374
|
-
},
|
|
1274
|
+
}, yt = class e extends $e {
|
|
2375
1275
|
static {
|
|
2376
1276
|
this.useModifiedMaterial = !0;
|
|
2377
1277
|
}
|
|
@@ -2379,23 +1279,23 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2379
1279
|
this._shadowOnGround = e;
|
|
2380
1280
|
}
|
|
2381
1281
|
constructor() {
|
|
2382
|
-
super(), this._boundingBoxSet = !1, this._shadowOnGround = !0, this._shadowObjectMaterial = this._createShadowMaterial(
|
|
1282
|
+
super(), this._boundingBoxSet = !1, this._shadowOnGround = !0, this._shadowObjectMaterial = this._createShadowMaterial(X.DEFAULT), this._unlitMaterial = this._createShadowMaterial(X.UNLIT), this._emissiveMaterial = this._createShadowMaterial(X.EMISSIVE), this._receiveShadowMaterial = this._createShadowMaterial(X.SHADOW);
|
|
2383
1283
|
}
|
|
2384
1284
|
dispose() {
|
|
2385
1285
|
this._shadowObjectMaterial.dispose(), this._unlitMaterial.dispose(), this._emissiveMaterial.dispose(), this._receiveShadowMaterial.dispose();
|
|
2386
1286
|
}
|
|
2387
1287
|
setShadowParameters(e, t, n, r, i, a, o) {
|
|
2388
|
-
|
|
1288
|
+
pt.setShadowParameters(e, t, n, r, i, a, o);
|
|
2389
1289
|
}
|
|
2390
1290
|
setBoundingBox(e) {
|
|
2391
|
-
this._boundingBoxSet = !0,
|
|
1291
|
+
this._boundingBoxSet = !0, pt.setBoundingBox(e);
|
|
2392
1292
|
}
|
|
2393
1293
|
_createShadowMaterial(t) {
|
|
2394
1294
|
let n;
|
|
2395
|
-
return n = t ===
|
|
1295
|
+
return n = t === X.EMISSIVE || t === X.UNLIT ? new C({
|
|
2396
1296
|
color: 16777215,
|
|
2397
1297
|
side: 2
|
|
2398
|
-
}) : t ===
|
|
1298
|
+
}) : t === X.SHADOW ? new g({ side: 2 }) : e.useModifiedMaterial ? this._createCustomerShadowMaterial() : new ce({
|
|
2399
1299
|
color: 16777215,
|
|
2400
1300
|
shininess: 0,
|
|
2401
1301
|
polygonOffsetFactor: 0,
|
|
@@ -2404,7 +1304,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2404
1304
|
}), n;
|
|
2405
1305
|
}
|
|
2406
1306
|
_createCustomerShadowMaterial() {
|
|
2407
|
-
return new
|
|
1307
|
+
return new pt({ side: 2 });
|
|
2408
1308
|
}
|
|
2409
1309
|
addLineOrPoint(e) {
|
|
2410
1310
|
this.addToCache(e, { visible: !1 });
|
|
@@ -2416,14 +1316,14 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2416
1316
|
e.isLight && !e.userData.shadowLightSource && this.addToCache(e, { visible: !1 });
|
|
2417
1317
|
}
|
|
2418
1318
|
_setMeshMaterialAndVisibility(e) {
|
|
2419
|
-
e.userData.isFloor ? this._setMeshShadowFloorMaterial(e) : e.material && e.receiveShadow && !Array.isArray(e.material) && !(e.material.transparent === !0 && e.material.opacity < .9) ? this._setShadowMaterialForOpaqueObject(e) :
|
|
1319
|
+
e.userData.isFloor ? this._setMeshShadowFloorMaterial(e) : e.material && e.receiveShadow && !Array.isArray(e.material) && !(e.material.transparent === !0 && e.material.opacity < .9) ? this._setShadowMaterialForOpaqueObject(e) : q(e.material, .9) ? this.addToCache(e, { visible: !1 }) : e.receiveShadow ? this.addToCache(e, {
|
|
2420
1320
|
castShadow: !1,
|
|
2421
1321
|
material: this._receiveShadowMaterial
|
|
2422
1322
|
}) : this.addToCache(e, { visible: !1 });
|
|
2423
1323
|
}
|
|
2424
1324
|
_setShadowMaterialForOpaqueObject(e) {
|
|
2425
1325
|
let t = e.material;
|
|
2426
|
-
t instanceof
|
|
1326
|
+
t instanceof h || t instanceof C ? this.addToCache(e, { material: this._unlitMaterial }) : t instanceof v ? this._setMeshShadowStandardMaterial(e, t) : this.addToCache(e, { material: e.receiveShadow ? this._shadowObjectMaterial : this._unlitMaterial });
|
|
2427
1327
|
}
|
|
2428
1328
|
_setMeshShadowStandardMaterial(e, t) {
|
|
2429
1329
|
let n = t.emissiveIntensity > 0 && (t.emissive.r > 0 || t.emissive.g > 0 || t.emissive.b > 0);
|
|
@@ -2440,7 +1340,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2440
1340
|
material: this._shadowObjectMaterial
|
|
2441
1341
|
}) : this.addToCache(e, { visible: !1 });
|
|
2442
1342
|
}
|
|
2443
|
-
},
|
|
1343
|
+
}, bt = class e {
|
|
2444
1344
|
constructor() {
|
|
2445
1345
|
this.types = new Map([
|
|
2446
1346
|
["off", e._noShadow],
|
|
@@ -2491,9 +1391,9 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2491
1391
|
switchType(t) {
|
|
2492
1392
|
return this.types.has(t) ? (this.currentConfiguration = this.types.get(t) ?? e._defaultType, !0) : !1;
|
|
2493
1393
|
}
|
|
2494
|
-
},
|
|
1394
|
+
}, xt = class {
|
|
2495
1395
|
constructor(e, t) {
|
|
2496
|
-
this._isVisibleBackup = !0, this._castShadowBackup = !0, this._shadowMapSize = t?.shadowMapSize ?? 1024, this._blurSamples = t?.blurSamples ?? 8, this._shadowLightSource = e, this._shadowLightSource.visible = !1, this._shadowLightSource.castShadow = !0, this._shadowLightSource.shadow && (this._shadowLightSource.shadow.mapSize = new
|
|
1396
|
+
this._isVisibleBackup = !0, this._castShadowBackup = !0, this._shadowMapSize = t?.shadowMapSize ?? 1024, this._blurSamples = t?.blurSamples ?? 8, this._shadowLightSource = e, this._shadowLightSource.visible = !1, this._shadowLightSource.castShadow = !0, this._shadowLightSource.shadow && (this._shadowLightSource.shadow.mapSize = new O(this._shadowMapSize, this._shadowMapSize), this._shadowLightSource.shadow.blurSamples = this._blurSamples, this._shadowLightSource.shadow.autoUpdate = !1), this._shadowLightSource.userData.shadowLightSource = this;
|
|
2497
1397
|
}
|
|
2498
1398
|
getPosition() {
|
|
2499
1399
|
return this._shadowLightSource.position;
|
|
@@ -2514,10 +1414,10 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2514
1414
|
e.remove(this._shadowLightSource);
|
|
2515
1415
|
}
|
|
2516
1416
|
updatePositionAndTarget() {
|
|
2517
|
-
this._updateShadowPositionAndTarget(this.getPosition(), new
|
|
1417
|
+
this._updateShadowPositionAndTarget(this.getPosition(), new d(0, 0, 0));
|
|
2518
1418
|
}
|
|
2519
1419
|
updateBounds(e) {
|
|
2520
|
-
if (this._shadowLightSource instanceof
|
|
1420
|
+
if (this._shadowLightSource instanceof pe) {
|
|
2521
1421
|
let t = this._shadowLightSource.shadow.camera, n = e.bounds.clone().applyMatrix4(t.matrixWorldInverse), r = Math.max(.001, Math.min(-n.min.z, -n.max.z)), i = Math.max(-n.min.z, -n.max.z), a = Math.max(Math.abs(n.min.x), Math.abs(n.max.x)), o = Math.max(Math.abs(n.min.y), Math.abs(n.max.y)), s = Math.atan2(Math.hypot(o, a) * 1.05, r);
|
|
2522
1422
|
t.aspect = 1, t.near = r, t.far = i, this._shadowLightSource.angle = s;
|
|
2523
1423
|
} else if (this._shadowLightSource.shadow) {
|
|
@@ -2532,7 +1432,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2532
1432
|
this._shadowLightSource.shadow && (this._shadowLightSource.shadow.needsUpdate = !0);
|
|
2533
1433
|
}
|
|
2534
1434
|
_updateShadowPositionAndTarget(e, t) {
|
|
2535
|
-
if (this._shadowLightSource instanceof
|
|
1435
|
+
if (this._shadowLightSource instanceof pe) {
|
|
2536
1436
|
let n = t.clone().sub(e), r = n.length();
|
|
2537
1437
|
n.normalize();
|
|
2538
1438
|
let i = t.clone().sub(n.clone().multiplyScalar(r * 4));
|
|
@@ -2548,19 +1448,19 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2548
1448
|
return [];
|
|
2549
1449
|
}
|
|
2550
1450
|
finishRenderShadow() {}
|
|
2551
|
-
},
|
|
1451
|
+
}, Z = class extends xt {
|
|
2552
1452
|
constructor(e, t) {
|
|
2553
1453
|
let n;
|
|
2554
1454
|
switch (t?.shadowLightSourceType) {
|
|
2555
1455
|
default:
|
|
2556
|
-
case
|
|
2557
|
-
n = new
|
|
1456
|
+
case gt.DIRECTION_LIGHT_SHADOW:
|
|
1457
|
+
n = new ee(16777215, 1);
|
|
2558
1458
|
break;
|
|
2559
|
-
case
|
|
2560
|
-
n = new
|
|
1459
|
+
case gt.SPOT_LIGHT_SHADOW:
|
|
1460
|
+
n = new pe(16777215, 1, 0, Math.PI / 4, 0);
|
|
2561
1461
|
break;
|
|
2562
1462
|
}
|
|
2563
|
-
n.position.copy(e.position), n.lookAt(0, 0, 0), super(n, t), this._rectAreaLight = e, this._rectAreaLight.userData.shadowLightSource = this, t?.addHelper && (this._rectLightHelper = new
|
|
1463
|
+
n.position.copy(e.position), n.lookAt(0, 0, 0), super(n, t), this._rectAreaLight = e, this._rectAreaLight.userData.shadowLightSource = this, t?.addHelper && (this._rectLightHelper = new ft(this._rectAreaLight), this._rectLightHelper.material.depthWrite = !1, this._rectAreaLight.add(this._rectLightHelper));
|
|
2564
1464
|
}
|
|
2565
1465
|
getPosition() {
|
|
2566
1466
|
return this._rectAreaLight.position;
|
|
@@ -2581,9 +1481,9 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2581
1481
|
finishRenderShadow() {
|
|
2582
1482
|
this._shadowLightSource.visible = !1, this._shadowLightSource.castShadow = this._castShadowBackup, this._rectAreaLight.visible = this._isVisibleBackup;
|
|
2583
1483
|
}
|
|
2584
|
-
},
|
|
1484
|
+
}, St = class extends xt {
|
|
2585
1485
|
constructor(e, t, n) {
|
|
2586
|
-
let r = new
|
|
1486
|
+
let r = new ee(16777215, t);
|
|
2587
1487
|
r.position.copy(e), r.lookAt(0, 0, 0), r.updateMatrix(), r.castShadow = !0, super(r, n), this._position = e.clone(), this._intensity = t;
|
|
2588
1488
|
}
|
|
2589
1489
|
getPosition() {
|
|
@@ -2599,9 +1499,9 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2599
1499
|
finishRenderShadow() {
|
|
2600
1500
|
this._shadowLightSource.castShadow = this._castShadowBackup, this._shadowLightSource.visible = !1;
|
|
2601
1501
|
}
|
|
2602
|
-
},
|
|
1502
|
+
}, Ct = class extends xt {
|
|
2603
1503
|
constructor(e, t) {
|
|
2604
|
-
let n = new
|
|
1504
|
+
let n = new ee(16777215, 1);
|
|
2605
1505
|
n.position.copy(e), n.lookAt(0, 0, 0), n.updateMatrix(), n.castShadow = !0, super(n, t), this._position = e.clone();
|
|
2606
1506
|
}
|
|
2607
1507
|
getPosition() {
|
|
@@ -2617,7 +1517,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2617
1517
|
finishRenderShadow() {
|
|
2618
1518
|
this._shadowLightSource.castShadow = this._castShadowBackup, this._shadowLightSource.visible = !1;
|
|
2619
1519
|
}
|
|
2620
|
-
},
|
|
1520
|
+
}, wt = {
|
|
2621
1521
|
name: "CopyShader",
|
|
2622
1522
|
uniforms: {
|
|
2623
1523
|
tDiffuse: { value: null },
|
|
@@ -2625,30 +1525,30 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2625
1525
|
},
|
|
2626
1526
|
vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
|
|
2627
1527
|
fragmentShader: "\n\n uniform float opacity;\n\n uniform sampler2D tDiffuse;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 texel = texture2D( tDiffuse, vUv );\n gl_FragColor = opacity * texel;\n\n\n }"
|
|
2628
|
-
},
|
|
1528
|
+
}, Tt = {
|
|
2629
1529
|
name: "FXAAShader",
|
|
2630
1530
|
uniforms: {
|
|
2631
1531
|
tDiffuse: { value: null },
|
|
2632
|
-
resolution: { value: new
|
|
1532
|
+
resolution: { value: new O(1 / 1024, 1 / 512) }
|
|
2633
1533
|
},
|
|
2634
1534
|
vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
|
|
2635
1535
|
fragmentShader: "\n\n uniform sampler2D tDiffuse;\n uniform vec2 resolution;\n varying vec2 vUv;\n\n #define EDGE_STEP_COUNT 6\n #define EDGE_GUESS 8.0\n #define EDGE_STEPS 1.0, 1.5, 2.0, 2.0, 2.0, 4.0\n const float edgeSteps[EDGE_STEP_COUNT] = float[EDGE_STEP_COUNT]( EDGE_STEPS );\n\n float _ContrastThreshold = 0.0312;\n float _RelativeThreshold = 0.063;\n float _SubpixelBlending = 1.0;\n\n vec4 Sample( sampler2D tex2D, vec2 uv ) {\n\n return texture( tex2D, uv );\n\n }\n\n float SampleLuminance( sampler2D tex2D, vec2 uv ) {\n\n return dot( Sample( tex2D, uv ).rgb, vec3( 0.3, 0.59, 0.11 ) );\n\n }\n\n float SampleLuminance( sampler2D tex2D, vec2 texSize, vec2 uv, float uOffset, float vOffset ) {\n\n uv += texSize * vec2(uOffset, vOffset);\n return SampleLuminance(tex2D, uv);\n\n }\n\n struct LuminanceData {\n\n float m, n, e, s, w;\n float ne, nw, se, sw;\n float highest, lowest, contrast;\n\n };\n\n LuminanceData SampleLuminanceNeighborhood( sampler2D tex2D, vec2 texSize, vec2 uv ) {\n\n LuminanceData l;\n l.m = SampleLuminance( tex2D, uv );\n l.n = SampleLuminance( tex2D, texSize, uv, 0.0, 1.0 );\n l.e = SampleLuminance( tex2D, texSize, uv, 1.0, 0.0 );\n l.s = SampleLuminance( tex2D, texSize, uv, 0.0, -1.0 );\n l.w = SampleLuminance( tex2D, texSize, uv, -1.0, 0.0 );\n\n l.ne = SampleLuminance( tex2D, texSize, uv, 1.0, 1.0 );\n l.nw = SampleLuminance( tex2D, texSize, uv, -1.0, 1.0 );\n l.se = SampleLuminance( tex2D, texSize, uv, 1.0, -1.0 );\n l.sw = SampleLuminance( tex2D, texSize, uv, -1.0, -1.0 );\n\n l.highest = max( max( max( max( l.n, l.e ), l.s ), l.w ), l.m );\n l.lowest = min( min( min( min( l.n, l.e ), l.s ), l.w ), l.m );\n l.contrast = l.highest - l.lowest;\n return l;\n\n }\n\n bool ShouldSkipPixel( LuminanceData l ) {\n\n float threshold = max( _ContrastThreshold, _RelativeThreshold * l.highest );\n return l.contrast < threshold;\n\n }\n\n float DeterminePixelBlendFactor( LuminanceData l ) {\n\n float f = 2.0 * ( l.n + l.e + l.s + l.w );\n f += l.ne + l.nw + l.se + l.sw;\n f *= 1.0 / 12.0;\n f = abs( f - l.m );\n f = clamp( f / l.contrast, 0.0, 1.0 );\n\n float blendFactor = smoothstep( 0.0, 1.0, f );\n return blendFactor * blendFactor * _SubpixelBlending;\n\n }\n\n struct EdgeData {\n\n bool isHorizontal;\n float pixelStep;\n float oppositeLuminance, gradient;\n\n };\n\n EdgeData DetermineEdge( vec2 texSize, LuminanceData l ) {\n\n EdgeData e;\n float horizontal =\n abs( l.n + l.s - 2.0 * l.m ) * 2.0 +\n abs( l.ne + l.se - 2.0 * l.e ) +\n abs( l.nw + l.sw - 2.0 * l.w );\n float vertical =\n abs( l.e + l.w - 2.0 * l.m ) * 2.0 +\n abs( l.ne + l.nw - 2.0 * l.n ) +\n abs( l.se + l.sw - 2.0 * l.s );\n e.isHorizontal = horizontal >= vertical;\n\n float pLuminance = e.isHorizontal ? l.n : l.e;\n float nLuminance = e.isHorizontal ? l.s : l.w;\n float pGradient = abs( pLuminance - l.m );\n float nGradient = abs( nLuminance - l.m );\n\n e.pixelStep = e.isHorizontal ? texSize.y : texSize.x;\n\n if (pGradient < nGradient) {\n\n e.pixelStep = -e.pixelStep;\n e.oppositeLuminance = nLuminance;\n e.gradient = nGradient;\n\n } else {\n\n e.oppositeLuminance = pLuminance;\n e.gradient = pGradient;\n\n }\n\n return e;\n\n }\n\n float DetermineEdgeBlendFactor( sampler2D tex2D, vec2 texSize, LuminanceData l, EdgeData e, vec2 uv ) {\n\n vec2 uvEdge = uv;\n vec2 edgeStep;\n if (e.isHorizontal) {\n\n uvEdge.y += e.pixelStep * 0.5;\n edgeStep = vec2( texSize.x, 0.0 );\n\n } else {\n\n uvEdge.x += e.pixelStep * 0.5;\n edgeStep = vec2( 0.0, texSize.y );\n\n }\n\n float edgeLuminance = ( l.m + e.oppositeLuminance ) * 0.5;\n float gradientThreshold = e.gradient * 0.25;\n\n vec2 puv = uvEdge + edgeStep * edgeSteps[0];\n float pLuminanceDelta = SampleLuminance( tex2D, puv ) - edgeLuminance;\n bool pAtEnd = abs( pLuminanceDelta ) >= gradientThreshold;\n\n for ( int i = 1; i < EDGE_STEP_COUNT && !pAtEnd; i++ ) {\n\n puv += edgeStep * edgeSteps[i];\n pLuminanceDelta = SampleLuminance( tex2D, puv ) - edgeLuminance;\n pAtEnd = abs( pLuminanceDelta ) >= gradientThreshold;\n\n }\n\n if ( !pAtEnd ) {\n\n puv += edgeStep * EDGE_GUESS;\n\n }\n\n vec2 nuv = uvEdge - edgeStep * edgeSteps[0];\n float nLuminanceDelta = SampleLuminance( tex2D, nuv ) - edgeLuminance;\n bool nAtEnd = abs( nLuminanceDelta ) >= gradientThreshold;\n\n for ( int i = 1; i < EDGE_STEP_COUNT && !nAtEnd; i++ ) {\n\n nuv -= edgeStep * edgeSteps[i];\n nLuminanceDelta = SampleLuminance( tex2D, nuv ) - edgeLuminance;\n nAtEnd = abs( nLuminanceDelta ) >= gradientThreshold;\n\n }\n\n if ( !nAtEnd ) {\n\n nuv -= edgeStep * EDGE_GUESS;\n\n }\n\n float pDistance, nDistance;\n if ( e.isHorizontal ) {\n\n pDistance = puv.x - uv.x;\n nDistance = uv.x - nuv.x;\n\n } else {\n\n pDistance = puv.y - uv.y;\n nDistance = uv.y - nuv.y;\n\n }\n\n float shortestDistance;\n bool deltaSign;\n if ( pDistance <= nDistance ) {\n\n shortestDistance = pDistance;\n deltaSign = pLuminanceDelta >= 0.0;\n\n } else {\n\n shortestDistance = nDistance;\n deltaSign = nLuminanceDelta >= 0.0;\n\n }\n\n if ( deltaSign == ( l.m - edgeLuminance >= 0.0 ) ) {\n\n return 0.0;\n\n }\n\n return 0.5 - shortestDistance / ( pDistance + nDistance );\n\n }\n\n vec4 ApplyFXAA( sampler2D tex2D, vec2 texSize, vec2 uv ) {\n\n LuminanceData luminance = SampleLuminanceNeighborhood( tex2D, texSize, uv );\n if ( ShouldSkipPixel( luminance ) ) {\n\n return Sample( tex2D, uv );\n\n }\n\n float pixelBlend = DeterminePixelBlendFactor( luminance );\n EdgeData edge = DetermineEdge( texSize, luminance );\n float edgeBlend = DetermineEdgeBlendFactor( tex2D, texSize, luminance, edge, uv );\n float finalBlend = max( pixelBlend, edgeBlend );\n\n if (edge.isHorizontal) {\n\n uv.y += edge.pixelStep * finalBlend;\n\n } else {\n\n uv.x += edge.pixelStep * finalBlend;\n\n }\n\n return Sample( tex2D, uv );\n\n }\n\n void main() {\n\n gl_FragColor = ApplyFXAA( tDiffuse, resolution.xy, vUv );\n\n }"
|
|
2636
|
-
},
|
|
1536
|
+
}, Et = class e extends V {
|
|
2637
1537
|
static {
|
|
2638
|
-
this.BlurDirectionX = new
|
|
1538
|
+
this.BlurDirectionX = new O(1, 0);
|
|
2639
1539
|
}
|
|
2640
1540
|
static {
|
|
2641
|
-
this.BlurDirectionY = new
|
|
1541
|
+
this.BlurDirectionY = new O(0, 1);
|
|
2642
1542
|
}
|
|
2643
1543
|
static {
|
|
2644
1544
|
this.highlightLines = !0;
|
|
2645
1545
|
}
|
|
2646
1546
|
constructor(e, t, n, r, a, o) {
|
|
2647
|
-
super(e), this.patternTexture = null, this.clearBackground = !1, this.renderScene = n, this.renderCamera = r, this.selectedObjects = a === void 0 ? [] : a, this.visibleEdgeColor = new
|
|
1547
|
+
super(e), this.patternTexture = null, this.clearBackground = !1, this.renderScene = n, this.renderCamera = r, this.selectedObjects = a === void 0 ? [] : a, this.visibleEdgeColor = new D(1, 1, 1), this.hiddenEdgeColor = new D(.1, .04, .02), this.edgeGlow = 0, this.usePatternTexture = !1, this.edgeThickness = 1, this.edgeStrength = 3, this.downSampleRatio = o?.downSampleRatio || 2, this.pulsePeriod = 0, this.edgeDetectionFxaa = o?.edgeDetectionFxaa || !1, this._visibilityCache = /* @__PURE__ */ new Map(), this.resolution = t === void 0 ? new O(256, 256) : new O(t.x, t.y);
|
|
2648
1548
|
let s = Math.round(this.resolution.x / this.downSampleRatio), c = Math.round(this.resolution.y / this.downSampleRatio);
|
|
2649
|
-
this.renderTargetMaskBuffer = new i(this.resolution.x, this.resolution.y), this.renderTargetMaskBuffer.texture.name = "OutlinePass.mask", this.renderTargetMaskBuffer.texture.generateMipmaps = !1, this.prepareMaskMaterial = this._getPrepareMaskMaterial(this.gBufferTextures?.isFloatGBufferWithRgbNormalAlphaDepth), this.prepareMaskMaterial.side = 2, this.prepareMaskMaterial.fragmentShader = u(this.prepareMaskMaterial.fragmentShader, this.renderCamera), this.edgeDetectionFxaa && (this.fxaaRenderMaterial = new
|
|
2650
|
-
let l =
|
|
2651
|
-
this.copyUniforms =
|
|
1549
|
+
this.renderTargetMaskBuffer = new i(this.resolution.x, this.resolution.y), this.renderTargetMaskBuffer.texture.name = "OutlinePass.mask", this.renderTargetMaskBuffer.texture.generateMipmaps = !1, this.prepareMaskMaterial = this._getPrepareMaskMaterial(this.gBufferTextures?.isFloatGBufferWithRgbNormalAlphaDepth), this.prepareMaskMaterial.side = 2, this.prepareMaskMaterial.fragmentShader = u(this.prepareMaskMaterial.fragmentShader, this.renderCamera), this.edgeDetectionFxaa && (this.fxaaRenderMaterial = new p(Tt), this.fxaaRenderMaterial.uniforms.tDiffuse.value = this.renderTargetMaskBuffer.texture, this.fxaaRenderMaterial.uniforms.resolution.value.set(1 / this.resolution.x, 1 / this.resolution.y), this.renderTargetFxaaBuffer = new i(this.resolution.x, this.resolution.y), this.renderTargetFxaaBuffer.texture.name = "OutlinePass.fxaa", this.renderTargetFxaaBuffer.texture.generateMipmaps = !1), this.renderTargetMaskDownSampleBuffer = new i(s, c), this.renderTargetMaskDownSampleBuffer.texture.name = "OutlinePass.depthDownSample", this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = !1, this.renderTargetBlurBuffer1 = new i(s, c), this.renderTargetBlurBuffer1.texture.name = "OutlinePass.blur1", this.renderTargetBlurBuffer1.texture.generateMipmaps = !1, this.renderTargetBlurBuffer2 = new i(Math.round(s / 2), Math.round(c / 2)), this.renderTargetBlurBuffer2.texture.name = "OutlinePass.blur2", this.renderTargetBlurBuffer2.texture.generateMipmaps = !1, this.edgeDetectionMaterial = this._getEdgeDetectionMaterial(), this.renderTargetEdgeBuffer1 = new i(s, c), this.renderTargetEdgeBuffer1.texture.name = "OutlinePass.edge1", this.renderTargetEdgeBuffer1.texture.generateMipmaps = !1, this.renderTargetEdgeBuffer2 = new i(Math.round(s / 2), Math.round(c / 2)), this.renderTargetEdgeBuffer2.texture.name = "OutlinePass.edge2", this.renderTargetEdgeBuffer2.texture.generateMipmaps = !1, this.separableBlurMaterial1 = this._getSeperableBlurMaterial(4), this.separableBlurMaterial1.uniforms.texSize.value.set(s, c), this.separableBlurMaterial1.uniforms.kernelRadius.value = 1, this.separableBlurMaterial2 = this._getSeperableBlurMaterial(4), this.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(s / 2), Math.round(c / 2)), this.separableBlurMaterial2.uniforms.kernelRadius.value = 4, this.overlayMaterial = this._getOverlayMaterial();
|
|
1550
|
+
let l = wt;
|
|
1551
|
+
this.copyUniforms = S.clone(l.uniforms), this.copyUniforms.opacity.value = 1, this.materialCopy = new p({
|
|
2652
1552
|
uniforms: this.copyUniforms,
|
|
2653
1553
|
vertexShader: l.vertexShader,
|
|
2654
1554
|
fragmentShader: l.fragmentShader,
|
|
@@ -2656,7 +1556,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2656
1556
|
depthTest: !1,
|
|
2657
1557
|
depthWrite: !1,
|
|
2658
1558
|
transparent: !0
|
|
2659
|
-
}), this.enabled = !0, this.needsSwap = !1, this.oldClearColor = new
|
|
1559
|
+
}), this.enabled = !0, this.needsSwap = !1, this.oldClearColor = new D(), this.oldClearAlpha = 1, this.fsQuad = new I(void 0), this.tempPulseColor1 = new D(), this.tempPulseColor2 = new D(), this.textureMatrix = new E();
|
|
2660
1560
|
function u(e, t) {
|
|
2661
1561
|
let n = t.isPerspectiveCamera ? "perspective" : "orthographic";
|
|
2662
1562
|
return e.replace(/DEPTH_TO_VIEW_Z/g, n + "DepthToViewZ");
|
|
@@ -2715,10 +1615,10 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2715
1615
|
this.render(e, null, null, 0, !1);
|
|
2716
1616
|
}
|
|
2717
1617
|
_getPrepareMaskMaterial(e) {
|
|
2718
|
-
return new
|
|
1618
|
+
return new p({
|
|
2719
1619
|
uniforms: {
|
|
2720
1620
|
depthTexture: { value: null },
|
|
2721
|
-
cameraNearFar: { value: new
|
|
1621
|
+
cameraNearFar: { value: new O(.5, .5) },
|
|
2722
1622
|
textureMatrix: { value: null }
|
|
2723
1623
|
},
|
|
2724
1624
|
defines: { FLOAT_ALPHA_DEPTH: e ? 1 : 0 },
|
|
@@ -2727,24 +1627,24 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2727
1627
|
});
|
|
2728
1628
|
}
|
|
2729
1629
|
_getEdgeDetectionMaterial() {
|
|
2730
|
-
return new
|
|
1630
|
+
return new p({
|
|
2731
1631
|
uniforms: {
|
|
2732
1632
|
maskTexture: { value: null },
|
|
2733
|
-
texSize: { value: new
|
|
2734
|
-
visibleEdgeColor: { value: new
|
|
2735
|
-
hiddenEdgeColor: { value: new
|
|
1633
|
+
texSize: { value: new O(.5, .5) },
|
|
1634
|
+
visibleEdgeColor: { value: new d(1, 1, 1) },
|
|
1635
|
+
hiddenEdgeColor: { value: new d(1, 1, 1) }
|
|
2736
1636
|
},
|
|
2737
1637
|
vertexShader: "varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
2738
1638
|
fragmentShader: "varying vec2 vUv;\n\n uniform sampler2D maskTexture;\n uniform vec2 texSize;\n uniform vec3 visibleEdgeColor;\n uniform vec3 hiddenEdgeColor;\n\n void main() {\n vec2 invSize = 1.0 / texSize;\n vec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n vec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n vec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n vec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n vec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n float diff1 = (c1.r - c2.r)*0.5;\n float diff2 = (c3.r - c4.r)*0.5;\n float d = length( vec2(diff1, diff2) );\n float a1 = min(c1.g, c2.g);\n float a2 = min(c3.g, c4.g);\n float visibilityFactor = min(a1, a2);\n vec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n gl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n }"
|
|
2739
1639
|
});
|
|
2740
1640
|
}
|
|
2741
1641
|
_getSeperableBlurMaterial(e) {
|
|
2742
|
-
return new
|
|
1642
|
+
return new p({
|
|
2743
1643
|
defines: { MAX_RADIUS: e },
|
|
2744
1644
|
uniforms: {
|
|
2745
1645
|
colorTexture: { value: null },
|
|
2746
|
-
texSize: { value: new
|
|
2747
|
-
direction: { value: new
|
|
1646
|
+
texSize: { value: new O(.5, .5) },
|
|
1647
|
+
direction: { value: new O(.5, .5) },
|
|
2748
1648
|
kernelRadius: { value: 1 }
|
|
2749
1649
|
},
|
|
2750
1650
|
vertexShader: "varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
@@ -2752,7 +1652,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2752
1652
|
});
|
|
2753
1653
|
}
|
|
2754
1654
|
_getOverlayMaterial() {
|
|
2755
|
-
return new
|
|
1655
|
+
return new p({
|
|
2756
1656
|
uniforms: {
|
|
2757
1657
|
maskTexture: { value: null },
|
|
2758
1658
|
edgeTexture1: { value: null },
|
|
@@ -2770,16 +1670,16 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2770
1670
|
transparent: !0
|
|
2771
1671
|
});
|
|
2772
1672
|
}
|
|
2773
|
-
},
|
|
1673
|
+
}, Dt = {
|
|
2774
1674
|
uniforms: { tDiffuse: { value: null } },
|
|
2775
1675
|
vertexShader: "\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",
|
|
2776
1676
|
fragmentShader: "\n uniform highp sampler2D tDiffuse;\n varying vec2 vUv;\n\n void main() {\n vec4 textureColor = texture2D(tDiffuse, vUv);\n float aoPassDepth = dot(textureColor.wz, vec2(1.0/1024.0));\n gl_FragColor = vec4(vec3(aoPassDepth * aoPassDepth), 1.0);\n }"
|
|
2777
|
-
},
|
|
1677
|
+
}, Ot = class extends p {
|
|
2778
1678
|
constructor(e) {
|
|
2779
1679
|
super({
|
|
2780
|
-
uniforms:
|
|
2781
|
-
vertexShader:
|
|
2782
|
-
fragmentShader:
|
|
1680
|
+
uniforms: S.clone(Dt.uniforms),
|
|
1681
|
+
vertexShader: Dt.vertexShader,
|
|
1682
|
+
fragmentShader: Dt.fragmentShader,
|
|
2783
1683
|
transparent: !0,
|
|
2784
1684
|
depthTest: !1,
|
|
2785
1685
|
depthWrite: !1,
|
|
@@ -2789,27 +1689,27 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2789
1689
|
blendSrcAlpha: 206,
|
|
2790
1690
|
blendDstAlpha: 200,
|
|
2791
1691
|
blendEquationAlpha: 100
|
|
2792
|
-
}), this._intensity = new
|
|
1692
|
+
}), this._intensity = new O(1, 1), this.update(e);
|
|
2793
1693
|
}
|
|
2794
1694
|
update(e) {
|
|
2795
1695
|
return e?.texture !== void 0 && (this.uniforms.tDiffuse.value = e.texture), e?.blending !== void 0 && (this.blending = e.blending), this;
|
|
2796
1696
|
}
|
|
2797
|
-
},
|
|
1697
|
+
}, kt = (e) => new O(Math.atan2(e.y, e.x) / (2 * Math.PI) + .5, Math.asin(e.z) / Math.PI + .5), At = class {
|
|
2798
1698
|
get colorRenderTarget() {
|
|
2799
1699
|
return this._colorRenderTarget = this._colorRenderTarget ?? new i(), this._colorRenderTarget;
|
|
2800
1700
|
}
|
|
2801
1701
|
environmentMapDecodeTarget(e) {
|
|
2802
|
-
let t = e instanceof
|
|
1702
|
+
let t = e instanceof be && e.capabilities.isWebGL2 ? x : w;
|
|
2803
1703
|
return this._environmentMapDecodeTarget = this._environmentMapDecodeTarget ?? new i(1, 1, { type: t }), this._environmentMapDecodeTarget;
|
|
2804
1704
|
}
|
|
2805
1705
|
environmentMapDecodeMaterial(e) {
|
|
2806
|
-
return e ? (this._equirectangularDecodeMaterial = this._equirectangularDecodeMaterial ?? new
|
|
1706
|
+
return e ? (this._equirectangularDecodeMaterial = this._equirectangularDecodeMaterial ?? new Q(!0, !1), this._equirectangularDecodeMaterial) : (this._pmremDecodeMaterial = this._pmremDecodeMaterial ?? new Q(!1, !1), this._pmremDecodeMaterial);
|
|
2807
1707
|
}
|
|
2808
1708
|
get camera() {
|
|
2809
1709
|
return this._camera = this._camera ?? new a(-1, 1, 1, -1, -1, 1), this._camera;
|
|
2810
1710
|
}
|
|
2811
1711
|
scaleTexture(e, n, r, i) {
|
|
2812
|
-
this.colorRenderTarget.setSize(r, i), this._planeMesh = this._planeMesh ?? new
|
|
1712
|
+
this.colorRenderTarget.setSize(r, i), this._planeMesh = this._planeMesh ?? new b(new t(2, 2), new C({ map: n }));
|
|
2813
1713
|
let a = e.getRenderTarget();
|
|
2814
1714
|
e.setRenderTarget(this.colorRenderTarget), e.render(this._planeMesh, this.camera), e.setRenderTarget(a);
|
|
2815
1715
|
let o = this.environmentMapDecodeTarget(e).texture, s = new Uint8Array(r * i * 4);
|
|
@@ -2821,26 +1721,26 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2821
1721
|
}
|
|
2822
1722
|
newGrayscaleTexture(e, n, r, i) {
|
|
2823
1723
|
let a = this.environmentMapDecodeMaterial(n.name === "PMREM.cubeUv"), o = this.environmentMapDecodeTarget(e);
|
|
2824
|
-
o.setSize(r, i), a.setSourceTexture(n), this._planeMesh = this._planeMesh ?? new
|
|
1724
|
+
o.setSize(r, i), a.setSourceTexture(n), this._planeMesh = this._planeMesh ?? new b(new t(2, 2), a);
|
|
2825
1725
|
let s = e.getRenderTarget();
|
|
2826
1726
|
e.setRenderTarget(o), e.render(this._planeMesh, this.camera), e.setRenderTarget(s);
|
|
2827
|
-
let c = o.texture, l = o.texture.type ===
|
|
1727
|
+
let c = o.texture, l = o.texture.type === x, u = l ? new Float32Array(r * i * 4) : new Uint8Array(r * i * 4);
|
|
2828
1728
|
return e.readRenderTargetPixels(o, 0, 0, r, i, u), {
|
|
2829
1729
|
texture: c,
|
|
2830
1730
|
pixels: u,
|
|
2831
1731
|
sRgbaPixels: l
|
|
2832
1732
|
};
|
|
2833
1733
|
}
|
|
2834
|
-
},
|
|
1734
|
+
}, jt = {
|
|
2835
1735
|
uniforms: { tDiffuse: { value: null } },
|
|
2836
1736
|
vertexShader: "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",
|
|
2837
1737
|
fragmentShader: "\n uniform sampler2D tDiffuse;\n varying vec2 vUv;\n\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x ); // pos x\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z\n }\n return 0.5 * ( uv + 1.0 );\n }\n\n void main() {\n #if PMREM_DECODE == 1\n float altitude = (vUv.y - 0.5) * 3.141593;\n float azimuth = vUv.x * 2.0 * 3.141593;\n vec3 direction = vec3(\n cos(altitude) * cos(azimuth) * -1.0,\n sin(altitude),\n cos(altitude) * sin(azimuth) * -1.0\n );\n float face = getFace(direction);\n vec2 uv = getUV(direction, face) / vec2(3.0, 4.0);\n if (face > 2.5) {\n uv.y += 0.25;\n face -= 3.0;\n }\n uv.x += face / 3.0;\n vec4 color = texture2D(tDiffuse, uv);\n #else\n vec4 color = texture2D(tDiffuse, vUv);\n #endif\n #if GRAYSCALE_CONVERT == 1\n float grayscale = dot(color.rgb, vec3(0.2126, 0.7152, 0.0722));\n //float grayscale = dot(color.rgb, vec3(1.0/3.0));\n gl_FragColor = vec4(vec3(grayscale), 1.0);\n #else\n gl_FragColor = vec4(color.rgb, 1.0);\n #endif\n }"
|
|
2838
|
-
},
|
|
1738
|
+
}, Q = class extends p {
|
|
2839
1739
|
constructor(e, t) {
|
|
2840
1740
|
super({
|
|
2841
|
-
uniforms:
|
|
2842
|
-
vertexShader:
|
|
2843
|
-
fragmentShader:
|
|
1741
|
+
uniforms: S.clone(jt.uniforms),
|
|
1742
|
+
vertexShader: jt.vertexShader,
|
|
1743
|
+
fragmentShader: jt.fragmentShader,
|
|
2844
1744
|
defines: {
|
|
2845
1745
|
PMREM_DECODE: e ? 1 : 0,
|
|
2846
1746
|
GRAYSCALE_CONVERT: t ? 1 : 0
|
|
@@ -2850,30 +1750,30 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2850
1750
|
setSourceTexture(e) {
|
|
2851
1751
|
this.uniforms.tDiffuse.value = e;
|
|
2852
1752
|
}
|
|
2853
|
-
},
|
|
1753
|
+
}, Mt = class {
|
|
2854
1754
|
constructor(e) {
|
|
2855
1755
|
this.samplePoints = [], this.sampleUVs = [], this.grayscaleTexture = {
|
|
2856
|
-
texture: new
|
|
1756
|
+
texture: new me(),
|
|
2857
1757
|
pixels: new Uint8Array(),
|
|
2858
1758
|
sRgbaPixels: !1
|
|
2859
|
-
}, this.detectorTexture = new
|
|
1759
|
+
}, this.detectorTexture = new me(), this.detectorArray = new Float32Array(), this.lightSamples = [], this.lightGraph = new Pt(0), this.lightSources = [], this._grayScale = new d(.2126, .7152, .0722), this._createEquirectangularSamplePoints = (e) => {
|
|
2860
1760
|
let t = [];
|
|
2861
1761
|
for (let n = 0; n < e; n++) {
|
|
2862
1762
|
let r = n * Math.PI * (3 - Math.sqrt(5)), i = 1 - n / (e - 1) * 2, a = Math.sqrt(1 - i * i), o = Math.cos(r) * a, s = Math.sin(r) * a;
|
|
2863
|
-
t.push(new
|
|
1763
|
+
t.push(new d(o, s, i));
|
|
2864
1764
|
}
|
|
2865
1765
|
return t;
|
|
2866
|
-
}, this._numberOfSamples = e?.numberOfSamples ?? 1e3, this._width = e?.width ?? 1024, this._height = e?.height ?? 512, this._sampleThreshold = e?.sampleThreshold ?? .707, this.pointDistance = Math.sqrt(4 * Math.PI) / Math.sqrt(this._numberOfSamples), this.pixelDistance = Math.sqrt(2) * Math.PI * 2 / this._width, this.samplePoints = this._createEquirectangularSamplePoints(this._numberOfSamples), this.sampleUVs = this.samplePoints.map((e) =>
|
|
1766
|
+
}, this._numberOfSamples = e?.numberOfSamples ?? 1e3, this._width = e?.width ?? 1024, this._height = e?.height ?? 512, this._sampleThreshold = e?.sampleThreshold ?? .707, this.pointDistance = Math.sqrt(4 * Math.PI) / Math.sqrt(this._numberOfSamples), this.pixelDistance = Math.sqrt(2) * Math.PI * 2 / this._width, this.samplePoints = this._createEquirectangularSamplePoints(this._numberOfSamples), this.sampleUVs = this.samplePoints.map((e) => kt(e));
|
|
2867
1767
|
}
|
|
2868
1768
|
detectLightSources(e, t) {
|
|
2869
|
-
this._textureConverter = this._textureConverter ?? new
|
|
1769
|
+
this._textureConverter = this._textureConverter ?? new At(), this.grayscaleTexture = this._textureConverter.newGrayscaleTexture(e, t, this._width, this._height), this.detectorArray = this._redFromRgbaToNormalizedFloatArray(this.grayscaleTexture.pixels, this.grayscaleTexture.sRgbaPixels), this.detectorTexture = this._grayscaleTextureFromFloatArray(this.detectorArray, this._width, this._height), this.lightSamples = this._filterLightSamples(this._sampleThreshold), this.lightGraph = this._findClusterSegments(this.lightSamples, this._sampleThreshold), this.lightGraph.findConnectedComponents(), this.lightSources = this.createLightSourcesFromLightGraph(this.lightSamples, this.lightGraph), this.lightSources.sort((e, t) => t.maxIntensity - e.maxIntensity);
|
|
2870
1770
|
}
|
|
2871
1771
|
_redFromRgbaToNormalizedFloatArray(e, t, n) {
|
|
2872
1772
|
let r = new Float32Array(e.length / 4), i = 1, a = 0;
|
|
2873
1773
|
for (let t = 0; t < e.length / 4; ++t) {
|
|
2874
|
-
let n = new
|
|
1774
|
+
let n = new D(...e.slice(t * 4, t * 4 + 3));
|
|
2875
1775
|
e instanceof Float32Array && n.convertSRGBToLinear();
|
|
2876
|
-
let o = new
|
|
1776
|
+
let o = new d(n.r, n.g, n.b).dot(this._grayScale);
|
|
2877
1777
|
i = Math.min(i, o), a = Math.max(a, o), r[t] = o;
|
|
2878
1778
|
}
|
|
2879
1779
|
if (n) for (let e = 0; e < r.length; ++e) r[e] = (t ? r[e] : (r[e] - i) / (a - i)) ** +n;
|
|
@@ -2886,14 +1786,14 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2886
1786
|
let n = e[t] * 255;
|
|
2887
1787
|
i[t * 4 + 0] = n, i[t * 4 + 1] = n, i[t * 4 + 2] = n, i[t * 4 + 3] = 255;
|
|
2888
1788
|
}
|
|
2889
|
-
let a = new
|
|
1789
|
+
let a = new m(i, t, n);
|
|
2890
1790
|
return a.needsUpdate = !0, a;
|
|
2891
1791
|
}
|
|
2892
1792
|
_filterLightSamples(e) {
|
|
2893
1793
|
let t = [];
|
|
2894
1794
|
for (let n = 0; n < this.sampleUVs.length; n++) {
|
|
2895
1795
|
let r = this.sampleUVs[n];
|
|
2896
|
-
this._detectorTextureLuminanceValueFromUV(r) > e && t.push(new
|
|
1796
|
+
this._detectorTextureLuminanceValueFromUV(r) > e && t.push(new Nt(this.samplePoints[n], r));
|
|
2897
1797
|
}
|
|
2898
1798
|
return t;
|
|
2899
1799
|
}
|
|
@@ -2905,11 +1805,11 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2905
1805
|
return this._detectorTextureLuminanceValueFromUV(e) * 256;
|
|
2906
1806
|
}
|
|
2907
1807
|
_findClusterSegments(e, t) {
|
|
2908
|
-
let n = this.pixelDistance * 2, r = this.pointDistance * 1.5, i = new
|
|
1808
|
+
let n = this.pixelDistance * 2, r = this.pointDistance * 1.5, i = new Pt(e.length);
|
|
2909
1809
|
for (let a = 0; a < e.length; a++) for (let o = a + 1; o < e.length; o++) if (e[a].position.angleTo(e[o].position) < r) {
|
|
2910
1810
|
let r = e[o].position.clone().sub(e[a].position), s = Math.floor(r.length() / n), c = !0, l = 0;
|
|
2911
1811
|
for (let n = 1; n < s; n++) {
|
|
2912
|
-
let i = r.clone().multiplyScalar(n / s), o =
|
|
1812
|
+
let i = r.clone().multiplyScalar(n / s), o = kt(e[a].position.clone().add(i).normalize());
|
|
2913
1813
|
if (this._detectorTextureLuminanceValueFromUV(o) < t) {
|
|
2914
1814
|
if (l++, l > 1) {
|
|
2915
1815
|
c = !1;
|
|
@@ -2922,14 +1822,14 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2922
1822
|
return i;
|
|
2923
1823
|
}
|
|
2924
1824
|
createLightSourcesFromLightGraph(e, t) {
|
|
2925
|
-
let n = t.components.filter((e) => e.length > 1).map((t) => new
|
|
1825
|
+
let n = t.components.filter((e) => e.length > 1).map((t) => new Ft(t.map((t) => e[t])));
|
|
2926
1826
|
return n.forEach((e) => e.calculateLightSourceProperties((e) => this._originalLuminanceValueFromUV(e))), n;
|
|
2927
1827
|
}
|
|
2928
|
-
},
|
|
1828
|
+
}, Nt = class {
|
|
2929
1829
|
constructor(e, t) {
|
|
2930
1830
|
this.position = e, this.uv = t;
|
|
2931
1831
|
}
|
|
2932
|
-
},
|
|
1832
|
+
}, Pt = class {
|
|
2933
1833
|
constructor(e) {
|
|
2934
1834
|
this.edges = [], this.adjacent = [], this.components = [], this.noOfNodes = e;
|
|
2935
1835
|
for (let t = 0; t < e; t++) this.adjacent.push([]);
|
|
@@ -2947,43 +1847,43 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2947
1847
|
t[e] = !0, n.push(e);
|
|
2948
1848
|
for (let r of this.adjacent[e]) t[r] || this._dfs(r, t, n);
|
|
2949
1849
|
}
|
|
2950
|
-
},
|
|
1850
|
+
}, Ft = class {
|
|
2951
1851
|
constructor(e) {
|
|
2952
|
-
this.position = new
|
|
1852
|
+
this.position = new d(), this.uv = new O(), this.averageIntensity = 0, this.maxIntensity = 0, this.size = 0, this.lightSamples = e;
|
|
2953
1853
|
}
|
|
2954
1854
|
calculateLightSourceProperties(e) {
|
|
2955
|
-
this.position = new
|
|
1855
|
+
this.position = new d(), this.averageIntensity = 0, this.maxIntensity = 0;
|
|
2956
1856
|
for (let t of this.lightSamples) {
|
|
2957
1857
|
this.position.add(t.position);
|
|
2958
1858
|
let n = e(t.uv);
|
|
2959
1859
|
this.averageIntensity += n, this.maxIntensity = Math.max(this.maxIntensity, n);
|
|
2960
1860
|
}
|
|
2961
|
-
this.averageIntensity /= this.lightSamples.length, this.position.normalize(), this.uv =
|
|
1861
|
+
this.averageIntensity /= this.lightSamples.length, this.position.normalize(), this.uv = kt(this.position);
|
|
2962
1862
|
let t = 0;
|
|
2963
1863
|
for (let e of this.lightSamples) t += e.position.distanceTo(this.position);
|
|
2964
1864
|
t /= this.lightSamples.length, this.size = t / Math.PI;
|
|
2965
1865
|
}
|
|
2966
|
-
},
|
|
1866
|
+
}, It = class extends V {
|
|
2967
1867
|
constructor(e) {
|
|
2968
|
-
super(e), this.debugOutput = "", this._environmentMapDecodeMaterial = new
|
|
1868
|
+
super(e), this.debugOutput = "", this._environmentMapDecodeMaterial = new Q(!0, !1), this._environmentMapDecodeMaterial.blending = 0, this._environmentMapDecodeMaterial.depthTest = !1;
|
|
2969
1869
|
}
|
|
2970
1870
|
dispose() {
|
|
2971
1871
|
this._depthRenderMaterial?.dispose(), this._copyMaterial?.dispose(), this._srgbToLinearCopyMaterial?.dispose();
|
|
2972
1872
|
}
|
|
2973
1873
|
getCopyMaterial(e) {
|
|
2974
|
-
return this._copyMaterial = this._copyMaterial ?? new
|
|
1874
|
+
return this._copyMaterial = this._copyMaterial ?? new M(), this._copyMaterial.update(e);
|
|
2975
1875
|
}
|
|
2976
1876
|
getBlendAoAndShadowMaterial(e) {
|
|
2977
|
-
return this._blendAoAndShadowMaterial = this._blendAoAndShadowMaterial ?? new
|
|
1877
|
+
return this._blendAoAndShadowMaterial = this._blendAoAndShadowMaterial ?? new Ue({ blending: 0 }), this._blendAoAndShadowMaterial.update(e);
|
|
2978
1878
|
}
|
|
2979
1879
|
getBlendAoPassDepthMaterial(e) {
|
|
2980
|
-
return this._blendAoPassDepthMaterial = this._blendAoPassDepthMaterial ?? new
|
|
1880
|
+
return this._blendAoPassDepthMaterial = this._blendAoPassDepthMaterial ?? new Ot({ blending: 0 }), this._blendAoPassDepthMaterial.update(e);
|
|
2981
1881
|
}
|
|
2982
1882
|
getSrgbToLinearCopyMaterial(e) {
|
|
2983
|
-
return this._srgbToLinearCopyMaterial = this._copyMaterial ?? new
|
|
1883
|
+
return this._srgbToLinearCopyMaterial = this._copyMaterial ?? new M({}, Le.ADDITIVE, !0, !0), this._srgbToLinearCopyMaterial.update(e);
|
|
2984
1884
|
}
|
|
2985
1885
|
_getDepthRenderMaterial(e) {
|
|
2986
|
-
return this._depthRenderMaterial = this._depthRenderMaterial ?? new
|
|
1886
|
+
return this._depthRenderMaterial = this._depthRenderMaterial ?? new xe({
|
|
2987
1887
|
depthTexture: this.gBufferTextures.textureWithDepthValue,
|
|
2988
1888
|
depthFilter: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? new n(0, 0, 0, 1) : new n(1, 0, 0, 0)
|
|
2989
1889
|
}), this._depthRenderMaterial.update({ camera: e });
|
|
@@ -2998,94 +1898,94 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2998
1898
|
this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
2999
1899
|
texture: this.gBufferTextures?.gBufferTexture,
|
|
3000
1900
|
blending: 0,
|
|
3001
|
-
colorTransform: new
|
|
1901
|
+
colorTransform: new E().set(.5, 0, 0, 0, 0, .5, 0, 0, 0, 0, .5, 0, 0, 0, 0, 0),
|
|
3002
1902
|
colorBase: new n(.5, .5, .5, 1),
|
|
3003
1903
|
multiplyChannels: 0,
|
|
3004
|
-
uvTransform:
|
|
1904
|
+
uvTransform: B
|
|
3005
1905
|
}), null) : this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3006
1906
|
texture: this.gBufferTextures?.gBufferTexture,
|
|
3007
1907
|
blending: 0,
|
|
3008
|
-
colorTransform:
|
|
3009
|
-
colorBase:
|
|
1908
|
+
colorTransform: ke,
|
|
1909
|
+
colorBase: z,
|
|
3010
1910
|
multiplyChannels: 0,
|
|
3011
|
-
uvTransform:
|
|
1911
|
+
uvTransform: B
|
|
3012
1912
|
}), null);
|
|
3013
1913
|
break;
|
|
3014
1914
|
case "g-depth":
|
|
3015
1915
|
this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3016
1916
|
texture: this.gBufferTextures?.gBufferTexture,
|
|
3017
1917
|
blending: 0,
|
|
3018
|
-
colorTransform:
|
|
3019
|
-
colorBase:
|
|
1918
|
+
colorTransform: Re,
|
|
1919
|
+
colorBase: z,
|
|
3020
1920
|
multiplyChannels: 0,
|
|
3021
|
-
uvTransform:
|
|
1921
|
+
uvTransform: B
|
|
3022
1922
|
}), null) : this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3023
1923
|
texture: this.gBufferTextures?.depthBufferTexture,
|
|
3024
1924
|
blending: 0,
|
|
3025
|
-
colorTransform:
|
|
3026
|
-
colorBase:
|
|
1925
|
+
colorTransform: Ce,
|
|
1926
|
+
colorBase: z,
|
|
3027
1927
|
multiplyChannels: 0,
|
|
3028
|
-
uvTransform:
|
|
1928
|
+
uvTransform: B
|
|
3029
1929
|
}), null);
|
|
3030
1930
|
break;
|
|
3031
1931
|
case "ssao":
|
|
3032
1932
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3033
1933
|
texture: this.renderPassManager.shadowAndAoPass.aoAndSoftShadowRenderTarget.texture,
|
|
3034
1934
|
blending: 0,
|
|
3035
|
-
colorTransform:
|
|
3036
|
-
colorBase:
|
|
1935
|
+
colorTransform: Se,
|
|
1936
|
+
colorBase: A,
|
|
3037
1937
|
multiplyChannels: 0,
|
|
3038
|
-
uvTransform:
|
|
1938
|
+
uvTransform: B
|
|
3039
1939
|
}), null);
|
|
3040
1940
|
break;
|
|
3041
1941
|
case "ssaodenoise":
|
|
3042
1942
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3043
1943
|
texture: this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,
|
|
3044
1944
|
blending: 0,
|
|
3045
|
-
colorTransform:
|
|
3046
|
-
colorBase:
|
|
1945
|
+
colorTransform: Se,
|
|
1946
|
+
colorBase: A,
|
|
3047
1947
|
multiplyChannels: 0,
|
|
3048
|
-
uvTransform:
|
|
1948
|
+
uvTransform: B
|
|
3049
1949
|
}), null);
|
|
3050
1950
|
break;
|
|
3051
1951
|
case "shadowmap":
|
|
3052
1952
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3053
1953
|
texture: this.renderPassManager.screenSpaceShadowMapPass.shadowTexture,
|
|
3054
1954
|
blending: 0,
|
|
3055
|
-
colorTransform:
|
|
3056
|
-
colorBase:
|
|
1955
|
+
colorTransform: Se,
|
|
1956
|
+
colorBase: A,
|
|
3057
1957
|
multiplyChannels: 0,
|
|
3058
|
-
uvTransform:
|
|
1958
|
+
uvTransform: B
|
|
3059
1959
|
}), null);
|
|
3060
1960
|
break;
|
|
3061
1961
|
case "shadowsoft":
|
|
3062
1962
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3063
1963
|
texture: this.renderPassManager.shadowAndAoPass.aoAndSoftShadowRenderTarget.texture,
|
|
3064
1964
|
blending: 0,
|
|
3065
|
-
colorTransform:
|
|
3066
|
-
colorBase:
|
|
1965
|
+
colorTransform: K.shadowTransform,
|
|
1966
|
+
colorBase: A,
|
|
3067
1967
|
multiplyChannels: 0,
|
|
3068
|
-
uvTransform:
|
|
1968
|
+
uvTransform: B
|
|
3069
1969
|
}), null);
|
|
3070
1970
|
break;
|
|
3071
1971
|
case "shadowdenoise":
|
|
3072
1972
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3073
1973
|
texture: this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,
|
|
3074
1974
|
blending: 0,
|
|
3075
|
-
colorTransform:
|
|
3076
|
-
colorBase:
|
|
1975
|
+
colorTransform: K.shadowTransform,
|
|
1976
|
+
colorBase: A,
|
|
3077
1977
|
multiplyChannels: 0,
|
|
3078
|
-
uvTransform:
|
|
1978
|
+
uvTransform: B
|
|
3079
1979
|
}), null);
|
|
3080
1980
|
break;
|
|
3081
1981
|
case "shadowfadein":
|
|
3082
1982
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3083
1983
|
texture: this.renderPassManager.shadowAndAoPass.fadeRenderTarget.texture,
|
|
3084
1984
|
blending: 0,
|
|
3085
|
-
colorTransform:
|
|
3086
|
-
colorBase:
|
|
1985
|
+
colorTransform: K.shadowTransform,
|
|
1986
|
+
colorBase: A,
|
|
3087
1987
|
multiplyChannels: 0,
|
|
3088
|
-
uvTransform:
|
|
1988
|
+
uvTransform: B
|
|
3089
1989
|
}), null);
|
|
3090
1990
|
break;
|
|
3091
1991
|
case "shadowandao":
|
|
@@ -3106,40 +2006,40 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3106
2006
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3107
2007
|
texture: this.renderPassManager.aoPassMapTexture,
|
|
3108
2008
|
blending: 0,
|
|
3109
|
-
colorTransform:
|
|
3110
|
-
colorBase:
|
|
2009
|
+
colorTransform: j,
|
|
2010
|
+
colorBase: A,
|
|
3111
2011
|
multiplyChannels: 0,
|
|
3112
|
-
uvTransform:
|
|
2012
|
+
uvTransform: B
|
|
3113
2013
|
}), null);
|
|
3114
2014
|
break;
|
|
3115
2015
|
case "groundreflection":
|
|
3116
2016
|
this.passRenderer.renderScreenSpace(e, this.getSrgbToLinearCopyMaterial({
|
|
3117
2017
|
texture: this.renderPassManager.groundReflectionPass.reflectionRenderTarget.texture,
|
|
3118
2018
|
blending: 0,
|
|
3119
|
-
colorTransform:
|
|
3120
|
-
colorBase:
|
|
2019
|
+
colorTransform: j,
|
|
2020
|
+
colorBase: A,
|
|
3121
2021
|
multiplyChannels: 0,
|
|
3122
|
-
uvTransform:
|
|
2022
|
+
uvTransform: N
|
|
3123
2023
|
}), null);
|
|
3124
2024
|
break;
|
|
3125
2025
|
case "groundreflectionfinal":
|
|
3126
2026
|
this.passRenderer.renderScreenSpace(e, this.getSrgbToLinearCopyMaterial({
|
|
3127
2027
|
texture: this.renderPassManager.groundReflectionPass.intensityRenderTarget.texture,
|
|
3128
2028
|
blending: 0,
|
|
3129
|
-
colorTransform:
|
|
3130
|
-
colorBase:
|
|
2029
|
+
colorTransform: j,
|
|
2030
|
+
colorBase: A,
|
|
3131
2031
|
multiplyChannels: 0,
|
|
3132
|
-
uvTransform:
|
|
2032
|
+
uvTransform: N
|
|
3133
2033
|
}), null);
|
|
3134
2034
|
break;
|
|
3135
2035
|
case "bakedgroundshadow":
|
|
3136
2036
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3137
2037
|
texture: this.renderPassManager.bakedGroundContactShadowPass.renderTarget.texture,
|
|
3138
2038
|
blending: 0,
|
|
3139
|
-
colorTransform:
|
|
3140
|
-
colorBase:
|
|
2039
|
+
colorTransform: j,
|
|
2040
|
+
colorBase: A,
|
|
3141
2041
|
multiplyChannels: 0,
|
|
3142
|
-
uvTransform:
|
|
2042
|
+
uvTransform: B
|
|
3143
2043
|
}), null);
|
|
3144
2044
|
break;
|
|
3145
2045
|
case "environmentmap":
|
|
@@ -3148,14 +2048,14 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3148
2048
|
case "lightsourcedetection":
|
|
3149
2049
|
if (this.scene.userData?.environmentDefinition) {
|
|
3150
2050
|
let t = this.renderPassManager.aspect, n = new a(-1, 1, 1 / t, -1 / t, -1, 1), r = this.scene.userData?.environmentDefinition.createDebugScene(e, this.scene, this.renderPassManager.screenSpaceShadowMapPass.parameters.maximumNumberOfLightSources);
|
|
3151
|
-
r.background = new
|
|
2051
|
+
r.background = new D(16777215), e.render(r, n);
|
|
3152
2052
|
}
|
|
3153
2053
|
break;
|
|
3154
2054
|
}
|
|
3155
2055
|
}
|
|
3156
|
-
},
|
|
2056
|
+
}, Lt = class extends V {
|
|
3157
2057
|
constructor(e) {
|
|
3158
|
-
super(e), this.drawGround = !0, this.drawWithDebugMaterial = !1, this.grayDebugMaterial = new
|
|
2058
|
+
super(e), this.drawGround = !0, this.drawWithDebugMaterial = !1, this.grayDebugMaterial = new v({
|
|
3159
2059
|
color: 12632256,
|
|
3160
2060
|
side: 2,
|
|
3161
2061
|
envMapIntensity: .4
|
|
@@ -3169,7 +2069,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3169
2069
|
this.passRenderer.renderWithOverrideMaterial(e, this.scene, this.camera, this.grayDebugMaterial, null, 0, 1);
|
|
3170
2070
|
}) : e.render(this.scene, this.camera), this.renderPassManager.setGroundVisibility(!1), this.renderCacheManager.onAfterRender("floorDepthWrite");
|
|
3171
2071
|
}
|
|
3172
|
-
},
|
|
2072
|
+
}, Rt = class e {
|
|
3173
2073
|
constructor() {
|
|
3174
2074
|
this.applyAoAndShadowToAlpha = !1, this._aoPassMapUniform = { value: null }, this._aoPassMapScaleUniform = { value: 1 }, this._aoPassMapIntensityUniform = { value: 1 }, this._shPassMapIntensityUniform = { value: 1 }, this._reflectionPassMapUniform = { value: null }, this._reflectionPassMapScaleUniform = { value: 1 }, this._reflectionPassMapIntensityUniform = { value: 0 }, this.applyReflectionPassMap = !1;
|
|
3175
2075
|
}
|
|
@@ -3195,7 +2095,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3195
2095
|
this._reflectionPassMapIntensityUniform.value = e;
|
|
3196
2096
|
}
|
|
3197
2097
|
static addPlugin(t) {
|
|
3198
|
-
if (
|
|
2098
|
+
if (J(t)) return null;
|
|
3199
2099
|
if (t.userData.postProcessingMaterialPlugin !== void 0) return t.userData.postProcessingMaterialPlugin instanceof e ? t.userData.postProcessingMaterialPlugin : null;
|
|
3200
2100
|
let n = new e();
|
|
3201
2101
|
return t.userData.postProcessingMaterialPlugin = n, t.onBeforeCompile = (e, t) => n._onBeforeCompile(e, t), t.customProgramCacheKey = () => n._customProgramCacheKey(), n;
|
|
@@ -3210,21 +2110,21 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3210
2110
|
_onBeforeCompile(e, t) {
|
|
3211
2111
|
if (this._isEnabled() || this.applyReflectionPassMap) {
|
|
3212
2112
|
let t = this.applyAoAndShadowToAlpha ? "#define USE_APPLY_AO_AND_SHADOW_TO_ALPHA\n" : "";
|
|
3213
|
-
t += this.applyReflectionPassMap ? "#define USE_REFLECTION_PASS_MAP\n" : "", t +=
|
|
2113
|
+
t += this.applyReflectionPassMap ? "#define USE_REFLECTION_PASS_MAP\n" : "", t += zt, e.fragmentShader = e.fragmentShader.replace("#include <aomap_pars_fragment>", t), e.fragmentShader = e.fragmentShader.replace("#include <aomap_fragment>", Bt), this._initUniforms(e);
|
|
3214
2114
|
}
|
|
3215
2115
|
}
|
|
3216
2116
|
_initUniforms(e) {
|
|
3217
2117
|
e && (e.uniforms.tAoPassMap = this._aoPassMapUniform, e.uniforms.aoPassMapScale = this._aoPassMapScaleUniform, e.uniforms.aoPassMapIntensity = this._aoPassMapIntensityUniform, e.uniforms.shPassMapIntensity = this._shPassMapIntensityUniform, e.uniforms.tReflectionPassMap = this._reflectionPassMapUniform, e.uniforms.reflectionPassMapScale = this._reflectionPassMapScaleUniform, e.uniforms.reflectionPassMapIntensity = this._reflectionPassMapIntensityUniform);
|
|
3218
2118
|
}
|
|
3219
|
-
},
|
|
2119
|
+
}, zt = "\n#ifdef USE_AOMAP\n\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n\n#endif\n\n uniform highp sampler2D tAoPassMap;\n uniform float aoPassMapScale;\n uniform float aoPassMapIntensity;\n uniform float shPassMapIntensity;\n uniform sampler2D tReflectionPassMap;\n uniform float reflectionPassMapScale;\n uniform float reflectionPassMapIntensity;\n", Bt = "\n#ifndef AOPASSMAP_SWIZZLE\n #define AOPASSMAP_SWIZZLE rg\n#endif\n\nfloat ambientOcclusion = 1.0;\nfloat shadowValue = 1.0;\n\n#ifdef USE_AOMAP\n\n // reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n ambientOcclusion = texture2D( aoMap, vAoMapUv ).r;\n ambientOcclusion = ( ambientOcclusion - 1.0 ) * aoMapIntensity + 1.0;\n\n#endif\n\n vec4 aoAndShadowMap = texelFetch( tAoPassMap, ivec2( gl_FragCoord.xy * aoPassMapScale ), 0 );\n vec2 aoAndShadow = aoAndShadowMap.rg;\n float depthDelta = abs( dot(aoAndShadowMap.wz, vec2(1.0/1024.0)) - gl_FragCoord.z );\n const ivec2 aoOffsetArray[8] = ivec2[8](\n ivec2(1, 0), ivec2(-1, 0), ivec2(0, 1), ivec2(0, -1), ivec2(1, 1), ivec2(-1, 1), ivec2(1, -1), ivec2(-1, -1));\n for (int aoOffsetI = 0; aoOffsetI < 8; aoOffsetI++) {\n aoAndShadowMap = texelFetch( tAoPassMap, ivec2( gl_FragCoord.xy * aoPassMapScale ) + aoOffsetArray[aoOffsetI], 0 );\n float testDepthDelta = abs( dot(aoAndShadowMap.wz, vec2(1.0/1024.0)) - gl_FragCoord.z );\n if (testDepthDelta < depthDelta) {\n aoAndShadow = aoAndShadowMap.rg;\n depthDelta = testDepthDelta;\n }\n }\n\n float aoPassMapValue = aoPassMapIntensity < 0.0 ? 1.0 : max(0.0, (aoAndShadow.r - 1.0) * aoPassMapIntensity + 1.0);\n shadowValue = shPassMapIntensity < 0.0 ? 1.0 : max(0.0, (aoAndShadow.g - 1.0) * shPassMapIntensity + 1.0);\n\n #ifdef USE_REFLECTION_PASS_MAP\n\n ivec2 reflectionPassMapSize = textureSize( tReflectionPassMap, 0 );\n vec2 reflectionPassMapUv = vec2( gl_FragCoord.x * reflectionPassMapScale, float(reflectionPassMapSize.y) - gl_FragCoord.y * reflectionPassMapScale );\n vec4 reflectionPassMapColor = texture2D( tReflectionPassMap, reflectionPassMapUv / vec2(reflectionPassMapSize) );\n if (reflectionPassMapColor.a > 0.0) reflectionPassMapColor.rgb /= reflectionPassMapColor.a;\n vec3 diffuseReflectionPassMapColor = reflectionPassMapColor.rgb * material.diffuseColor;\n reflectedLight.indirectDiffuse += diffuseReflectionPassMapColor * reflectionPassMapColor.a * reflectionPassMapIntensity;\n //reflectedLight.indirectDiffuse = mix(reflectedLight.indirectDiffuse, diffuseReflectionPassMapColor, reflectionPassMapColor.a * reflectionPassMapIntensity);\n\n #endif\n\n #if defined ( USE_APPLY_AO_AND_SHADOW_TO_ALPHA )\n diffuseColor.a = 1.0 - (1.0 - diffuseColor.a) * aoPassMapValue * shadowValue;\n #else\n ambientOcclusion = min( ambientOcclusion, aoPassMapValue );\n #endif\n\n reflectedLight.indirectDiffuse *= ambientOcclusion * shadowValue;\n\n #if defined( USE_CLEARCOAT )\n clearcoatSpecularIndirect *= ambientOcclusion * shadowValue;\n #endif\n\n #if defined( USE_SHEEN )\n sheenSpecularIndirect *= ambientOcclusion * shadowValue;\n #endif\n\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\n float specularOcclusion = computeSpecularOcclusion( dotNV, ambientOcclusion * shadowValue, material.roughness );\n reflectedLight.indirectSpecular *= specularOcclusion;\n\n #ifdef USE_REFLECTION_PASS_MAP\n reflectedLight.indirectSpecular += material.specularColor * reflectionPassMapColor.rgb * reflectionPassMapColor.a * reflectionPassMapIntensity * specularOcclusion;\n #endif\n\n #endif\n", Vt = class extends P {
|
|
3220
2120
|
constructor(e, t = "tDiffuse") {
|
|
3221
|
-
super(), this.textureID = t, this.uniforms = null, this.material = null, e instanceof
|
|
2121
|
+
super(), this.textureID = t, this.uniforms = null, this.material = null, e instanceof p ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms = S.clone(e.uniforms), this.material = new p({
|
|
3222
2122
|
name: e.name === void 0 ? "unspecified" : e.name,
|
|
3223
2123
|
defines: Object.assign({}, e.defines),
|
|
3224
2124
|
uniforms: this.uniforms,
|
|
3225
2125
|
vertexShader: e.vertexShader,
|
|
3226
2126
|
fragmentShader: e.fragmentShader
|
|
3227
|
-
})), this._fsQuad = new
|
|
2127
|
+
})), this._fsQuad = new I(this.material);
|
|
3228
2128
|
}
|
|
3229
2129
|
render(e, t, n) {
|
|
3230
2130
|
this.uniforms[this.textureID] && (this.uniforms[this.textureID].value = n.texture), this._fsQuad.material = this.material, this.renderToScreen ? (e.setRenderTarget(null), this._fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), this._fsQuad.render(e));
|
|
@@ -3232,7 +2132,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3232
2132
|
dispose() {
|
|
3233
2133
|
this.material.dispose(), this._fsQuad.dispose();
|
|
3234
2134
|
}
|
|
3235
|
-
},
|
|
2135
|
+
}, Ht = {
|
|
3236
2136
|
name: "LUTShader",
|
|
3237
2137
|
uniforms: {
|
|
3238
2138
|
lut: { value: null },
|
|
@@ -3242,9 +2142,9 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3242
2142
|
},
|
|
3243
2143
|
vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n\n ",
|
|
3244
2144
|
fragmentShader: "\n\n uniform float lutSize;\n uniform sampler3D lut;\n\n varying vec2 vUv;\n uniform float intensity;\n uniform sampler2D tDiffuse;\n void main() {\n\n vec4 val = texture2D( tDiffuse, vUv );\n vec4 lutVal;\n\n // pull the sample in by half a pixel so the sample begins\n // at the center of the edge pixels.\n float pixelWidth = 1.0 / lutSize;\n float halfPixelWidth = 0.5 / lutSize;\n vec3 uvw = vec3( halfPixelWidth ) + val.rgb * ( 1.0 - pixelWidth );\n\n\n lutVal = vec4( texture( lut, uvw ).rgb, val.a );\n\n gl_FragColor = vec4( mix( val, lutVal, intensity ) );\n\n }\n\n "
|
|
3245
|
-
},
|
|
2145
|
+
}, Ut = class extends Vt {
|
|
3246
2146
|
constructor(e = {}) {
|
|
3247
|
-
super(
|
|
2147
|
+
super(Ht), this.lut = e.lut || null, this.intensity = "intensity" in e ? e.intensity : 1;
|
|
3248
2148
|
}
|
|
3249
2149
|
set lut(e) {
|
|
3250
2150
|
let t = this.material;
|
|
@@ -3259,15 +2159,15 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3259
2159
|
get intensity() {
|
|
3260
2160
|
return this.material.uniforms.intensity.value;
|
|
3261
2161
|
}
|
|
3262
|
-
},
|
|
2162
|
+
}, Wt = class extends ne {
|
|
3263
2163
|
constructor(e) {
|
|
3264
|
-
super(e), this.type =
|
|
2164
|
+
super(e), this.type = w;
|
|
3265
2165
|
}
|
|
3266
2166
|
setType(e) {
|
|
3267
2167
|
return this.type = e, this;
|
|
3268
2168
|
}
|
|
3269
2169
|
load(e, t, n, r) {
|
|
3270
|
-
let i = new
|
|
2170
|
+
let i = new te(this.manager);
|
|
3271
2171
|
i.setPath(this.path), i.setResponseType("text"), i.load(e, (n) => {
|
|
3272
2172
|
try {
|
|
3273
2173
|
t(this.parse(n));
|
|
@@ -3279,12 +2179,12 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3279
2179
|
parse(e) {
|
|
3280
2180
|
let t = /TITLE +"([^"]*)"/, n = /LUT_3D_SIZE +(\d+)/, r = /DOMAIN_MIN +([\d.]+) +([\d.]+) +([\d.]+)/, i = /DOMAIN_MAX +([\d.]+) +([\d.]+) +([\d.]+)/, a = /^([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+) *$/gm, o = t.exec(e), s = o === null ? null : o[1];
|
|
3281
2181
|
if (o = n.exec(e), o === null) throw Error("LUTCubeLoader: Missing LUT_3D_SIZE information");
|
|
3282
|
-
let c = Number(o[1]), l = c ** 3 * 4,
|
|
2182
|
+
let c = Number(o[1]), l = c ** 3 * 4, f = this.type === 1009 ? new Uint8Array(l) : new Float32Array(l), p = new d(0, 0, 0), m = new d(1, 1, 1);
|
|
3283
2183
|
if (o = r.exec(e), o !== null && p.set(Number(o[1]), Number(o[2]), Number(o[3])), o = i.exec(e), o !== null && m.set(Number(o[1]), Number(o[2]), Number(o[3])), p.x > m.x || p.y > m.y || p.z > m.z) throw Error("LUTCubeLoader: Invalid input domain");
|
|
3284
2184
|
let h = this.type === 1009 ? 255 : 1, g = 0;
|
|
3285
|
-
for (; (o = a.exec(e)) !== null;)
|
|
3286
|
-
let _ = new
|
|
3287
|
-
return _.image.data =
|
|
2185
|
+
for (; (o = a.exec(e)) !== null;) f[g++] = Number(o[1]) * h, f[g++] = Number(o[2]) * h, f[g++] = Number(o[3]) * h, f[g++] = h;
|
|
2186
|
+
let _ = new k();
|
|
2187
|
+
return _.image.data = f, _.image.width = c, _.image.height = c, _.image.depth = c, _.type = this.type, _.magFilter = T, _.minFilter = T, _.wrapS = u, _.wrapT = u, _.wrapR = u, _.generateMipmaps = !1, _.needsUpdate = !0, {
|
|
3288
2188
|
title: s,
|
|
3289
2189
|
size: c,
|
|
3290
2190
|
domainMin: p,
|
|
@@ -3292,12 +2192,12 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3292
2192
|
texture3D: _
|
|
3293
2193
|
};
|
|
3294
2194
|
}
|
|
3295
|
-
},
|
|
2195
|
+
}, Gt = class extends ne {
|
|
3296
2196
|
constructor(e) {
|
|
3297
2197
|
super(e), this.flip = !1;
|
|
3298
2198
|
}
|
|
3299
2199
|
load(e, t, n, r) {
|
|
3300
|
-
let i = new
|
|
2200
|
+
let i = new he(this.manager);
|
|
3301
2201
|
i.setCrossOrigin(this.crossOrigin), i.setPath(this.path), i.load(e, (n) => {
|
|
3302
2202
|
try {
|
|
3303
2203
|
let e;
|
|
@@ -3308,8 +2208,8 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3308
2208
|
}, n, r);
|
|
3309
2209
|
}
|
|
3310
2210
|
parse(e, t) {
|
|
3311
|
-
let n = new Uint8Array(e), r = new
|
|
3312
|
-
return r.image.data = n, r.image.width = t, r.image.height = t, r.image.depth = t, r.format = o, r.type =
|
|
2211
|
+
let n = new Uint8Array(e), r = new k();
|
|
2212
|
+
return r.image.data = n, r.image.width = t, r.image.height = t, r.image.depth = t, r.format = o, r.type = w, r.magFilter = T, r.minFilter = T, r.wrapS = u, r.wrapT = u, r.wrapR = u, r.generateMipmaps = !1, r.needsUpdate = !0, {
|
|
3313
2213
|
size: t,
|
|
3314
2214
|
texture3D: r
|
|
3315
2215
|
};
|
|
@@ -3331,15 +2231,15 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3331
2231
|
}
|
|
3332
2232
|
return i.getImageData(0, 0, t, n);
|
|
3333
2233
|
}
|
|
3334
|
-
},
|
|
2234
|
+
}, Kt = class extends ne {
|
|
3335
2235
|
constructor(e) {
|
|
3336
|
-
super(e), this.type =
|
|
2236
|
+
super(e), this.type = w;
|
|
3337
2237
|
}
|
|
3338
2238
|
setType(e) {
|
|
3339
2239
|
return this.type = e, this;
|
|
3340
2240
|
}
|
|
3341
2241
|
load(e, t, n, r) {
|
|
3342
|
-
let i = new
|
|
2242
|
+
let i = new te(this.manager);
|
|
3343
2243
|
i.setPath(this.path), i.setResponseType("text"), i.load(e, (n) => {
|
|
3344
2244
|
try {
|
|
3345
2245
|
t(this.parse(n));
|
|
@@ -3353,25 +2253,25 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3353
2253
|
if (r === null) throw Error("LUT3dlLoader: Missing grid information");
|
|
3354
2254
|
let i = r[0].trim().split(/\s+/g).map(Number), a = i[1] - i[0], s = i.length, c = s ** 2;
|
|
3355
2255
|
for (let e = 1, t = i.length; e < t; ++e) if (a !== i[e] - i[e - 1]) throw Error("LUT3dlLoader: Inconsistent grid size");
|
|
3356
|
-
let l = new Float32Array(s ** 3 * 4),
|
|
2256
|
+
let l = new Float32Array(s ** 3 * 4), d = 0, f = 0;
|
|
3357
2257
|
for (; (r = n.exec(e)) !== null;) {
|
|
3358
2258
|
let e = Number(r[1]), t = Number(r[2]), n = Number(r[3]);
|
|
3359
|
-
|
|
3360
|
-
let i = f % s, a = Math.floor(f / s) % s, o = Math.floor(f / c) % s,
|
|
3361
|
-
l[
|
|
2259
|
+
d = Math.max(d, e, t, n);
|
|
2260
|
+
let i = f % s, a = Math.floor(f / s) % s, o = Math.floor(f / c) % s, u = (i * c + a * s + o) * 4;
|
|
2261
|
+
l[u + 0] = e, l[u + 1] = t, l[u + 2] = n, ++f;
|
|
3362
2262
|
}
|
|
3363
|
-
let p = 2 ** Math.ceil(Math.log2(
|
|
2263
|
+
let p = 2 ** Math.ceil(Math.log2(d)), m = this.type === 1009 ? new Uint8Array(l.length) : l, h = this.type === 1009 ? 255 : 1;
|
|
3364
2264
|
for (let e = 0, t = m.length; e < t; e += 4) {
|
|
3365
2265
|
let t = e + 1, n = e + 2, r = e + 3;
|
|
3366
2266
|
m[e] = l[e] / p * h, m[t] = l[t] / p * h, m[n] = l[n] / p * h, m[r] = h;
|
|
3367
2267
|
}
|
|
3368
|
-
let g = new
|
|
3369
|
-
return g.image.data = m, g.image.width = s, g.image.height = s, g.image.depth = s, g.format = o, g.type = this.type, g.magFilter =
|
|
2268
|
+
let g = new k();
|
|
2269
|
+
return g.image.data = m, g.image.width = s, g.image.height = s, g.image.depth = s, g.format = o, g.type = this.type, g.magFilter = T, g.minFilter = T, g.wrapS = u, g.wrapT = u, g.wrapR = u, g.generateMipmaps = !1, g.needsUpdate = !0, {
|
|
3370
2270
|
size: s,
|
|
3371
2271
|
texture3D: g
|
|
3372
2272
|
};
|
|
3373
2273
|
}
|
|
3374
|
-
},
|
|
2274
|
+
}, $ = {
|
|
3375
2275
|
name: "OutputShader",
|
|
3376
2276
|
uniforms: {
|
|
3377
2277
|
tDiffuse: { value: null },
|
|
@@ -3379,14 +2279,14 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3379
2279
|
},
|
|
3380
2280
|
vertexShader: "\n precision highp float;\n\n uniform mat4 modelViewMatrix;\n uniform mat4 projectionMatrix;\n\n attribute vec3 position;\n attribute vec2 uv;\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
|
|
3381
2281
|
fragmentShader: "\n\n precision highp float;\n\n uniform sampler2D tDiffuse;\n\n #include <tonemapping_pars_fragment>\n #include <colorspace_pars_fragment>\n\n varying vec2 vUv;\n\n void main() {\n\n gl_FragColor = texture2D( tDiffuse, vUv );\n\n // tone mapping\n\n #ifdef LINEAR_TONE_MAPPING\n\n gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\n #elif defined( REINHARD_TONE_MAPPING )\n\n gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\n #elif defined( CINEON_TONE_MAPPING )\n\n gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );\n\n #elif defined( ACES_FILMIC_TONE_MAPPING )\n\n gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\n #elif defined( AGX_TONE_MAPPING )\n\n gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\n #elif defined( NEUTRAL_TONE_MAPPING )\n\n gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\n\n #elif defined( CUSTOM_TONE_MAPPING )\n\n gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );\n\n #endif\n\n // color space\n\n #ifdef SRGB_TRANSFER\n\n gl_FragColor = sRGBTransferOETF( gl_FragColor );\n\n #endif\n\n }"
|
|
3382
|
-
},
|
|
2282
|
+
}, qt = class extends P {
|
|
3383
2283
|
constructor() {
|
|
3384
|
-
super(), this.isOutputPass = !0, this.uniforms =
|
|
3385
|
-
name:
|
|
2284
|
+
super(), this.isOutputPass = !0, this.uniforms = S.clone($.uniforms), this.material = new f({
|
|
2285
|
+
name: $.name,
|
|
3386
2286
|
uniforms: this.uniforms,
|
|
3387
|
-
vertexShader:
|
|
3388
|
-
fragmentShader:
|
|
3389
|
-
}), this._fsQuad = new
|
|
2287
|
+
vertexShader: $.vertexShader,
|
|
2288
|
+
fragmentShader: $.fragmentShader
|
|
2289
|
+
}), this._fsQuad = new I(this.material), this._outputColorSpace = null, this._toneMapping = null;
|
|
3390
2290
|
}
|
|
3391
2291
|
render(e, t, n) {
|
|
3392
2292
|
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 = {}, r.getTransfer(this._outputColorSpace) === "srgb" && (this.material.defines.SRGB_TRANSFER = ""), this._toneMapping === 1 ? this.material.defines.LINEAR_TONE_MAPPING = "" : this._toneMapping === 2 ? this.material.defines.REINHARD_TONE_MAPPING = "" : this._toneMapping === 3 ? this.material.defines.CINEON_TONE_MAPPING = "" : this._toneMapping === 4 ? this.material.defines.ACES_FILMIC_TONE_MAPPING = "" : this._toneMapping === 6 ? this.material.defines.AGX_TONE_MAPPING = "" : this._toneMapping === 7 ? this.material.defines.NEUTRAL_TONE_MAPPING = "" : this._toneMapping === 5 && (this.material.defines.CUSTOM_TONE_MAPPING = ""), this.material.needsUpdate = !0), this.renderToScreen === !0 ? (e.setRenderTarget(null), this._fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), this._fsQuad.render(e));
|
|
@@ -3394,11 +2294,11 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3394
2294
|
dispose() {
|
|
3395
2295
|
this.material.dispose(), this._fsQuad.dispose();
|
|
3396
2296
|
}
|
|
3397
|
-
},
|
|
2297
|
+
}, Jt = {
|
|
3398
2298
|
enabled: !1,
|
|
3399
2299
|
intensity: 1,
|
|
3400
2300
|
lut: "Bourbon 64"
|
|
3401
|
-
},
|
|
2301
|
+
}, Yt = class {
|
|
3402
2302
|
get passRenderer() {
|
|
3403
2303
|
return this._passRenderer;
|
|
3404
2304
|
}
|
|
@@ -3454,36 +2354,36 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3454
2354
|
return this._sceneRenderer.outlineRenderer;
|
|
3455
2355
|
}
|
|
3456
2356
|
get debugPass() {
|
|
3457
|
-
return this._debugPass ??= new
|
|
2357
|
+
return this._debugPass ??= new It(this), this._debugPass;
|
|
3458
2358
|
}
|
|
3459
2359
|
get debugOutput() {
|
|
3460
2360
|
return this._sceneRenderer.debugOutput;
|
|
3461
2361
|
}
|
|
3462
2362
|
constructor(t, n) {
|
|
3463
|
-
this.materialsNeedUpdate = !0, this._passRenderer = new
|
|
2363
|
+
this.materialsNeedUpdate = !0, this._passRenderer = new Ne(), this._outlinePass = null, this._debugPass = null, this._cameraUpdate = new F(), this._cameraChanged = !0, this._noUpdateNeededCount = 0, this._noOStaticFrames = 0, this._maxSamples = 1, this._passUpdateStates = {
|
|
3464
2364
|
updateGroundReflection: !1,
|
|
3465
2365
|
updateGBuffer: !1,
|
|
3466
2366
|
updateScreenSpaceShadow: !1,
|
|
3467
2367
|
updateShadowAndAoPass: !1,
|
|
3468
2368
|
updateOutlinePass: !1,
|
|
3469
2369
|
updateDebugPass: !1
|
|
3470
|
-
}, this.aoPassMapTexture = null, this._lutMap = /* @__PURE__ */ new Map(), this._lutPassParameters =
|
|
2370
|
+
}, this.aoPassMapTexture = null, this._lutMap = /* @__PURE__ */ new Map(), this._lutPassParameters = Jt, this.lutPassNeedsUpdate = !1, this._renderToRenderTarget = !1, this._creator_ = t, this._sceneRenderer = n, this._maxSamples = e(this._sceneRenderer.renderer);
|
|
3471
2371
|
let r = this._sceneRenderer.linearAoFilter, i = r ? this._maxSamples : 0, a = r ? this._maxSamples : 0;
|
|
3472
|
-
this._sceneRenderPass = new
|
|
2372
|
+
this._sceneRenderPass = new Lt(this), this._bakedGroundContactShadowPass = new tt(this, this._sceneRenderer.renderer, this._sceneRenderer.groundGroup, { sharedShadowGroundPlane: this._sceneRenderer.shadowAndAoGroundPlane }), this._gBufferRenderPass = new ot(this, {
|
|
3473
2373
|
shared: !0,
|
|
3474
2374
|
capabilities: this._sceneRenderer.renderer.capabilities,
|
|
3475
2375
|
width: this._sceneRenderer.width,
|
|
3476
2376
|
height: this._sceneRenderer.height,
|
|
3477
2377
|
samples: i,
|
|
3478
|
-
textureMinificationFilter: r ?
|
|
3479
|
-
textureMagnificationFilter: r ?
|
|
3480
|
-
}), this._groundReflectionPass = new
|
|
2378
|
+
textureMinificationFilter: r ? T : y,
|
|
2379
|
+
textureMagnificationFilter: r ? T : y
|
|
2380
|
+
}), this._groundReflectionPass = new ct(this, this._sceneRenderer.width, this._sceneRenderer.height, this._maxSamples, {}), this._screenSpaceShadowMapPass = new vt(this, new O(this._sceneRenderer.width, this._sceneRenderer.height), {
|
|
3481
2381
|
samples: a,
|
|
3482
2382
|
alwaysUpdate: !1
|
|
3483
|
-
}), this._shadowAndAoPass = new
|
|
2383
|
+
}), this._shadowAndAoPass = new K(this, this._sceneRenderer.width, this._sceneRenderer.height, i), this._lutPass = new Ut({
|
|
3484
2384
|
lut: void 0,
|
|
3485
2385
|
intensity: 1
|
|
3486
|
-
}), this._outputPass = new
|
|
2386
|
+
}), this._outputPass = new qt();
|
|
3487
2387
|
}
|
|
3488
2388
|
dispose() {
|
|
3489
2389
|
this._sceneRenderPass.dispose(), this._bakedGroundContactShadowPass.dispose(), this._gBufferRenderPass.dispose(), this._groundReflectionPass.dispose(), this._screenSpaceShadowMapPass.dispose(), this._shadowAndAoPass.dispose(), this._outlinePass?.dispose(), this._lutPass.dispose(), this._outputPass.dispose(), this._passRenderTarget?.dispose(), this._passPassRenderTarget?.dispose();
|
|
@@ -3494,22 +2394,22 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3494
2394
|
this._lutPass.setSize(r, i), this._outputPass.setSize(r, i), this._passRenderTarget?.setSize(r, i), this._passPassRenderTarget?.setSize(r, i);
|
|
3495
2395
|
}
|
|
3496
2396
|
loadLutImage(e, t) {
|
|
3497
|
-
this._lutMap.set(e, null), new
|
|
2397
|
+
this._lutMap.set(e, null), new Gt().load(t, (t) => {
|
|
3498
2398
|
this._lutMap.set(e, t);
|
|
3499
2399
|
});
|
|
3500
2400
|
}
|
|
3501
2401
|
loadLutCube(e, t) {
|
|
3502
|
-
this._lutMap.set(e, null), new
|
|
2402
|
+
this._lutMap.set(e, null), new Wt().load(t, (t) => {
|
|
3503
2403
|
this._lutMap.set(e, t);
|
|
3504
2404
|
});
|
|
3505
2405
|
}
|
|
3506
2406
|
loadLut3dl(e, t) {
|
|
3507
|
-
this._lutMap.set(e, null), new
|
|
2407
|
+
this._lutMap.set(e, null), new Kt().load(t, (t) => {
|
|
3508
2408
|
this._lutMap.set(e, t);
|
|
3509
2409
|
});
|
|
3510
2410
|
}
|
|
3511
2411
|
createOutlinePass() {
|
|
3512
|
-
return this._outlinePass ||= new
|
|
2412
|
+
return this._outlinePass ||= new Et(this, new O(this._sceneRenderer.width, this._sceneRenderer.height), this.scene, this.camera, [], {
|
|
3513
2413
|
downSampleRatio: 2,
|
|
3514
2414
|
edgeDetectionFxaa: !0
|
|
3515
2415
|
}), this._outlinePass;
|
|
@@ -3534,7 +2434,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3534
2434
|
_evaluateIfShadowAndAoUpdateIsNeeded() {
|
|
3535
2435
|
let e = this._shadowAndAoPass.parameters.alwaysUpdate || this._screenSpaceShadowMapPass.needsUpdate || this._screenSpaceShadowMapPass.shadowTypeNeedsUpdate, t = (this._shadowAndAoPass.parameters.enabled || this._groundReflectionPass.parameters.enabled) && this._cameraChanged, n = 1;
|
|
3536
2436
|
t && (this._noUpdateNeededCount = 0, this._noOStaticFrames = 0), e || (this._noUpdateNeededCount++, t = this._noUpdateNeededCount >= this.parameters.effectSuspendFrames, n = Math.max(0, Math.min(1, (this._noUpdateNeededCount - this.parameters.effectSuspendFrames) / this.parameters.effectFadeInFrames))), !e && n === 1 && this._noOStaticFrames++, t = e || t;
|
|
3537
|
-
let r = !t || n < .99 ? this.parameters.shadowOnCameraChange :
|
|
2437
|
+
let r = !t || n < .99 ? this.parameters.shadowOnCameraChange : W.OFF;
|
|
3538
2438
|
return {
|
|
3539
2439
|
needsUpdate: t,
|
|
3540
2440
|
shadowOnCameraChange: r,
|
|
@@ -3542,7 +2442,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3542
2442
|
};
|
|
3543
2443
|
}
|
|
3544
2444
|
_dynamicChanges(e) {
|
|
3545
|
-
return e.needsUpdate || e.shadowOnCameraChange !==
|
|
2445
|
+
return e.needsUpdate || e.shadowOnCameraChange !== W.OFF;
|
|
3546
2446
|
}
|
|
3547
2447
|
_updateSceneRenderPass() {
|
|
3548
2448
|
this._sceneRenderPass.drawWithDebugMaterial = !1;
|
|
@@ -3552,7 +2452,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3552
2452
|
this._bakedGroundContactShadowPass.limitPlaneSize = this._bakedGroundContactShadowPass.parameters.enabled, (e !== this._bakedGroundContactShadowPass.limitPlaneSize || this._bakedGroundContactShadowPass.needsUpdate) && this._bakedGroundContactShadowPass.updateBounds(this._sceneRenderer.boundingVolume, this._sceneRenderer.groundLevel), this._sceneRenderPass.drawGround = this._bakedGroundContactShadowPass.parameters.enabled || this._shadowAndAoPass.parameters.applyToMaterial;
|
|
3553
2453
|
}
|
|
3554
2454
|
_updateGBufferPass(e) {
|
|
3555
|
-
this._passUpdateStates.updateGBuffer = !1, this._gBufferRenderPass.needsUpdate = e.needsUpdate || e.shadowOnCameraChange ===
|
|
2455
|
+
this._passUpdateStates.updateGBuffer = !1, this._gBufferRenderPass.needsUpdate = e.needsUpdate || e.shadowOnCameraChange === W.POISSON, this.gBufferRenderPass.drawGround = this._sceneRenderer.boundingVolumeSet && this._shadowAndAoPass.parameters.aoOnGround;
|
|
3556
2456
|
}
|
|
3557
2457
|
_updateGroundReflectionPass(e) {
|
|
3558
2458
|
this._passUpdateStates.updateGroundReflection = !1, this._groundReflectionPass.parameters.enabled && this._dynamicChanges(e) && (!this.parameters.suspendGroundReflection || e.needsUpdate) && (this._groundReflectionPass.reflectionFadeInScale = this.parameters.suspendGroundReflection ? e.intensityScale : 1, this._passUpdateStates.updateGroundReflection = !0);
|
|
@@ -3571,7 +2471,7 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3571
2471
|
}
|
|
3572
2472
|
this._shadowAndAoPass.shadowAndAoPassSettings = {
|
|
3573
2473
|
shadowMapTexture: this._screenSpaceShadowMapPass.shadowTexture,
|
|
3574
|
-
shadowBlurType: e.needsUpdate ?
|
|
2474
|
+
shadowBlurType: e.needsUpdate ? W.FULL : e.shadowOnCameraChange,
|
|
3575
2475
|
shadowFadeInBlurType: e.shadowOnCameraChange,
|
|
3576
2476
|
shadowFadeInMix: 1 - e.intensityScale,
|
|
3577
2477
|
noOStaticFrames: this.noOStaticFrames
|
|
@@ -3612,12 +2512,12 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3612
2512
|
this.materialsNeedUpdate = !1, t.traverse((e) => {
|
|
3613
2513
|
if (e.isMesh) {
|
|
3614
2514
|
let t = e.material;
|
|
3615
|
-
t instanceof
|
|
2515
|
+
t instanceof v && this._updateMaterial(e, t, n);
|
|
3616
2516
|
}
|
|
3617
2517
|
});
|
|
3618
2518
|
}
|
|
3619
2519
|
_updateMaterial(e, t, n) {
|
|
3620
|
-
let r =
|
|
2520
|
+
let r = Rt.addPlugin(t);
|
|
3621
2521
|
r && (this._updatePlugInAo(r, e, t, n), this._updatePlugInReflection(r, e), t.needsUpdate = !1);
|
|
3622
2522
|
}
|
|
3623
2523
|
_updatePlugInAo(e, t, n, r) {
|
|
@@ -3633,15 +2533,15 @@ var Te = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3633
2533
|
e.setRenderTarget(n), this._bakedGroundContactShadowPass.renderPass(e), this._passUpdateStates.updateGBuffer && this._gBufferRenderPass.renderPass(e), this._passUpdateStates.updateScreenSpaceShadow && this._screenSpaceShadowMapPass.renderPass(e), this._passUpdateStates.updateShadowAndAoPass && this._shadowAndAoPass.renderPass(e), this._updateMaterials(e, t), this._sceneRenderPass.renderPass(e), this._passUpdateStates.updateGroundReflection && this._groundReflectionPass.renderPass(e), this._passUpdateStates.updateShadowAndAoPass && !this._shadowAndAoPass.parameters.applyToMaterial && this._shadowAndAoPass.renderToTarget(e), this._lutPassParameters.enabled && (e.setRenderTarget(r), this._outputPass.renderToScreen = !1, this._outputPass.render(e, e.getRenderTarget(), n, 0, !1), e.setRenderTarget(null), this._lutPass.renderToScreen = !0, this._lutPass.render(e, e.getRenderTarget(), r, 0, !1)), this._passUpdateStates.updateOutlinePass && this._outlinePass?.renderPass(e), this._passUpdateStates.updateDebugPass && this._debugPass?.renderPass(e);
|
|
3634
2534
|
}
|
|
3635
2535
|
};
|
|
3636
|
-
|
|
2536
|
+
Ve([Be, ze("design:type", Object)], Yt.prototype, "_initData", void 0);
|
|
3637
2537
|
//#endregion
|
|
3638
2538
|
//#region packages/common-core/src/webgl/renderer/scene-renderer.ts
|
|
3639
|
-
var
|
|
2539
|
+
var Xt = {
|
|
3640
2540
|
HIGHEST: "highest",
|
|
3641
2541
|
HIGH: "high",
|
|
3642
2542
|
MEDIUM: "medium",
|
|
3643
2543
|
LOW: "low"
|
|
3644
|
-
},
|
|
2544
|
+
}, Zt = class {
|
|
3645
2545
|
get sceneRenderPass() {
|
|
3646
2546
|
return this._renderPassManager.sceneRenderPass;
|
|
3647
2547
|
}
|
|
@@ -3673,7 +2573,7 @@ var yn = {
|
|
|
3673
2573
|
return this._shadowAndAoGroundPlane;
|
|
3674
2574
|
}
|
|
3675
2575
|
constructor(e, t, n, r, i) {
|
|
3676
|
-
this.debugOutput = "off", this.outputColorSpace = "", this.toneMapping = "", this.linearAoFilter = !0, this.environmentLights = !1, this.enableObjectSelection = !0, this.groundLevel = 0, this.uiInteractionMode = !1, this.width = 0, this.height = 0, this.boundingVolume = new
|
|
2576
|
+
this.debugOutput = "off", this.outputColorSpace = "", this.toneMapping = "", this.linearAoFilter = !0, this.environmentLights = !1, this.enableObjectSelection = !0, this.groundLevel = 0, this.uiInteractionMode = !1, this.width = 0, this.height = 0, this.boundingVolume = new Ae(), this.boundingVolumeSet = !1, this.renderCacheManager = new Ze(), this.selectedObjects = [], this.groundGroup = new fe(), this._shadingType = Ie.DEFAULT, this._qualityLevel = Xt.HIGHEST, this._qualityMap = /* @__PURE__ */ new Map(), this._customShadingParameters = null, this._creator_ = e, this.width = n, this.height = r, this.linearAoFilter = i ?? !0, this.renderer = t, this.renderCacheManager.registerCache("inivisibleGround", new Y((e) => e === this.groundGroup)), this.renderCacheManager.registerCache("groundReflection", new Y((e) => e === this.groundGroup || e.name === "dimensioning" ? !0 : !!(e instanceof b && J(e.material)))), this.renderCacheManager.registerCache("debug", new Y()), this.renderCacheManager.registerCache("floorDepthWrite", new Qe((e) => e.userData?.isFloor)), this._shadowAndAoGroundPlane = new He(null), this.groundGroup.rotateX(-Math.PI / 2), this._renderPassManager = new Yt(e, this), this.outlineRenderer = new Ye(this._renderPassManager, null, {}), this.parameters = {
|
|
3677
2577
|
gBufferRenderTargetParameters: this.gBufferRenderPass.parameters,
|
|
3678
2578
|
bakedGroundContactShadowParameters: this.bakedGroundContactShadowPass.parameters,
|
|
3679
2579
|
screenSpaceShadowMapParameters: this.screenSpaceShadowMapPass.parameters,
|
|
@@ -3683,7 +2583,7 @@ var yn = {
|
|
|
3683
2583
|
effectSuspendFrames: 0,
|
|
3684
2584
|
effectFadeInFrames: 0,
|
|
3685
2585
|
suspendGroundReflection: !1,
|
|
3686
|
-
shadowOnCameraChange:
|
|
2586
|
+
shadowOnCameraChange: W.OFF
|
|
3687
2587
|
}, this._addEventListeners(this.renderer);
|
|
3688
2588
|
}
|
|
3689
2589
|
_addEventListeners(e) {
|
|
@@ -3729,14 +2629,14 @@ var yn = {
|
|
|
3729
2629
|
applyCurrentParameters() {
|
|
3730
2630
|
let e = [];
|
|
3731
2631
|
this._qualityMap.has(this._qualityLevel) && e.push(this._qualityMap.get(this._qualityLevel));
|
|
3732
|
-
let t =
|
|
2632
|
+
let t = Pe(this._shadingType);
|
|
3733
2633
|
t && e.push(t);
|
|
3734
|
-
let n =
|
|
3735
|
-
if (n && e.push(n), this._customShadingParameters && e.push(
|
|
2634
|
+
let n = je(this.uiInteractionMode);
|
|
2635
|
+
if (n && e.push(n), this._customShadingParameters && e.push(Oe(this._customShadingParameters)), this._customOutlineParameters && e.push({ outlineParameters: {
|
|
3736
2636
|
visibleEdgeColor: this._customOutlineParameters.outlineVisibleEdgeColor,
|
|
3737
2637
|
hiddenEdgeColor: this._customOutlineParameters.outlineHiddenEdgeColor
|
|
3738
2638
|
} }), e.length > 0) {
|
|
3739
|
-
let t =
|
|
2639
|
+
let t = we(...e);
|
|
3740
2640
|
this.updateParameters(t), this.bakedGroundContactShadowPass.applyParameters();
|
|
3741
2641
|
}
|
|
3742
2642
|
}
|
|
@@ -3802,8 +2702,8 @@ var yn = {
|
|
|
3802
2702
|
t?.projectionMatrix && (e.add(this.groundGroup), this._updateEnvironment(this.renderer, e), this.outlineRenderer.updateOutline(e, t, this.enableObjectSelection ? this.selectedObjects : []), this._renderPassManager.updatePasses(this.renderer, e, t), this._renderPassManager.renderPasses(this.renderer, e), e.remove(this.groundGroup));
|
|
3803
2703
|
}
|
|
3804
2704
|
};
|
|
3805
|
-
|
|
2705
|
+
Ve([Be, ze("design:type", Object)], Zt.prototype, "_initData", void 0);
|
|
3806
2706
|
//#endregion
|
|
3807
|
-
export {
|
|
2707
|
+
export { ft as a, Mt as i, Zt as n, W as o, Q as r, Xt as t };
|
|
3808
2708
|
|
|
3809
|
-
//# sourceMappingURL=scene-renderer-
|
|
2709
|
+
//# sourceMappingURL=scene-renderer-DbHi1plp.mjs.map
|