@roomle/web-sdk 5.0.0-alpha.5 → 5.1.0-alpha.1
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-DxRRBHpW.mjs → BufferGeometry-Cd2ewNVQ.mjs} +2 -2
- package/lib/{BufferGeometry-DxRRBHpW.mjs.map → BufferGeometry-Cd2ewNVQ.mjs.map} +1 -1
- package/lib/ConfiguratorKernel.wasm +0 -0
- package/lib/{GLTFExporter-BFaz434u.mjs → GLTFExporter-n80QLoDf.mjs} +1 -1
- package/lib/{GLTFExporter-BFaz434u.mjs.map → GLTFExporter-n80QLoDf.mjs.map} +1 -1
- package/lib/{GaussianBlurNode-BMH03PYf.mjs → GaussianBlurNode-Cwy3kx8H.mjs} +3 -3
- package/lib/{GaussianBlurNode-BMH03PYf.mjs.map → GaussianBlurNode-Cwy3kx8H.mjs.map} +1 -1
- package/lib/{Object3D-DxqUUhH8.mjs → Object3D-BHdngbxB.mjs} +1 -1
- package/lib/{Object3D-DxqUUhH8.mjs.map → Object3D-BHdngbxB.mjs.map} +1 -1
- package/lib/{PointLightHelper-dMNG9Rk5.mjs → PointLightHelper-DlPLsDNy.mjs} +4 -4
- package/lib/{PointLightHelper-dMNG9Rk5.mjs.map → PointLightHelper-DlPLsDNy.mjs.map} +1 -1
- package/lib/RoomleCore.wasm +0 -0
- package/lib/RoomleToolsCore.wasm +0 -0
- package/lib/{SpotLightHelper-DFIT6781.mjs → SpotLightHelper-YWHbVXAF.mjs} +3 -3
- package/lib/{SpotLightHelper-DFIT6781.mjs.map → SpotLightHelper-YWHbVXAF.mjs.map} +1 -1
- package/lib/{USDZExporter-DWwEB8-y.mjs → USDZExporter-Bm-c5e_n.mjs} +2 -2
- package/lib/{USDZExporter-DWwEB8-y.mjs.map → USDZExporter-Bm-c5e_n.mjs.map} +1 -1
- package/lib/{Vector4-DgGvlGnF.mjs → Vector4-C7TlIAyy.mjs} +2 -2
- package/lib/{Vector4-DgGvlGnF.mjs.map → Vector4-C7TlIAyy.mjs.map} +1 -1
- package/lib/{api-DrK8F76r.mjs → api-B5wIZIHt.mjs} +2 -2
- package/lib/{api-DrK8F76r.mjs.map → api-B5wIZIHt.mjs.map} +1 -1
- package/lib/{asset-loader.worker-eqHzNAwa.mjs → asset-loader.worker-CE4O0JU-.mjs} +1 -1
- package/lib/asset-loader.worker-CE4O0JU-.mjs.map +1 -0
- package/lib/{banana-for-scale-DGYmxeBG.mjs → banana-for-scale-D0bw51dn.mjs} +3 -3
- package/lib/{banana-for-scale-DGYmxeBG.mjs.map → banana-for-scale-D0bw51dn.mjs.map} +1 -1
- package/lib/{budgeteer.sw-BUMElkO1.mjs → budgeteer.sw-yR2xApHT.mjs} +1 -1
- package/lib/budgeteer.sw-yR2xApHT.mjs.map +1 -0
- package/lib/{common-utils-CyQUubmw.mjs → common-utils-DbL4tku0.mjs} +1 -1
- package/lib/{common-utils-CyQUubmw.mjs.map → common-utils-DbL4tku0.mjs.map} +1 -1
- package/lib/{component-dimensioning-Dao60YO2.mjs → component-dimensioning-VIUcXV7r.mjs} +40 -39
- package/lib/component-dimensioning-VIUcXV7r.mjs.map +1 -0
- package/lib/{component-raycast-helper-PVs7Vpbl.mjs → component-raycast-helper-CEAdBcdx.mjs} +4 -4
- package/lib/{component-raycast-helper-PVs7Vpbl.mjs.map → component-raycast-helper-CEAdBcdx.mjs.map} +1 -1
- package/lib/{configurator-herY75_C.mjs → configurator-CxlLvBCx.mjs} +4 -4
- package/lib/{configurator-herY75_C.mjs.map → configurator-CxlLvBCx.mjs.map} +1 -1
- package/lib/configurator-h8QoUnMz.mjs +2 -0
- package/lib/{continuous-drawing-helper-DIVY8E6B.mjs → continuous-drawing-helper-Dr1r-5N2.mjs} +2 -2
- package/lib/{continuous-drawing-helper-DIVY8E6B.mjs.map → continuous-drawing-helper-Dr1r-5N2.mjs.map} +1 -1
- package/lib/{dat.gui.module-B2PXSbre.mjs → dat.gui.module-CSOnFjd0.mjs} +1 -1
- package/lib/{dat.gui.module-B2PXSbre.mjs.map → dat.gui.module-CSOnFjd0.mjs.map} +1 -1
- package/lib/{decorate-CjaqqbUP.mjs → decorate-Bl-JF_YY.mjs} +1 -1
- package/lib/{decorate-CjaqqbUP.mjs.map → decorate-Bl-JF_YY.mjs.map} +1 -1
- package/lib/dimensioning-helper-BEGkpZFA.mjs +2 -0
- package/lib/{dimensioning-helper-Cgao7A18.mjs → dimensioning-helper-ChQDwSjn.mjs} +4 -4
- package/lib/{dimensioning-helper-Cgao7A18.mjs.map → dimensioning-helper-ChQDwSjn.mjs.map} +1 -1
- package/lib/{dist-Blgk0vU0.mjs → dist-BZTF7IJN.mjs} +1 -1
- package/lib/{dist-Blgk0vU0.mjs.map → dist-BZTF7IJN.mjs.map} +1 -1
- package/lib/{fflate.module-DTkA0kF8.mjs → fflate.module-Cx1QFI2-.mjs} +1 -1
- package/lib/{fflate.module-DTkA0kF8.mjs.map → fflate.module-Cx1QFI2-.mjs.map} +1 -1
- package/lib/{glb-viewer-DtyiyPiY.mjs → glb-viewer-27e6wfY4.mjs} +6 -6
- package/lib/{glb-viewer-DtyiyPiY.mjs.map → glb-viewer-27e6wfY4.mjs.map} +1 -1
- package/lib/glb-viewer-Dc2Tl8Ef.mjs +2 -0
- package/lib/{highlight-coordinator-DOO-54ml.mjs → highlight-coordinator-C05kDjj5.mjs} +12 -11
- package/lib/highlight-coordinator-C05kDjj5.mjs.map +1 -0
- package/lib/{homag-intelligence-BOqc8-8E.mjs → homag-intelligence-BRQ1WoQo.mjs} +6 -3
- package/lib/homag-intelligence-BRQ1WoQo.mjs.map +1 -0
- package/lib/{imos-ix-poc-export-helper-DRQK_p2h.mjs → imos-ix-poc-export-helper-DhxAAMc9.mjs} +3 -3
- package/lib/{imos-ix-poc-export-helper-DRQK_p2h.mjs.map → imos-ix-poc-export-helper-DhxAAMc9.mjs.map} +1 -1
- package/lib/{kernel-utils-voLUOj-0.mjs → kernel-utils-BvatnA7U.mjs} +2 -2
- package/lib/kernel-utils-BvatnA7U.mjs.map +1 -0
- package/lib/{layer-DvZF9ur3.mjs → layer-DaGoZ5YI.mjs} +1 -1
- package/lib/{layer-DvZF9ur3.mjs.map → layer-DaGoZ5YI.mjs.map} +1 -1
- package/lib/{material-viewer-Dk8D8-8C.mjs → material-viewer-Byi5t7-x.mjs} +6 -6
- package/lib/{material-viewer-Dk8D8-8C.mjs.map → material-viewer-Byi5t7-x.mjs.map} +1 -1
- package/lib/{packages-xgEJ9vvB.mjs → packages-3jOdcfbr.mjs} +5 -5
- package/lib/{packages-xgEJ9vvB.mjs.map → packages-3jOdcfbr.mjs.map} +1 -1
- package/lib/{planner-aBm7Ihtu.mjs → planner-BeINcWRR.mjs} +3 -3
- package/lib/{planner-aBm7Ihtu.mjs.map → planner-BeINcWRR.mjs.map} +1 -1
- package/lib/planner-Ler1UMAp.mjs +2 -0
- package/lib/{plugin-system-vlnG8j2T.mjs → plugin-system-DR5maiUo.mjs} +3 -3
- package/lib/{plugin-system-vlnG8j2T.mjs.map → plugin-system-DR5maiUo.mjs.map} +1 -1
- package/lib/render-cache-DCPIQbO1.mjs +150 -0
- package/lib/render-cache-DCPIQbO1.mjs.map +1 -0
- package/lib/render-order-BPF2wDMw.mjs +26 -0
- package/lib/render-order-BPF2wDMw.mjs.map +1 -0
- package/lib/{roomle-headless-setup-DbO_rLjK.mjs → roomle-headless-setup-ps3I0vOP.mjs} +1 -1
- package/lib/{roomle-headless-setup-DbO_rLjK.mjs.map → roomle-headless-setup-ps3I0vOP.mjs.map} +1 -1
- package/lib/roomle-headless.d.ts +27 -21
- package/lib/roomle-headless.js +15 -15
- package/lib/{roomle-renderer-FUqNfNIf.mjs → roomle-renderer-Ato6RMrd.mjs} +1 -1
- package/lib/{roomle-renderer-FUqNfNIf.mjs.map → roomle-renderer-Ato6RMrd.mjs.map} +1 -1
- package/lib/{roomle-sdk-k8Vvoclf.mjs → roomle-sdk-CsSQAqQG.mjs} +2777 -2626
- package/lib/roomle-sdk-CsSQAqQG.mjs.map +1 -0
- package/lib/roomle-sdk.d.ts +27 -21
- package/lib/roomle-sdk.js +7 -7
- package/lib/{roomle-webgpu-renderer-Dv_s6ZN-.mjs → roomle-webgpu-renderer-BBE14A8V.mjs} +7 -7
- package/lib/{roomle-webgpu-renderer-Dv_s6ZN-.mjs.map → roomle-webgpu-renderer-BBE14A8V.mjs.map} +1 -1
- package/lib/{scene-renderer-nIOJ3nuy.mjs → scene-renderer-B8SBMSQ7.mjs} +231 -372
- package/lib/scene-renderer-B8SBMSQ7.mjs.map +1 -0
- package/lib/{script-loader-BTeojHth.mjs → script-loader-Dx3gOiB3.mjs} +3 -3
- package/lib/{script-loader-BTeojHth.mjs.map → script-loader-Dx3gOiB3.mjs.map} +1 -1
- package/lib/{shading-settings-CRNmMpcn.mjs → shading-settings-BBhR7KcS.mjs} +2 -2
- package/lib/{shading-settings-CRNmMpcn.mjs.map → shading-settings-BBhR7KcS.mjs.map} +1 -1
- 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/src/embind/plannerCoreCallback.d.ts +1 -1
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/plannerCoreCallback.js +3 -3
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/plannerCoreCallback.js.map +1 -1
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/plannerCoreInterface.d.ts +1 -7
- 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-iprJJmBn.mjs → stats-helper-W654V5ay.mjs} +3 -3
- package/lib/{stats-helper-iprJJmBn.mjs.map → stats-helper-W654V5ay.mjs.map} +1 -1
- package/lib/{svgo.browser-EB1zkPfG.mjs → svgo.browser-xZ3L7awG.mjs} +1 -1
- package/lib/{svgo.browser-EB1zkPfG.mjs.map → svgo.browser-xZ3L7awG.mjs.map} +1 -1
- package/lib/{three.tsl-DO_HZZuJ.mjs → three.tsl-B7hcNZE8.mjs} +2 -2
- package/lib/{three.tsl-DO_HZZuJ.mjs.map → three.tsl-B7hcNZE8.mjs.map} +1 -1
- package/lib/{three.tsl-BZfU6fFt.mjs → three.tsl-BBUCm-uB.mjs} +1 -1
- package/lib/{three.webgpu-bR4-ABJu.mjs → three.webgpu-ClICiWlK.mjs} +1 -1
- package/lib/{three.webgpu-ylONY593.mjs → three.webgpu-D3nSEIjD.mjs} +1 -1
- package/lib/{three.webgpu-ylONY593.mjs.map → three.webgpu-D3nSEIjD.mjs.map} +1 -1
- package/lib/{threejs-utils-D4TdXXAR.mjs → threejs-utils-WK7Uu2TS.mjs} +4 -4
- package/lib/threejs-utils-WK7Uu2TS.mjs.map +1 -0
- package/lib/{tools-core-La7SIpTQ.mjs → tools-core-CWrR_N9g.mjs} +3 -3
- package/lib/{tools-core-La7SIpTQ.mjs.map → tools-core-CWrR_N9g.mjs.map} +1 -1
- package/lib/{webgpu-C14yfIYy.mjs → webgpu-DSecxaB8.mjs} +3 -3
- package/lib/{webgpu-C14yfIYy.mjs.map → webgpu-DSecxaB8.mjs.map} +1 -1
- package/lib/workers-B-AqdQMe.mjs +6 -0
- package/lib/{workers-YGDNEfpU.mjs.map → workers-B-AqdQMe.mjs.map} +1 -1
- package/package.json +2 -2
- package/lib/asset-loader.worker-eqHzNAwa.mjs.map +0 -1
- package/lib/budgeteer.sw-BUMElkO1.mjs.map +0 -1
- package/lib/component-dimensioning-Dao60YO2.mjs.map +0 -1
- package/lib/configurator-Bj51dFg6.mjs +0 -2
- package/lib/dimensioning-helper-0s61LK9R.mjs +0 -2
- package/lib/glb-viewer-CUyHqGdt.mjs +0 -2
- package/lib/highlight-coordinator-DOO-54ml.mjs.map +0 -1
- package/lib/homag-intelligence-BOqc8-8E.mjs.map +0 -1
- package/lib/kernel-utils-voLUOj-0.mjs.map +0 -1
- package/lib/planner-DIz5mFvC.mjs +0 -2
- package/lib/roomle-sdk-k8Vvoclf.mjs.map +0 -1
- package/lib/scene-renderer-nIOJ3nuy.mjs.map +0 -1
- package/lib/threejs-utils-D4TdXXAR.mjs.map +0 -1
- package/lib/workers-YGDNEfpU.mjs +0 -6
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { j as e } from "./threejs-utils-
|
|
2
|
-
import { An as t, Ci as n, Di as r, E 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
|
|
3
|
-
import { r as
|
|
4
|
-
import { C as
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
import "./
|
|
1
|
+
import { j as e } from "./threejs-utils-WK7Uu2TS.mjs";
|
|
2
|
+
import { An as t, Ci as n, Di as r, E 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 v, _n as ee, at as te, bn as y, cn as b, ct as x, en as ne, f as re, fn as ie, gi as ae, gn as oe, h as se, hn as ce, ht as le, kr as ue, ln as S, mi 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, wi as O, y as ve, z as ye, zt as be } from "./three.core-0KaTx8dm.mjs";
|
|
3
|
+
import { r as xe } from "./three.module-dym6j3lO.mjs";
|
|
4
|
+
import { C as Se, D as Ce, E as we, O as k, S as A, T as Te, _ as Ee, a as De, b as j, d as Oe, f as M, g as N, h as ke, i as Ae, l as P, m as je, n as Me, o as Ne, p as Pe, r as Fe, s as Ie, t as Le, u as F, v as Re, w as I, x as L, y as R } from "./shading-settings-BBhR7KcS.mjs";
|
|
5
|
+
import { n as z, t as B } from "./Pass-DLiMLT5k.mjs";
|
|
6
|
+
import { t as ze } from "./render-order-BPF2wDMw.mjs";
|
|
7
|
+
import { n as Be, r as Ve, t as He } from "./decorate-Bl-JF_YY.mjs";
|
|
8
|
+
import "./dimensioning-helper-ChQDwSjn.mjs";
|
|
9
|
+
import { a as V, i as H, n as Ue, o as We, r as Ge, t as Ke } from "./render-cache-DCPIQbO1.mjs";
|
|
8
10
|
//#region packages/common-core/src/webgl/renderer/objects/shadow-ground-plane.ts
|
|
9
|
-
var
|
|
11
|
+
var U = class e extends b {
|
|
10
12
|
static {
|
|
11
13
|
this.alphaMap = !0;
|
|
12
14
|
}
|
|
@@ -17,7 +19,7 @@ var He = class e extends b {
|
|
|
17
19
|
depthWrite: !1,
|
|
18
20
|
polygonOffset: !0,
|
|
19
21
|
name: "ShadowGroundPlaneMaterial"
|
|
20
|
-
})), this.name = "ShadowGroundPlane", this.userData.isFloor = !0, this.renderOrder =
|
|
22
|
+
})), this.name = "ShadowGroundPlane", this.userData.isFloor = !0, this.renderOrder = ze.SHADOW_GROUND_PLANE, this.receiveShadow = !1, this.layers.disableAll(), r && this.updateMaterial(r), this.setShadowMap(n);
|
|
21
23
|
}
|
|
22
24
|
setVisibility(e) {
|
|
23
25
|
this.visible = e, this.setVisibilityLayers(e);
|
|
@@ -40,7 +42,7 @@ var He = class e extends b {
|
|
|
40
42
|
let t = this.material;
|
|
41
43
|
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;
|
|
42
44
|
}
|
|
43
|
-
},
|
|
45
|
+
}, W = class extends z {
|
|
44
46
|
get renderPassManager() {
|
|
45
47
|
return this._renderPassManager;
|
|
46
48
|
}
|
|
@@ -65,19 +67,19 @@ var He = class e extends b {
|
|
|
65
67
|
render(e, t, n, r, i) {
|
|
66
68
|
this.renderPass(e);
|
|
67
69
|
}
|
|
68
|
-
},
|
|
70
|
+
}, G = {
|
|
69
71
|
uniforms: {
|
|
70
72
|
tDiffuse: { value: null },
|
|
71
73
|
intensity: { value: new d(1, 1) }
|
|
72
74
|
},
|
|
73
75
|
vertexShader: "\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",
|
|
74
76
|
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 }"
|
|
75
|
-
},
|
|
77
|
+
}, qe = class extends p {
|
|
76
78
|
constructor(e) {
|
|
77
79
|
super({
|
|
78
|
-
uniforms:
|
|
79
|
-
vertexShader:
|
|
80
|
-
fragmentShader:
|
|
80
|
+
uniforms: w.clone(G.uniforms),
|
|
81
|
+
vertexShader: G.vertexShader,
|
|
82
|
+
fragmentShader: G.fragmentShader,
|
|
81
83
|
transparent: !0,
|
|
82
84
|
depthTest: !1,
|
|
83
85
|
depthWrite: !1,
|
|
@@ -92,25 +94,25 @@ var He = class e extends b {
|
|
|
92
94
|
update(e) {
|
|
93
95
|
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;
|
|
94
96
|
}
|
|
95
|
-
},
|
|
96
|
-
let i =
|
|
97
|
+
}, Je = (e, t, n, r) => {
|
|
98
|
+
let i = Ye(e, t, n, r), a = "vec3[SAMPLES](";
|
|
97
99
|
for (let t = 0; t < e; t++) {
|
|
98
100
|
let n = i[t];
|
|
99
101
|
a += `vec3(${n.x}, ${n.y}, ${n.z})${t < e - 1 ? "," : ")"}`;
|
|
100
102
|
}
|
|
101
103
|
return a;
|
|
102
|
-
},
|
|
104
|
+
}, Ye = (e, t, r, i) => {
|
|
103
105
|
let a = [];
|
|
104
106
|
for (let o = 0; o < e; o++) {
|
|
105
107
|
let s = 2 * Math.PI * t * o / e, c = (1 + (r - 1) * (o / (e - 1)) ** i) / r;
|
|
106
108
|
a.push(new n(Math.cos(s), Math.sin(s), c));
|
|
107
109
|
}
|
|
108
110
|
return a;
|
|
109
|
-
},
|
|
111
|
+
}, K = {
|
|
110
112
|
name: "PoissonDenoiseShader",
|
|
111
113
|
defines: {
|
|
112
114
|
SAMPLES: 16,
|
|
113
|
-
SAMPLE_VECTORS:
|
|
115
|
+
SAMPLE_VECTORS: Je(16, 2.89, 4, 1.3),
|
|
114
116
|
NV_ALIGNED_SAMPLES: 0,
|
|
115
117
|
SAMPLE_DISTRIBUTION: 0,
|
|
116
118
|
DEPTH_VALUE_SOURCE: 0,
|
|
@@ -126,9 +128,9 @@ var He = class e extends b {
|
|
|
126
128
|
tDepth: { value: null },
|
|
127
129
|
tNoise: { value: null },
|
|
128
130
|
resolution: { value: new d() },
|
|
129
|
-
cameraProjectionMatrix: { value: new
|
|
130
|
-
cameraProjectionMatrixInverse: { value: new
|
|
131
|
-
cameraWorldMatrix: { value: new
|
|
131
|
+
cameraProjectionMatrix: { value: new E() },
|
|
132
|
+
cameraProjectionMatrixInverse: { value: new E() },
|
|
133
|
+
cameraWorldMatrix: { value: new E() },
|
|
132
134
|
lumaPhi: { value: 5 },
|
|
133
135
|
depthPhi: { value: 1 },
|
|
134
136
|
normalPhi: { value: 1 },
|
|
@@ -141,7 +143,7 @@ var He = class e extends b {
|
|
|
141
143
|
},
|
|
142
144
|
vertexShader: "\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
143
145
|
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}"
|
|
144
|
-
},
|
|
146
|
+
}, Xe = {
|
|
145
147
|
iterations: 2,
|
|
146
148
|
samples: 16,
|
|
147
149
|
rings: 2.89,
|
|
@@ -151,7 +153,7 @@ var He = class e extends b {
|
|
|
151
153
|
depthPhi: 2.5,
|
|
152
154
|
normalPhi: .5,
|
|
153
155
|
nvOrientatedSamples: !1
|
|
154
|
-
},
|
|
156
|
+
}, Ze = class {
|
|
155
157
|
get texture() {
|
|
156
158
|
return this.parameters.iterations > 0 && this._renderTargets.length > 0 ? this._renderTargets[this._outputRenderTargetIndex].texture : this._inputTexture;
|
|
157
159
|
}
|
|
@@ -159,11 +161,11 @@ var He = class e extends b {
|
|
|
159
161
|
this._inputTexture = e;
|
|
160
162
|
}
|
|
161
163
|
constructor(e, t, n, r) {
|
|
162
|
-
this.needsUpdate = !0, this.parameters = { ...
|
|
164
|
+
this.needsUpdate = !0, this.parameters = { ...Xe }, this._width = 0, this._height = 0, this._samples = 0, this._normalVectorSourceType = F.FLOAT_BUFFER_NORMAL, this._depthValueSourceType = P.NORMAL_VECTOR_ALPHA, this._inputTexture = null, this.depthTexture = null, this.normalTexture = null, this._noiseTexture = null, this._renderTargets = [], this._outputRenderTargetIndex = 0, this._passRenderer = new Pe(), this._rgInputTexture = !1, this._luminanceWeighted = !0, this._width = e, this._height = t, this._samples = n, this._normalVectorSourceType = r?.normalVectorSourceType || F.FLOAT_BUFFER_NORMAL, this._depthValueSourceType = r?.depthValueSourceType || P.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);
|
|
163
165
|
}
|
|
164
166
|
_getNoiseTexture(e = 64) {
|
|
165
167
|
if (!this._noiseTexture) {
|
|
166
|
-
let t = new
|
|
168
|
+
let t = new ke(), n = new Uint8Array(e * e * 4);
|
|
167
169
|
for (let r = 0; r < e; r++) for (let i = 0; i < e; i++) {
|
|
168
170
|
let a = r, o = i;
|
|
169
171
|
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;
|
|
@@ -175,19 +177,19 @@ var He = class e extends b {
|
|
|
175
177
|
_getMaterial(e, t) {
|
|
176
178
|
let n = t;
|
|
177
179
|
return this._pdMaterial || (this._pdMaterial = new p({
|
|
178
|
-
defines: Object.assign({},
|
|
179
|
-
uniforms:
|
|
180
|
-
vertexShader:
|
|
181
|
-
fragmentShader:
|
|
180
|
+
defines: Object.assign({}, K.defines),
|
|
181
|
+
uniforms: w.clone(K.uniforms),
|
|
182
|
+
vertexShader: K.vertexShader,
|
|
183
|
+
fragmentShader: K.fragmentShader,
|
|
182
184
|
depthTest: !1,
|
|
183
185
|
depthWrite: !1
|
|
184
186
|
}), this._pdMaterial.uniforms.tNoise.value = this._getNoiseTexture(), n = !0), n && this._updateShader(this._pdMaterial), this._updateUniforms(this._pdMaterial, e, n), this._pdMaterial;
|
|
185
187
|
}
|
|
186
188
|
_updateShader(e) {
|
|
187
|
-
e.defines.SAMPLES = this.parameters.samples, e.defines.SAMPLE_VECTORS =
|
|
189
|
+
e.defines.SAMPLES = this.parameters.samples, e.defines.SAMPLE_VECTORS = Je(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 === F.FLOAT_BUFFER_NORMAL ? 2 : 1, e.defines.DEPTH_VALUE_SOURCE = this._depthValueSourceType === P.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;
|
|
188
190
|
}
|
|
189
191
|
_updateUniforms(e, t, n) {
|
|
190
|
-
let r = this._depthValueSourceType ===
|
|
192
|
+
let r = this._depthValueSourceType === P.NORMAL_VECTOR_ALPHA ? this.normalTexture : this.depthTexture;
|
|
191
193
|
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)));
|
|
192
194
|
}
|
|
193
195
|
_getRenderTargets() {
|
|
@@ -236,12 +238,12 @@ var He = class e extends b {
|
|
|
236
238
|
let r = this._getMaterial(t, this.needsUpdate);
|
|
237
239
|
this.needsUpdate = !1, this._passRenderer.renderScreenSpace(e, r, n, 16777215, 1);
|
|
238
240
|
}
|
|
239
|
-
},
|
|
241
|
+
}, q = {
|
|
240
242
|
OFF: "off",
|
|
241
243
|
HARD: "hard",
|
|
242
244
|
POISSON: "poisson",
|
|
243
245
|
FULL: "full"
|
|
244
|
-
},
|
|
246
|
+
}, Qe = { shadowRadius: .05 }, J = {
|
|
245
247
|
enabled: !0,
|
|
246
248
|
applyToMaterial: !0,
|
|
247
249
|
aoIntensity: .5,
|
|
@@ -250,9 +252,9 @@ var He = class e extends b {
|
|
|
250
252
|
shadowOnGround: !1,
|
|
251
253
|
alwaysUpdate: !1,
|
|
252
254
|
progressiveDenoiseIterations: 0
|
|
253
|
-
},
|
|
255
|
+
}, Y = class extends W {
|
|
254
256
|
static {
|
|
255
|
-
this.shadowTransform = new
|
|
257
|
+
this.shadowTransform = new E().set(0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1);
|
|
256
258
|
}
|
|
257
259
|
get aoAndSoftShadowRenderTarget() {
|
|
258
260
|
return this._aoAndSoftShadowRenderTarget = this._aoAndSoftShadowRenderTarget ?? new r(this._width, this._height, {
|
|
@@ -263,20 +265,20 @@ var He = class e extends b {
|
|
|
263
265
|
}), this._aoAndSoftShadowRenderTarget;
|
|
264
266
|
}
|
|
265
267
|
get aoRenderPass() {
|
|
266
|
-
return this._aoPass ||= new
|
|
267
|
-
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
268
|
-
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
268
|
+
return this._aoPass ||= new Ne(this._width, this._height, this._samples, !this.parameters.applyToMaterial, {
|
|
269
|
+
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? F.FLOAT_BUFFER_NORMAL : F.INPUT_RGB_NORMAL,
|
|
270
|
+
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? P.NORMAL_VECTOR_ALPHA : P.SEPARATE_BUFFER,
|
|
269
271
|
modulateRedChannel: !0,
|
|
270
272
|
aoParameters: this.parameters.ao
|
|
271
273
|
}), this._aoPass;
|
|
272
274
|
}
|
|
273
275
|
get softShadowPass() {
|
|
274
|
-
if (!this._softShadowPass) this._softShadowPass = new
|
|
276
|
+
if (!this._softShadowPass) this._softShadowPass = new Ze(this._width, this._height, this._samples, {
|
|
275
277
|
inputTexture: void 0,
|
|
276
278
|
depthTexture: this.gBufferTextures.depthBufferTexture,
|
|
277
279
|
normalTexture: this.gBufferTextures.gBufferTexture,
|
|
278
|
-
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
279
|
-
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
280
|
+
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? F.FLOAT_BUFFER_NORMAL : F.INPUT_RGB_NORMAL,
|
|
281
|
+
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? P.NORMAL_VECTOR_ALPHA : P.SEPARATE_BUFFER,
|
|
280
282
|
rgInputTexture: !0,
|
|
281
283
|
luminanceWeighted: !1,
|
|
282
284
|
fragmentOutput: "vec4(1.0, denoised.x, 0.0, 1.0)",
|
|
@@ -307,12 +309,12 @@ var He = class e extends b {
|
|
|
307
309
|
}), this._fadeRenderTarget;
|
|
308
310
|
}
|
|
309
311
|
get denoisePass() {
|
|
310
|
-
if (!this._poissonDenoisePass) this._poissonDenoisePass = new
|
|
312
|
+
if (!this._poissonDenoisePass) this._poissonDenoisePass = new Ze(this._width, this._height, this._samples, {
|
|
311
313
|
inputTexture: this.aoAndSoftShadowRenderTarget.texture,
|
|
312
314
|
depthTexture: this.gBufferTextures.depthBufferTexture,
|
|
313
315
|
normalTexture: this.gBufferTextures.gBufferTexture,
|
|
314
|
-
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
315
|
-
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
316
|
+
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? F.FLOAT_BUFFER_NORMAL : F.INPUT_RGB_NORMAL,
|
|
317
|
+
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? P.NORMAL_VECTOR_ALPHA : P.SEPARATE_BUFFER,
|
|
316
318
|
rgInputTexture: !0,
|
|
317
319
|
luminanceWeighted: !1,
|
|
318
320
|
fragmentOutput: "vec4(denoised.xy, vec2(fract(depth * 1024.0), floor(depth * 1024.0)))",
|
|
@@ -333,23 +335,23 @@ var He = class e extends b {
|
|
|
333
335
|
constructor(e, t, n, r, i) {
|
|
334
336
|
super(e), this.needsUpdate = !0, this.renderToRenderTarget = !1, this.shadowAndAoPassSettings = {
|
|
335
337
|
shadowMapTexture: null,
|
|
336
|
-
shadowBlurType:
|
|
337
|
-
shadowFadeInBlurType:
|
|
338
|
+
shadowBlurType: q.FULL,
|
|
339
|
+
shadowFadeInBlurType: q.FULL,
|
|
338
340
|
shadowFadeInMix: 0,
|
|
339
341
|
noOStaticFrames: 0
|
|
340
|
-
}, this._cameraUpdate = new
|
|
341
|
-
enabled: i?.enabled ??
|
|
342
|
-
applyToMaterial: i?.applyToMaterial ??
|
|
343
|
-
aoIntensity: i?.aoIntensity ??
|
|
344
|
-
shadowIntensity: i?.shadowIntensity ??
|
|
345
|
-
aoOnGround: i?.aoOnGround ??
|
|
346
|
-
shadowOnGround: i?.shadowOnGround ??
|
|
347
|
-
alwaysUpdate: i?.alwaysUpdate ??
|
|
348
|
-
progressiveDenoiseIterations: i?.progressiveDenoiseIterations ??
|
|
349
|
-
shadow: { ...
|
|
350
|
-
ao: { ...
|
|
351
|
-
poissonDenoise: { ...
|
|
352
|
-
}, this._copyMaterial = new
|
|
342
|
+
}, this._cameraUpdate = new M(), this._finalTexture = null, this._onlyHardShadow = !1, this._width = t, this._height = n, this._samples = r, this.parameters = {
|
|
343
|
+
enabled: i?.enabled ?? J.enabled,
|
|
344
|
+
applyToMaterial: i?.applyToMaterial ?? J.applyToMaterial,
|
|
345
|
+
aoIntensity: i?.aoIntensity ?? J.aoIntensity,
|
|
346
|
+
shadowIntensity: i?.shadowIntensity ?? J.shadowIntensity,
|
|
347
|
+
aoOnGround: i?.aoOnGround ?? J.aoOnGround,
|
|
348
|
+
shadowOnGround: i?.shadowOnGround ?? J.shadowOnGround,
|
|
349
|
+
alwaysUpdate: i?.alwaysUpdate ?? J.alwaysUpdate,
|
|
350
|
+
progressiveDenoiseIterations: i?.progressiveDenoiseIterations ?? J.progressiveDenoiseIterations,
|
|
351
|
+
shadow: { ...Qe },
|
|
352
|
+
ao: { ...Ie },
|
|
353
|
+
poissonDenoise: { ...Xe }
|
|
354
|
+
}, this._copyMaterial = new j(), this._blendMaterial = new j({}, R.DEFAULT), this._blendAoAndShadowMaterial = new qe();
|
|
353
355
|
}
|
|
354
356
|
dispose() {
|
|
355
357
|
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();
|
|
@@ -375,19 +377,19 @@ var He = class e extends b {
|
|
|
375
377
|
updateBounds(e, t) {
|
|
376
378
|
this._softShadowPass?.updateBounds(e.bounds), this._aoPass?.updateBounds(e.bounds, t);
|
|
377
379
|
}
|
|
378
|
-
_getRenderConditions(e =
|
|
379
|
-
let r = e ===
|
|
380
|
+
_getRenderConditions(e = q.FULL, t = 0, n = 0) {
|
|
381
|
+
let r = e === q.POISSON && t > .001, i = e === q.HARD && t > .001 && t < .999;
|
|
380
382
|
return {
|
|
381
383
|
fadeInPoissonShadow: r,
|
|
382
384
|
fadeInHardShadow: i,
|
|
383
|
-
onlyHardShadow: e ===
|
|
385
|
+
onlyHardShadow: e === q.HARD && !i,
|
|
384
386
|
progressiveDenoise: !r && !i && n > 1 && n <= this.parameters.progressiveDenoiseIterations + 1
|
|
385
387
|
};
|
|
386
388
|
}
|
|
387
389
|
renderPass(e) {
|
|
388
390
|
if (!this._setRenderState()) return;
|
|
389
391
|
let t = this._getRenderConditions(this.shadowAndAoPassSettings.shadowFadeInBlurType, this.shadowAndAoPassSettings.shadowFadeInMix, this.shadowAndAoPassSettings.noOStaticFrames), n = !1;
|
|
390
|
-
!t.onlyHardShadow && this.shadowAndAoPassSettings.shadowBlurType ===
|
|
392
|
+
!t.onlyHardShadow && this.shadowAndAoPassSettings.shadowBlurType === q.FULL && this._evaluateIfUpdateIsNeeded(this.camera) && (this._renderShadowAndAo(e, this.scene, this.camera, this.shadowAndAoPassSettings.shadowMapTexture), n = !0);
|
|
391
393
|
let r = t.onlyHardShadow ? this.shadowAndAoPassSettings.shadowMapTexture : this.denoiseRenderTargetTexture;
|
|
392
394
|
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);
|
|
393
395
|
}
|
|
@@ -418,13 +420,13 @@ var He = class e extends b {
|
|
|
418
420
|
return i && (this._copyMaterial.update({
|
|
419
421
|
texture: t,
|
|
420
422
|
blending: 0,
|
|
421
|
-
colorTransform:
|
|
422
|
-
colorBase:
|
|
423
|
+
colorTransform: L,
|
|
424
|
+
colorBase: k,
|
|
423
425
|
multiplyChannels: 0
|
|
424
426
|
}), this.passRenderer.renderScreenSpace(e, this._copyMaterial, this.fadeRenderTarget)), r > .001 && (this._blendMaterial.update({
|
|
425
427
|
texture: n,
|
|
426
428
|
blending: i ? 5 : 0,
|
|
427
|
-
colorTransform: new
|
|
429
|
+
colorTransform: new E().set(0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, i ? r : 1),
|
|
428
430
|
multiplyChannels: 0
|
|
429
431
|
}), this.passRenderer.renderScreenSpace(e, this._blendMaterial, this.fadeRenderTarget)), this.fadeRenderTarget.texture;
|
|
430
432
|
}
|
|
@@ -441,7 +443,7 @@ var He = class e extends b {
|
|
|
441
443
|
shadowIntensity: n
|
|
442
444
|
}), e.getRenderTarget());
|
|
443
445
|
}
|
|
444
|
-
},
|
|
446
|
+
}, $e = class {
|
|
445
447
|
get isOutlinePassActivated() {
|
|
446
448
|
return this.outlinePassActivated;
|
|
447
449
|
}
|
|
@@ -481,169 +483,26 @@ var He = class e extends b {
|
|
|
481
483
|
updateOutline(e, t, n) {
|
|
482
484
|
n.length > 0 ? (this._parameterNeedsUpdate && this.applyParameters(), this.activateOutline(e, t), this.outlinePass && (this.outlinePass.selectedObjects = n)) : this.deactivateOutline();
|
|
483
485
|
}
|
|
484
|
-
}, 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 oe && e.transmission > 0, Xe = class {
|
|
485
|
-
constructor(e) {
|
|
486
|
-
this.needsUpdate = !0, this._cache = null, this._cache = e;
|
|
487
|
-
}
|
|
488
|
-
dispose() {
|
|
489
|
-
this._cache?.dispose();
|
|
490
|
-
}
|
|
491
|
-
clear() {
|
|
492
|
-
this._cache?.clear(), this.needsUpdate = !0;
|
|
493
|
-
}
|
|
494
|
-
update(e) {
|
|
495
|
-
!this.needsUpdate || !this._cache || (e.traverse((e) => {
|
|
496
|
-
e.isLine || e.isPoints ? this._cache?.addLineOrPoint(e) : e.isMesh ? this._cache?.addMesh(e) : this._cache?.addObject(e);
|
|
497
|
-
}), this.needsUpdate = !1);
|
|
498
|
-
}
|
|
499
|
-
onBeforeRender() {
|
|
500
|
-
this._cache?.onBeforeRender();
|
|
501
|
-
}
|
|
502
|
-
onAfterRender() {
|
|
503
|
-
this._cache?.onAfterRender();
|
|
504
|
-
}
|
|
505
|
-
}, Ze = class {
|
|
506
|
-
constructor() {
|
|
507
|
-
this._cacheMap = /* @__PURE__ */ new Map();
|
|
508
|
-
}
|
|
509
|
-
dispose() {
|
|
510
|
-
this._cacheMap.forEach((e) => {
|
|
511
|
-
e.dispose();
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
registerCache(e, t) {
|
|
515
|
-
this._cacheMap.set(e, new Xe(t));
|
|
516
|
-
}
|
|
517
|
-
clearCache() {
|
|
518
|
-
this._cacheMap.forEach((e) => {
|
|
519
|
-
e.clear();
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
clearObjectCache(e) {
|
|
523
|
-
let t = this._cacheMap.get(e);
|
|
524
|
-
t && t.clear();
|
|
525
|
-
}
|
|
526
|
-
onBeforeRender(e, t) {
|
|
527
|
-
let n = this._cacheMap.get(e);
|
|
528
|
-
n && (n.update(t), n.onBeforeRender());
|
|
529
|
-
}
|
|
530
|
-
onAfterRender(e) {
|
|
531
|
-
let t = this._cacheMap.get(e);
|
|
532
|
-
t && t.onAfterRender();
|
|
533
|
-
}
|
|
534
|
-
render(e, t, n) {
|
|
535
|
-
let r = this._cacheMap.get(e);
|
|
536
|
-
r && (r.update(t), r.onBeforeRender());
|
|
537
|
-
try {
|
|
538
|
-
n();
|
|
539
|
-
} finally {
|
|
540
|
-
r && r.onAfterRender();
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
}, Y = class {
|
|
544
|
-
constructor(e) {
|
|
545
|
-
this._visibilityToRestore = /* @__PURE__ */ new Map(), this._isObjectInvisible = e;
|
|
546
|
-
}
|
|
547
|
-
dispose() {
|
|
548
|
-
this.clear();
|
|
549
|
-
}
|
|
550
|
-
clear() {
|
|
551
|
-
this._visibilityToRestore.clear();
|
|
552
|
-
}
|
|
553
|
-
addLineOrPoint(e) {
|
|
554
|
-
this._visibilityToRestore.set(e, e.visible);
|
|
555
|
-
}
|
|
556
|
-
addMesh(e) {
|
|
557
|
-
this._isObjectInvisible && this._isObjectInvisible(e) && this._visibilityToRestore.set(e, e.visible);
|
|
558
|
-
}
|
|
559
|
-
addObject(e) {
|
|
560
|
-
this._isObjectInvisible && this._isObjectInvisible(e) && this._visibilityToRestore.set(e, e.visible);
|
|
561
|
-
}
|
|
562
|
-
onBeforeRender() {
|
|
563
|
-
this._visibilityToRestore.forEach((e, t) => {
|
|
564
|
-
this._visibilityToRestore.set(t, t.visible), t.visible = !1;
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
onAfterRender() {
|
|
568
|
-
this._visibilityToRestore.forEach((e, t) => {
|
|
569
|
-
t.visible = e;
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
}, Qe = class {
|
|
573
|
-
constructor(e) {
|
|
574
|
-
this._depthWriteCache = /* @__PURE__ */ new Set(), this._doNotWriteDepth = e;
|
|
575
|
-
}
|
|
576
|
-
dispose() {
|
|
577
|
-
this._depthWriteCache.clear();
|
|
578
|
-
}
|
|
579
|
-
clear() {
|
|
580
|
-
this._depthWriteCache.clear();
|
|
581
|
-
}
|
|
582
|
-
addLineOrPoint(e) {}
|
|
583
|
-
addObject(e) {}
|
|
584
|
-
addMesh(e) {
|
|
585
|
-
this._doNotWriteDepth && this._doNotWriteDepth(e) && e.material instanceof v && e.material.depthWrite && this._depthWriteCache.add(e.material);
|
|
586
|
-
}
|
|
587
|
-
onBeforeRender() {
|
|
588
|
-
this._depthWriteCache.forEach((e) => {
|
|
589
|
-
e.depthWrite = !1;
|
|
590
|
-
});
|
|
591
|
-
}
|
|
592
|
-
onAfterRender() {
|
|
593
|
-
this._depthWriteCache.forEach((e) => {
|
|
594
|
-
e.depthWrite = !0;
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
}, $e = class e {
|
|
598
|
-
constructor() {
|
|
599
|
-
this._objectCache = /* @__PURE__ */ new Map();
|
|
600
|
-
}
|
|
601
|
-
clear() {
|
|
602
|
-
this._objectCache.clear();
|
|
603
|
-
}
|
|
604
|
-
onBeforeRender() {
|
|
605
|
-
this._objectCache.forEach((t, n) => {
|
|
606
|
-
e._writeObjectDataInto(n, t.originalObjectData), this._updateObject(n, t.updateObjectData);
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
onAfterRender() {
|
|
610
|
-
this._objectCache.forEach((e, t) => {
|
|
611
|
-
this._updateObject(t, e.originalObjectData);
|
|
612
|
-
});
|
|
613
|
-
}
|
|
614
|
-
addToCache(t, n) {
|
|
615
|
-
let r = {};
|
|
616
|
-
e._writeObjectDataInto(t, r), this._objectCache.set(t, {
|
|
617
|
-
originalObjectData: r,
|
|
618
|
-
updateObjectData: n
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
static _writeObjectDataInto(e, t) {
|
|
622
|
-
t.visible = e.visible, t.castShadow = e.castShadow, t.receiveShadow = e instanceof b ? e.receiveShadow : void 0, t.material = e instanceof b ? e.material : void 0;
|
|
623
|
-
}
|
|
624
|
-
_updateObject(e, t) {
|
|
625
|
-
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);
|
|
626
|
-
}
|
|
627
486
|
}, et = (e) => {
|
|
628
487
|
if (!e.isMesh || !e.castShadow && !e.userData?.meshId) return !1;
|
|
629
488
|
let t = e.material;
|
|
630
489
|
return !t.transparent || t.opacity > .5;
|
|
631
|
-
}, tt = class extends
|
|
490
|
+
}, tt = class extends W {
|
|
632
491
|
static {
|
|
633
492
|
this.addTestMesh = !1;
|
|
634
493
|
}
|
|
635
494
|
get shadowGroundPlane() {
|
|
636
495
|
let e = this._sharedShadowGroundPlane;
|
|
637
|
-
return e ||= (this._shadowGroundPlane ??= new
|
|
496
|
+
return e ||= (this._shadowGroundPlane ??= new U(this.renderTarget.texture, this.parameters), this._shadowGroundPlane), e.parent !== this._groundGroup && this._groundGroup.add(e), e;
|
|
638
497
|
}
|
|
639
498
|
constructor(e, t, n, i) {
|
|
640
|
-
super(e), this.limitPlaneSize = !0, this.needsUpdate = !0, this.noNeedOfUpdateCount = 0, this._blurScale = 1, this._shadowScale = 1, this._groundGroup = n, this.shadowMapSize = i.shadowMapSize ?? 2048, this.parameters = this._getDefaultParameters(i), this._groundShadowFar = this.parameters.cameraFar, this._renderer = t, this.renderCacheManager?.registerCache(this, new
|
|
499
|
+
super(e), this.limitPlaneSize = !0, this.needsUpdate = !0, this.noNeedOfUpdateCount = 0, this._blurScale = 1, this._shadowScale = 1, this._groundGroup = n, this.shadowMapSize = i.shadowMapSize ?? 2048, this.parameters = this._getDefaultParameters(i), this._groundShadowFar = this.parameters.cameraFar, this._renderer = t, this.renderCacheManager?.registerCache(this, new H((e) => e.isMesh && !et(e) || e.name !== void 0 && ["Ground", "Floor"].includes(e.name))), this.renderTarget = new r(this.shadowMapSize, this.shadowMapSize), this.renderTarget.texture.generateMipmaps = !1, this._renderTargetBlur = new r(this.shadowMapSize, this.shadowMapSize), this._renderTargetBlur.texture.generateMipmaps = !1, this._sharedShadowGroundPlane = i?.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) => {
|
|
641
500
|
e.uniforms.fadeoutBias = this._depthMaterial.userData.fadeoutBias, e.uniforms.fadeoutFalloff = this._depthMaterial.userData.fadeoutFalloff, e.fragmentShader = `
|
|
642
501
|
uniform float fadeoutBias;
|
|
643
502
|
uniform float fadeoutFalloff;
|
|
644
|
-
${e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );",
|
|
503
|
+
${e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );", U.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));")}
|
|
645
504
|
`;
|
|
646
|
-
}, this._depthMaterial.side = 2, this._depthMaterial.depthTest = !0, this._depthMaterial.depthWrite = !0, this._blurPass = new
|
|
505
|
+
}, this._depthMaterial.side = 2, this._depthMaterial.depthTest = !0, this._depthMaterial.depthWrite = !0, this._blurPass = new Oe(Re, {
|
|
647
506
|
...i,
|
|
648
507
|
passRenderer: this.renderPassManager.passRenderer
|
|
649
508
|
}), this.updatePlaneAndShadowCamera();
|
|
@@ -744,7 +603,7 @@ var He = class e extends b {
|
|
|
744
603
|
this.far = e, this.updateProjectionMatrix(), this.cameraHelper?.update();
|
|
745
604
|
}
|
|
746
605
|
updateCameraHelper(e, t) {
|
|
747
|
-
e ? (this.cameraHelper = this.cameraHelper ?? new
|
|
606
|
+
e ? (this.cameraHelper = this.cameraHelper ?? new ve(this), this.cameraHelper.visible = !0, t?.add(this.cameraHelper)) : this.cameraHelper?.parent && this.cameraHelper?.removeFromParent();
|
|
748
607
|
}
|
|
749
608
|
setCameraHelperVisibility(e) {
|
|
750
609
|
this.cameraHelper && (this.cameraHelper.visible = e);
|
|
@@ -771,7 +630,7 @@ var He = class e extends b {
|
|
|
771
630
|
FLOAT_BUFFER: t?.floatBufferType ? 1 : 0,
|
|
772
631
|
LINEAR_DEPTH: t?.linearDepth ? 1 : 0
|
|
773
632
|
}),
|
|
774
|
-
uniforms:
|
|
633
|
+
uniforms: w.clone(e._normalAndDepthShader.uniforms),
|
|
775
634
|
vertexShader: e._normalAndDepthShader.vertexShader,
|
|
776
635
|
fragmentShader: e._normalAndDepthShader.fragmentShader,
|
|
777
636
|
blending: t?.blending ?? 0
|
|
@@ -784,7 +643,7 @@ var He = class e extends b {
|
|
|
784
643
|
}
|
|
785
644
|
return this;
|
|
786
645
|
}
|
|
787
|
-
}, ot = class extends
|
|
646
|
+
}, ot = class extends W {
|
|
788
647
|
set groundDepthWrite(e) {
|
|
789
648
|
this._gBufferMaterialCache && (this._gBufferMaterialCache.groundDepthWrite = e);
|
|
790
649
|
}
|
|
@@ -850,19 +709,19 @@ var He = class e extends b {
|
|
|
850
709
|
this.passRenderer.renderWithOverrideMaterial(e, t, n, this.updateGBufferRenderMaterial(n), this.depthNormalRenderTarget, 7829503, 1);
|
|
851
710
|
}
|
|
852
711
|
getCopyMaterial(e) {
|
|
853
|
-
return this._copyMaterial ??= new
|
|
712
|
+
return this._copyMaterial ??= new j(), this._copyMaterial.update(e);
|
|
854
713
|
}
|
|
855
714
|
_copyDepthToSeparateDepthTexture(e, t) {
|
|
856
715
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
857
716
|
texture: t.texture,
|
|
858
717
|
blending: 0,
|
|
859
|
-
colorTransform:
|
|
860
|
-
colorBase:
|
|
718
|
+
colorTransform: Ee,
|
|
719
|
+
colorBase: N,
|
|
861
720
|
multiplyChannels: 0,
|
|
862
|
-
uvTransform:
|
|
721
|
+
uvTransform: A
|
|
863
722
|
}), this.separateDeptRenderTarget);
|
|
864
723
|
}
|
|
865
|
-
}, st = class extends
|
|
724
|
+
}, st = class extends Ue {
|
|
866
725
|
set groundDepthWrite(e) {
|
|
867
726
|
this._groundDepthWrite = e;
|
|
868
727
|
}
|
|
@@ -874,12 +733,12 @@ var He = class e extends b {
|
|
|
874
733
|
this.addToCache(e, { visible: !1 });
|
|
875
734
|
}
|
|
876
735
|
addMesh(e) {
|
|
877
|
-
e.userData.isFloor ? this.addToCache(e, { visible: this._groundDepthWrite }) : e.visible && (
|
|
736
|
+
e.userData.isFloor ? this.addToCache(e, { visible: this._groundDepthWrite }) : e.visible && (We(e.material, .7) || V(e.material)) && this.addToCache(e, { visible: !1 });
|
|
878
737
|
}
|
|
879
738
|
addObject(e) {
|
|
880
739
|
e.name === "dimensioning" && this.addToCache(e, { visible: !1 });
|
|
881
740
|
}
|
|
882
|
-
}, ct = class extends
|
|
741
|
+
}, ct = class extends W {
|
|
883
742
|
get reflectionRenderTarget() {
|
|
884
743
|
return this._reflectionRenderTarget = this._reflectionRenderTarget ?? this._newRenderTarget(!0), this._reflectionRenderTarget;
|
|
885
744
|
}
|
|
@@ -903,10 +762,10 @@ var He = class e extends b {
|
|
|
903
762
|
groundReflectionScale: 1,
|
|
904
763
|
renderTargetDownScale: 4,
|
|
905
764
|
...i
|
|
906
|
-
}, this._copyMaterial = new
|
|
765
|
+
}, this._copyMaterial = new j({}, R.ADDITIVE, !0, !0), this._updateCopyMaterial(null), this._reflectionIntensityMaterial = new dt({
|
|
907
766
|
width: this._width / this.parameters.renderTargetDownScale,
|
|
908
767
|
height: this._height / this.parameters.renderTargetDownScale
|
|
909
|
-
}), this._blurPass = new
|
|
768
|
+
}), this._blurPass = new Oe(Re, {
|
|
910
769
|
...i,
|
|
911
770
|
passRenderer: this.renderPassManager.passRenderer
|
|
912
771
|
});
|
|
@@ -937,9 +796,9 @@ var He = class e extends b {
|
|
|
937
796
|
let n = this.parameters.intensity * t, r = this.parameters.brightness;
|
|
938
797
|
this._copyMaterial.update({
|
|
939
798
|
texture: e?.texture ?? void 0,
|
|
940
|
-
colorTransform: new
|
|
799
|
+
colorTransform: new E().set(r, 0, 0, 0, 0, r, 0, 0, 0, 0, r, 0, 0, 0, 0, n),
|
|
941
800
|
multiplyChannels: 0,
|
|
942
|
-
uvTransform:
|
|
801
|
+
uvTransform: Se
|
|
943
802
|
}), this._copyMaterial.depthTest = !0, this._copyMaterial.depthWrite = !1;
|
|
944
803
|
}
|
|
945
804
|
renderPass(e) {
|
|
@@ -990,9 +849,9 @@ var He = class e extends b {
|
|
|
990
849
|
resolution: { value: new d() },
|
|
991
850
|
cameraNear: { value: .1 },
|
|
992
851
|
cameraFar: { value: 1 },
|
|
993
|
-
cameraProjectionMatrix: { value: new
|
|
994
|
-
cameraInverseProjectionMatrix: { value: new
|
|
995
|
-
inverseViewMatrix: { value: new
|
|
852
|
+
cameraProjectionMatrix: { value: new E() },
|
|
853
|
+
cameraInverseProjectionMatrix: { value: new E() },
|
|
854
|
+
inverseViewMatrix: { value: new E() },
|
|
996
855
|
groundLevel: { value: 0 },
|
|
997
856
|
fadeOutDistance: { value: 1 },
|
|
998
857
|
fadeOutExponent: { value: 1 }
|
|
@@ -1009,7 +868,7 @@ var He = class e extends b {
|
|
|
1009
868
|
constructor(t) {
|
|
1010
869
|
super({
|
|
1011
870
|
defines: Object.assign({}, e.shader.defines),
|
|
1012
|
-
uniforms:
|
|
871
|
+
uniforms: w.clone(e.shader.uniforms),
|
|
1013
872
|
vertexShader: e.shader.vertexShader,
|
|
1014
873
|
fragmentShader: e.shader.fragmentShader,
|
|
1015
874
|
blending: 0
|
|
@@ -1026,7 +885,7 @@ var He = class e extends b {
|
|
|
1026
885
|
}
|
|
1027
886
|
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;
|
|
1028
887
|
}
|
|
1029
|
-
}, ft = class extends
|
|
888
|
+
}, ft = class extends be {
|
|
1030
889
|
constructor(e, t) {
|
|
1031
890
|
let n = [
|
|
1032
891
|
1,
|
|
@@ -1045,7 +904,7 @@ var He = class e extends b {
|
|
|
1045
904
|
1,
|
|
1046
905
|
0
|
|
1047
906
|
], r = new se();
|
|
1048
|
-
r.setAttribute("position", new
|
|
907
|
+
r.setAttribute("position", new ge(n, 3)), r.computeBoundingSphere();
|
|
1049
908
|
let i = new h({ fog: !1 });
|
|
1050
909
|
super(r, i), this.light = e, this.color = t, this.type = "RectAreaLightHelper";
|
|
1051
910
|
let a = [
|
|
@@ -1068,7 +927,7 @@ var He = class e extends b {
|
|
|
1068
927
|
-1,
|
|
1069
928
|
0
|
|
1070
929
|
], o = new se();
|
|
1071
|
-
o.setAttribute("position", new
|
|
930
|
+
o.setAttribute("position", new ge(a, 3)), o.computeBoundingSphere(), this.add(new b(o, new S({
|
|
1072
931
|
side: 1,
|
|
1073
932
|
fog: !1
|
|
1074
933
|
})));
|
|
@@ -1099,7 +958,7 @@ var He = class e extends b {
|
|
|
1099
958
|
this._sceneBoxMax = new n(1, 1, 1);
|
|
1100
959
|
}
|
|
1101
960
|
static {
|
|
1102
|
-
this._distributionProperties = new
|
|
961
|
+
this._distributionProperties = new O(1, 1, 1, 1);
|
|
1103
962
|
}
|
|
1104
963
|
constructor(e) {
|
|
1105
964
|
super(e), this.customProgramCacheKey = this._customProgramCacheKey, this.onBeforeCompile = this._onBeforeCompile;
|
|
@@ -1137,7 +996,7 @@ var He = class e extends b {
|
|
|
1137
996
|
groundBoundary: 1,
|
|
1138
997
|
fadeOutDistance: .1,
|
|
1139
998
|
fadeOutBlur: 5
|
|
1140
|
-
}, vt = class extends
|
|
999
|
+
}, vt = class extends W {
|
|
1141
1000
|
get shadowTexture() {
|
|
1142
1001
|
return this._shadowRenderTarget.texture;
|
|
1143
1002
|
}
|
|
@@ -1145,13 +1004,13 @@ var He = class e extends b {
|
|
|
1145
1004
|
this._shadowMapPassOverrideMaterialCache.shadowOnGround = e;
|
|
1146
1005
|
}
|
|
1147
1006
|
constructor(e, t, n) {
|
|
1148
|
-
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
|
|
1007
|
+
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 M(), this._viewportSize = new d(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);
|
|
1149
1008
|
let i = this._samples;
|
|
1150
1009
|
this._shadowRenderTarget = new r(this._viewportSize.x, this._viewportSize.y, {
|
|
1151
1010
|
samples: i,
|
|
1152
1011
|
format: ue,
|
|
1153
|
-
magFilter: this._samples > 0 ?
|
|
1154
|
-
minFilter: this._samples > 0 ?
|
|
1012
|
+
magFilter: this._samples > 0 ? T : y,
|
|
1013
|
+
minFilter: this._samples > 0 ? T : y
|
|
1155
1014
|
});
|
|
1156
1015
|
}
|
|
1157
1016
|
_getScreenSpaceShadowMapParameters(e) {
|
|
@@ -1184,7 +1043,7 @@ var He = class e extends b {
|
|
|
1184
1043
|
return this._shadowLightSources.find((t) => t.getOriginalLight() === e)?.getShadowLight();
|
|
1185
1044
|
}
|
|
1186
1045
|
addRectAreaLight(e, t) {
|
|
1187
|
-
let n = new
|
|
1046
|
+
let n = new St(e, {
|
|
1188
1047
|
shadowMapSize: this._shadowMapSize,
|
|
1189
1048
|
shadowLightSourceType: this.parameters.shadowLightSourceType
|
|
1190
1049
|
});
|
|
@@ -1194,14 +1053,14 @@ var He = class e extends b {
|
|
|
1194
1053
|
let n = this._shadowLightSources;
|
|
1195
1054
|
this._shadowLightSources = this._createShadowLightSourceArray(!1);
|
|
1196
1055
|
for (let r of n) {
|
|
1197
|
-
if (r instanceof
|
|
1056
|
+
if (r instanceof St) {
|
|
1198
1057
|
let t = r.getRectAreaLight();
|
|
1199
1058
|
e.includes(t) && (r.updatePositionAndTarget(), this._shadowLightSources.push(r));
|
|
1200
1059
|
}
|
|
1201
1060
|
r.removeFrom(t), r.dispose();
|
|
1202
1061
|
}
|
|
1203
1062
|
e.forEach((e) => {
|
|
1204
|
-
this._shadowLightSources.find((t) => t instanceof
|
|
1063
|
+
this._shadowLightSources.find((t) => t instanceof St && t.getRectAreaLight() === e) || this.addRectAreaLight(e, t);
|
|
1205
1064
|
}), this.needsUpdate = !0, this.shadowTypeNeedsUpdate = !0;
|
|
1206
1065
|
}
|
|
1207
1066
|
createShadowFromLightSources(e, t) {
|
|
@@ -1216,7 +1075,7 @@ var He = class e extends b {
|
|
|
1216
1075
|
e.forEach((e) => {
|
|
1217
1076
|
let r = e.maxIntensity * t;
|
|
1218
1077
|
if (r >= .1 && e.position.z >= 0) {
|
|
1219
|
-
let t = new
|
|
1078
|
+
let t = new Ct(new n(e.position.x, e.position.z, e.position.y).multiplyScalar(7), r, {
|
|
1220
1079
|
shadowMapSize: this._shadowMapSize,
|
|
1221
1080
|
shadowLightSourceType: this.parameters.shadowLightSourceType
|
|
1222
1081
|
});
|
|
@@ -1227,7 +1086,7 @@ var He = class e extends b {
|
|
|
1227
1086
|
_createShadowLightSourceArray(e) {
|
|
1228
1087
|
let t = [];
|
|
1229
1088
|
if (e) {
|
|
1230
|
-
let e = new
|
|
1089
|
+
let e = new wt(new n(0, 7, 0), { shadowMapSize: this._shadowMapSize });
|
|
1231
1090
|
t.push(e);
|
|
1232
1091
|
}
|
|
1233
1092
|
return this.parameters.enableGroundBoundary = e, t;
|
|
@@ -1276,7 +1135,7 @@ var He = class e extends b {
|
|
|
1276
1135
|
UNLIT: "unlit",
|
|
1277
1136
|
EMISSIVE: "emissive",
|
|
1278
1137
|
SHADOW: "shadow"
|
|
1279
|
-
}, yt = class e extends
|
|
1138
|
+
}, yt = class e extends Ue {
|
|
1280
1139
|
static {
|
|
1281
1140
|
this.useModifiedMaterial = !0;
|
|
1282
1141
|
}
|
|
@@ -1321,14 +1180,14 @@ var He = class e extends b {
|
|
|
1321
1180
|
e.isLight && !e.userData.shadowLightSource && this.addToCache(e, { visible: !1 });
|
|
1322
1181
|
}
|
|
1323
1182
|
_setMeshMaterialAndVisibility(e) {
|
|
1324
|
-
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) :
|
|
1183
|
+
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) : We(e.material, .9) ? this.addToCache(e, { visible: !1 }) : e.receiveShadow ? this.addToCache(e, {
|
|
1325
1184
|
castShadow: !1,
|
|
1326
1185
|
material: this._receiveShadowMaterial
|
|
1327
1186
|
}) : this.addToCache(e, { visible: !1 });
|
|
1328
1187
|
}
|
|
1329
1188
|
_setShadowMaterialForOpaqueObject(e) {
|
|
1330
1189
|
let t = e.material;
|
|
1331
|
-
t instanceof h || t instanceof S ? this.addToCache(e, { material: this._unlitMaterial }) : t instanceof
|
|
1190
|
+
t instanceof h || t instanceof S ? this.addToCache(e, { material: this._unlitMaterial }) : t instanceof ee ? this._setMeshShadowStandardMaterial(e, t) : this.addToCache(e, { material: e.receiveShadow ? this._shadowObjectMaterial : this._unlitMaterial });
|
|
1332
1191
|
}
|
|
1333
1192
|
_setMeshShadowStandardMaterial(e, t) {
|
|
1334
1193
|
let n = t.emissiveIntensity > 0 && (t.emissive.r > 0 || t.emissive.g > 0 || t.emissive.b > 0);
|
|
@@ -1422,7 +1281,7 @@ var He = class e extends b {
|
|
|
1422
1281
|
this._updateShadowPositionAndTarget(this.getPosition(), new n(0, 0, 0));
|
|
1423
1282
|
}
|
|
1424
1283
|
updateBounds(e) {
|
|
1425
|
-
if (this._shadowLightSource instanceof
|
|
1284
|
+
if (this._shadowLightSource instanceof pe) {
|
|
1426
1285
|
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);
|
|
1427
1286
|
t.aspect = 1, t.near = r, t.far = i, this._shadowLightSource.angle = s;
|
|
1428
1287
|
} else if (this._shadowLightSource.shadow) {
|
|
@@ -1437,7 +1296,7 @@ var He = class e extends b {
|
|
|
1437
1296
|
this._shadowLightSource.shadow && (this._shadowLightSource.shadow.needsUpdate = !0);
|
|
1438
1297
|
}
|
|
1439
1298
|
_updateShadowPositionAndTarget(e, t) {
|
|
1440
|
-
if (this._shadowLightSource instanceof
|
|
1299
|
+
if (this._shadowLightSource instanceof pe) {
|
|
1441
1300
|
let n = t.clone().sub(e), r = n.length();
|
|
1442
1301
|
n.normalize();
|
|
1443
1302
|
let i = t.clone().sub(n.clone().multiplyScalar(r * 4));
|
|
@@ -1453,16 +1312,16 @@ var He = class e extends b {
|
|
|
1453
1312
|
return [];
|
|
1454
1313
|
}
|
|
1455
1314
|
finishRenderShadow() {}
|
|
1456
|
-
},
|
|
1315
|
+
}, St = class extends xt {
|
|
1457
1316
|
constructor(e, t) {
|
|
1458
1317
|
let n;
|
|
1459
1318
|
switch (t?.shadowLightSourceType) {
|
|
1460
1319
|
default:
|
|
1461
1320
|
case gt.DIRECTION_LIGHT_SHADOW:
|
|
1462
|
-
n = new
|
|
1321
|
+
n = new v(16777215, 1);
|
|
1463
1322
|
break;
|
|
1464
1323
|
case gt.SPOT_LIGHT_SHADOW:
|
|
1465
|
-
n = new
|
|
1324
|
+
n = new pe(16777215, 1, 0, Math.PI / 4, 0);
|
|
1466
1325
|
break;
|
|
1467
1326
|
}
|
|
1468
1327
|
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));
|
|
@@ -1486,9 +1345,9 @@ var He = class e extends b {
|
|
|
1486
1345
|
finishRenderShadow() {
|
|
1487
1346
|
this._shadowLightSource.visible = !1, this._shadowLightSource.castShadow = this._castShadowBackup, this._rectAreaLight.visible = this._isVisibleBackup;
|
|
1488
1347
|
}
|
|
1489
|
-
},
|
|
1348
|
+
}, Ct = class extends xt {
|
|
1490
1349
|
constructor(e, t, n) {
|
|
1491
|
-
let r = new
|
|
1350
|
+
let r = new v(16777215, t);
|
|
1492
1351
|
r.position.copy(e), r.lookAt(0, 0, 0), r.updateMatrix(), r.castShadow = !0, super(r, n), this._position = e.clone(), this._intensity = t;
|
|
1493
1352
|
}
|
|
1494
1353
|
getPosition() {
|
|
@@ -1504,9 +1363,9 @@ var He = class e extends b {
|
|
|
1504
1363
|
finishRenderShadow() {
|
|
1505
1364
|
this._shadowLightSource.castShadow = this._castShadowBackup, this._shadowLightSource.visible = !1;
|
|
1506
1365
|
}
|
|
1507
|
-
},
|
|
1366
|
+
}, wt = class extends xt {
|
|
1508
1367
|
constructor(e, t) {
|
|
1509
|
-
let n = new
|
|
1368
|
+
let n = new v(16777215, 1);
|
|
1510
1369
|
n.position.copy(e), n.lookAt(0, 0, 0), n.updateMatrix(), n.castShadow = !0, super(n, t), this._position = e.clone();
|
|
1511
1370
|
}
|
|
1512
1371
|
getPosition() {
|
|
@@ -1522,7 +1381,7 @@ var He = class e extends b {
|
|
|
1522
1381
|
finishRenderShadow() {
|
|
1523
1382
|
this._shadowLightSource.castShadow = this._castShadowBackup, this._shadowLightSource.visible = !1;
|
|
1524
1383
|
}
|
|
1525
|
-
},
|
|
1384
|
+
}, Tt = {
|
|
1526
1385
|
name: "CopyShader",
|
|
1527
1386
|
uniforms: {
|
|
1528
1387
|
tDiffuse: { value: null },
|
|
@@ -1530,7 +1389,7 @@ var He = class e extends b {
|
|
|
1530
1389
|
},
|
|
1531
1390
|
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 }",
|
|
1532
1391
|
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 }"
|
|
1533
|
-
},
|
|
1392
|
+
}, Et = {
|
|
1534
1393
|
name: "FXAAShader",
|
|
1535
1394
|
uniforms: {
|
|
1536
1395
|
tDiffuse: { value: null },
|
|
@@ -1538,7 +1397,7 @@ var He = class e extends b {
|
|
|
1538
1397
|
},
|
|
1539
1398
|
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 }",
|
|
1540
1399
|
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 }"
|
|
1541
|
-
},
|
|
1400
|
+
}, Dt = class e extends W {
|
|
1542
1401
|
static {
|
|
1543
1402
|
this.BlurDirectionX = new d(1, 0);
|
|
1544
1403
|
}
|
|
@@ -1549,11 +1408,11 @@ var He = class e extends b {
|
|
|
1549
1408
|
this.highlightLines = !0;
|
|
1550
1409
|
}
|
|
1551
1410
|
constructor(e, t, n, i, a, o) {
|
|
1552
|
-
super(e), this.patternTexture = null, this.clearBackground = !1, this.renderScene = n, this.renderCamera = i, this.selectedObjects = a === void 0 ? [] : a, this.visibleEdgeColor = new
|
|
1411
|
+
super(e), this.patternTexture = null, this.clearBackground = !1, this.renderScene = n, this.renderCamera = i, 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 d(256, 256) : new d(t.x, t.y);
|
|
1553
1412
|
let s = Math.round(this.resolution.x / this.downSampleRatio), c = Math.round(this.resolution.y / this.downSampleRatio);
|
|
1554
|
-
this.renderTargetMaskBuffer = new r(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(
|
|
1555
|
-
let l =
|
|
1556
|
-
this.copyUniforms =
|
|
1413
|
+
this.renderTargetMaskBuffer = new r(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(Et), 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 r(this.resolution.x, this.resolution.y), this.renderTargetFxaaBuffer.texture.name = "OutlinePass.fxaa", this.renderTargetFxaaBuffer.texture.generateMipmaps = !1), this.renderTargetMaskDownSampleBuffer = new r(s, c), this.renderTargetMaskDownSampleBuffer.texture.name = "OutlinePass.depthDownSample", this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = !1, this.renderTargetBlurBuffer1 = new r(s, c), this.renderTargetBlurBuffer1.texture.name = "OutlinePass.blur1", this.renderTargetBlurBuffer1.texture.generateMipmaps = !1, this.renderTargetBlurBuffer2 = new r(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 r(s, c), this.renderTargetEdgeBuffer1.texture.name = "OutlinePass.edge1", this.renderTargetEdgeBuffer1.texture.generateMipmaps = !1, this.renderTargetEdgeBuffer2 = new r(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();
|
|
1414
|
+
let l = Tt;
|
|
1415
|
+
this.copyUniforms = w.clone(l.uniforms), this.copyUniforms.opacity.value = 1, this.materialCopy = new p({
|
|
1557
1416
|
uniforms: this.copyUniforms,
|
|
1558
1417
|
vertexShader: l.vertexShader,
|
|
1559
1418
|
fragmentShader: l.fragmentShader,
|
|
@@ -1561,7 +1420,7 @@ var He = class e extends b {
|
|
|
1561
1420
|
depthTest: !1,
|
|
1562
1421
|
depthWrite: !1,
|
|
1563
1422
|
transparent: !0
|
|
1564
|
-
}), this.enabled = !0, this.needsSwap = !1, this.oldClearColor = new
|
|
1423
|
+
}), this.enabled = !0, this.needsSwap = !1, this.oldClearColor = new D(), this.oldClearAlpha = 1, this.fsQuad = new B(void 0), this.tempPulseColor1 = new D(), this.tempPulseColor2 = new D(), this.textureMatrix = new E();
|
|
1565
1424
|
function u(e, t) {
|
|
1566
1425
|
let n = t.isPerspectiveCamera ? "perspective" : "orthographic";
|
|
1567
1426
|
return e.replace(/DEPTH_TO_VIEW_Z/g, n + "DepthToViewZ");
|
|
@@ -1675,16 +1534,16 @@ var He = class e extends b {
|
|
|
1675
1534
|
transparent: !0
|
|
1676
1535
|
});
|
|
1677
1536
|
}
|
|
1678
|
-
},
|
|
1537
|
+
}, Ot = {
|
|
1679
1538
|
uniforms: { tDiffuse: { value: null } },
|
|
1680
1539
|
vertexShader: "\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",
|
|
1681
1540
|
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 }"
|
|
1682
|
-
},
|
|
1541
|
+
}, kt = class extends p {
|
|
1683
1542
|
constructor(e) {
|
|
1684
1543
|
super({
|
|
1685
|
-
uniforms:
|
|
1686
|
-
vertexShader:
|
|
1687
|
-
fragmentShader:
|
|
1544
|
+
uniforms: w.clone(Ot.uniforms),
|
|
1545
|
+
vertexShader: Ot.vertexShader,
|
|
1546
|
+
fragmentShader: Ot.fragmentShader,
|
|
1688
1547
|
transparent: !0,
|
|
1689
1548
|
depthTest: !1,
|
|
1690
1549
|
depthWrite: !1,
|
|
@@ -1699,12 +1558,12 @@ var He = class e extends b {
|
|
|
1699
1558
|
update(e) {
|
|
1700
1559
|
return e?.texture !== void 0 && (this.uniforms.tDiffuse.value = e.texture), e?.blending !== void 0 && (this.blending = e.blending), this;
|
|
1701
1560
|
}
|
|
1702
|
-
},
|
|
1561
|
+
}, At = (e) => new d(Math.atan2(e.y, e.x) / (2 * Math.PI) + .5, Math.asin(e.z) / Math.PI + .5), jt = class {
|
|
1703
1562
|
get colorRenderTarget() {
|
|
1704
1563
|
return this._colorRenderTarget = this._colorRenderTarget ?? new r(), this._colorRenderTarget;
|
|
1705
1564
|
}
|
|
1706
1565
|
environmentMapDecodeTarget(e) {
|
|
1707
|
-
let t = e instanceof
|
|
1566
|
+
let t = e instanceof xe && e.capabilities.isWebGL2 ? x : C;
|
|
1708
1567
|
return this._environmentMapDecodeTarget = this._environmentMapDecodeTarget ?? new r(1, 1, { type: t }), this._environmentMapDecodeTarget;
|
|
1709
1568
|
}
|
|
1710
1569
|
environmentMapDecodeMaterial(e) {
|
|
@@ -1736,16 +1595,16 @@ var He = class e extends b {
|
|
|
1736
1595
|
sRgbaPixels: l
|
|
1737
1596
|
};
|
|
1738
1597
|
}
|
|
1739
|
-
},
|
|
1598
|
+
}, Z = {
|
|
1740
1599
|
uniforms: { tDiffuse: { value: null } },
|
|
1741
1600
|
vertexShader: "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",
|
|
1742
1601
|
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 }"
|
|
1743
1602
|
}, Q = class extends p {
|
|
1744
1603
|
constructor(e, t) {
|
|
1745
1604
|
super({
|
|
1746
|
-
uniforms:
|
|
1747
|
-
vertexShader:
|
|
1748
|
-
fragmentShader:
|
|
1605
|
+
uniforms: w.clone(Z.uniforms),
|
|
1606
|
+
vertexShader: Z.vertexShader,
|
|
1607
|
+
fragmentShader: Z.fragmentShader,
|
|
1749
1608
|
defines: {
|
|
1750
1609
|
PMREM_DECODE: e ? 1 : 0,
|
|
1751
1610
|
GRAYSCALE_CONVERT: t ? 1 : 0
|
|
@@ -1758,25 +1617,25 @@ var He = class e extends b {
|
|
|
1758
1617
|
}, Mt = class {
|
|
1759
1618
|
constructor(e) {
|
|
1760
1619
|
this.samplePoints = [], this.sampleUVs = [], this.grayscaleTexture = {
|
|
1761
|
-
texture: new
|
|
1620
|
+
texture: new me(),
|
|
1762
1621
|
pixels: new Uint8Array(),
|
|
1763
1622
|
sRgbaPixels: !1
|
|
1764
|
-
}, this.detectorTexture = new
|
|
1623
|
+
}, this.detectorTexture = new me(), this.detectorArray = new Float32Array(), this.lightSamples = [], this.lightGraph = new Pt(0), this.lightSources = [], this._grayScale = new n(.2126, .7152, .0722), this._createEquirectangularSamplePoints = (e) => {
|
|
1765
1624
|
let t = [];
|
|
1766
1625
|
for (let r = 0; r < e; r++) {
|
|
1767
1626
|
let i = r * Math.PI * (3 - Math.sqrt(5)), a = 1 - r / (e - 1) * 2, o = Math.sqrt(1 - a * a), s = Math.cos(i) * o, c = Math.sin(i) * o;
|
|
1768
1627
|
t.push(new n(s, c, a));
|
|
1769
1628
|
}
|
|
1770
1629
|
return t;
|
|
1771
|
-
}, 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) =>
|
|
1630
|
+
}, 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) => At(e));
|
|
1772
1631
|
}
|
|
1773
1632
|
detectLightSources(e, t) {
|
|
1774
|
-
this._textureConverter = this._textureConverter ?? new
|
|
1633
|
+
this._textureConverter = this._textureConverter ?? new jt(), 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);
|
|
1775
1634
|
}
|
|
1776
1635
|
_redFromRgbaToNormalizedFloatArray(e, t, r) {
|
|
1777
1636
|
let i = new Float32Array(e.length / 4), a = 1, o = 0;
|
|
1778
1637
|
for (let t = 0; t < e.length / 4; ++t) {
|
|
1779
|
-
let r = new
|
|
1638
|
+
let r = new D(...e.slice(t * 4, t * 4 + 3));
|
|
1780
1639
|
e instanceof Float32Array && r.convertSRGBToLinear();
|
|
1781
1640
|
let s = new n(r.r, r.g, r.b).dot(this._grayScale);
|
|
1782
1641
|
a = Math.min(a, s), o = Math.max(o, s), i[t] = s;
|
|
@@ -1814,7 +1673,7 @@ var He = class e extends b {
|
|
|
1814
1673
|
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) {
|
|
1815
1674
|
let r = e[o].position.clone().sub(e[a].position), s = Math.floor(r.length() / n), c = !0, l = 0;
|
|
1816
1675
|
for (let n = 1; n < s; n++) {
|
|
1817
|
-
let i = r.clone().multiplyScalar(n / s), o =
|
|
1676
|
+
let i = r.clone().multiplyScalar(n / s), o = At(e[a].position.clone().add(i).normalize());
|
|
1818
1677
|
if (this._detectorTextureLuminanceValueFromUV(o) < t) {
|
|
1819
1678
|
if (l++, l > 1) {
|
|
1820
1679
|
c = !1;
|
|
@@ -1863,12 +1722,12 @@ var He = class e extends b {
|
|
|
1863
1722
|
let n = e(t.uv);
|
|
1864
1723
|
this.averageIntensity += n, this.maxIntensity = Math.max(this.maxIntensity, n);
|
|
1865
1724
|
}
|
|
1866
|
-
this.averageIntensity /= this.lightSamples.length, this.position.normalize(), this.uv =
|
|
1725
|
+
this.averageIntensity /= this.lightSamples.length, this.position.normalize(), this.uv = At(this.position);
|
|
1867
1726
|
let t = 0;
|
|
1868
1727
|
for (let e of this.lightSamples) t += e.position.distanceTo(this.position);
|
|
1869
1728
|
t /= this.lightSamples.length, this.size = t / Math.PI;
|
|
1870
1729
|
}
|
|
1871
|
-
}, It = class extends
|
|
1730
|
+
}, It = class extends W {
|
|
1872
1731
|
constructor(e) {
|
|
1873
1732
|
super(e), this.debugOutput = "", this._environmentMapDecodeMaterial = new Q(!0, !1), this._environmentMapDecodeMaterial.blending = 0, this._environmentMapDecodeMaterial.depthTest = !1;
|
|
1874
1733
|
}
|
|
@@ -1876,21 +1735,21 @@ var He = class e extends b {
|
|
|
1876
1735
|
this._depthRenderMaterial?.dispose(), this._copyMaterial?.dispose(), this._srgbToLinearCopyMaterial?.dispose();
|
|
1877
1736
|
}
|
|
1878
1737
|
getCopyMaterial(e) {
|
|
1879
|
-
return this._copyMaterial = this._copyMaterial ?? new
|
|
1738
|
+
return this._copyMaterial = this._copyMaterial ?? new j(), this._copyMaterial.update(e);
|
|
1880
1739
|
}
|
|
1881
1740
|
getBlendAoAndShadowMaterial(e) {
|
|
1882
|
-
return this._blendAoAndShadowMaterial = this._blendAoAndShadowMaterial ?? new
|
|
1741
|
+
return this._blendAoAndShadowMaterial = this._blendAoAndShadowMaterial ?? new qe({ blending: 0 }), this._blendAoAndShadowMaterial.update(e);
|
|
1883
1742
|
}
|
|
1884
1743
|
getBlendAoPassDepthMaterial(e) {
|
|
1885
|
-
return this._blendAoPassDepthMaterial = this._blendAoPassDepthMaterial ?? new
|
|
1744
|
+
return this._blendAoPassDepthMaterial = this._blendAoPassDepthMaterial ?? new kt({ blending: 0 }), this._blendAoPassDepthMaterial.update(e);
|
|
1886
1745
|
}
|
|
1887
1746
|
getSrgbToLinearCopyMaterial(e) {
|
|
1888
|
-
return this._srgbToLinearCopyMaterial = this._copyMaterial ?? new
|
|
1747
|
+
return this._srgbToLinearCopyMaterial = this._copyMaterial ?? new j({}, R.ADDITIVE, !0, !0), this._srgbToLinearCopyMaterial.update(e);
|
|
1889
1748
|
}
|
|
1890
1749
|
_getDepthRenderMaterial(e) {
|
|
1891
|
-
return this._depthRenderMaterial = this._depthRenderMaterial ?? new
|
|
1750
|
+
return this._depthRenderMaterial = this._depthRenderMaterial ?? new Te({
|
|
1892
1751
|
depthTexture: this.gBufferTextures.textureWithDepthValue,
|
|
1893
|
-
depthFilter: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? new
|
|
1752
|
+
depthFilter: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? new O(0, 0, 0, 1) : new O(1, 0, 0, 0)
|
|
1894
1753
|
}), this._depthRenderMaterial.update({ camera: e });
|
|
1895
1754
|
}
|
|
1896
1755
|
renderPass(e) {
|
|
@@ -1903,94 +1762,94 @@ var He = class e extends b {
|
|
|
1903
1762
|
this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1904
1763
|
texture: this.gBufferTextures?.gBufferTexture,
|
|
1905
1764
|
blending: 0,
|
|
1906
|
-
colorTransform: new
|
|
1907
|
-
colorBase: new
|
|
1765
|
+
colorTransform: new E().set(.5, 0, 0, 0, 0, .5, 0, 0, 0, 0, .5, 0, 0, 0, 0, 0),
|
|
1766
|
+
colorBase: new O(.5, .5, .5, 1),
|
|
1908
1767
|
multiplyChannels: 0,
|
|
1909
|
-
uvTransform:
|
|
1768
|
+
uvTransform: A
|
|
1910
1769
|
}), null) : this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1911
1770
|
texture: this.gBufferTextures?.gBufferTexture,
|
|
1912
1771
|
blending: 0,
|
|
1913
|
-
colorTransform:
|
|
1914
|
-
colorBase:
|
|
1772
|
+
colorTransform: Ce,
|
|
1773
|
+
colorBase: N,
|
|
1915
1774
|
multiplyChannels: 0,
|
|
1916
|
-
uvTransform:
|
|
1775
|
+
uvTransform: A
|
|
1917
1776
|
}), null);
|
|
1918
1777
|
break;
|
|
1919
1778
|
case "g-depth":
|
|
1920
1779
|
this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1921
1780
|
texture: this.gBufferTextures?.gBufferTexture,
|
|
1922
1781
|
blending: 0,
|
|
1923
|
-
colorTransform:
|
|
1924
|
-
colorBase:
|
|
1782
|
+
colorTransform: Ee,
|
|
1783
|
+
colorBase: N,
|
|
1925
1784
|
multiplyChannels: 0,
|
|
1926
|
-
uvTransform:
|
|
1785
|
+
uvTransform: A
|
|
1927
1786
|
}), null) : this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1928
1787
|
texture: this.gBufferTextures?.depthBufferTexture,
|
|
1929
1788
|
blending: 0,
|
|
1930
|
-
colorTransform:
|
|
1931
|
-
colorBase:
|
|
1789
|
+
colorTransform: we,
|
|
1790
|
+
colorBase: N,
|
|
1932
1791
|
multiplyChannels: 0,
|
|
1933
|
-
uvTransform:
|
|
1792
|
+
uvTransform: A
|
|
1934
1793
|
}), null);
|
|
1935
1794
|
break;
|
|
1936
1795
|
case "ssao":
|
|
1937
1796
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1938
1797
|
texture: this.renderPassManager.shadowAndAoPass.aoAndSoftShadowRenderTarget.texture,
|
|
1939
1798
|
blending: 0,
|
|
1940
|
-
colorTransform:
|
|
1941
|
-
colorBase:
|
|
1799
|
+
colorTransform: I,
|
|
1800
|
+
colorBase: k,
|
|
1942
1801
|
multiplyChannels: 0,
|
|
1943
|
-
uvTransform:
|
|
1802
|
+
uvTransform: A
|
|
1944
1803
|
}), null);
|
|
1945
1804
|
break;
|
|
1946
1805
|
case "ssaodenoise":
|
|
1947
1806
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1948
1807
|
texture: this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,
|
|
1949
1808
|
blending: 0,
|
|
1950
|
-
colorTransform:
|
|
1951
|
-
colorBase:
|
|
1809
|
+
colorTransform: I,
|
|
1810
|
+
colorBase: k,
|
|
1952
1811
|
multiplyChannels: 0,
|
|
1953
|
-
uvTransform:
|
|
1812
|
+
uvTransform: A
|
|
1954
1813
|
}), null);
|
|
1955
1814
|
break;
|
|
1956
1815
|
case "shadowmap":
|
|
1957
1816
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1958
1817
|
texture: this.renderPassManager.screenSpaceShadowMapPass.shadowTexture,
|
|
1959
1818
|
blending: 0,
|
|
1960
|
-
colorTransform:
|
|
1961
|
-
colorBase:
|
|
1819
|
+
colorTransform: I,
|
|
1820
|
+
colorBase: k,
|
|
1962
1821
|
multiplyChannels: 0,
|
|
1963
|
-
uvTransform:
|
|
1822
|
+
uvTransform: A
|
|
1964
1823
|
}), null);
|
|
1965
1824
|
break;
|
|
1966
1825
|
case "shadowsoft":
|
|
1967
1826
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1968
1827
|
texture: this.renderPassManager.shadowAndAoPass.aoAndSoftShadowRenderTarget.texture,
|
|
1969
1828
|
blending: 0,
|
|
1970
|
-
colorTransform:
|
|
1971
|
-
colorBase:
|
|
1829
|
+
colorTransform: Y.shadowTransform,
|
|
1830
|
+
colorBase: k,
|
|
1972
1831
|
multiplyChannels: 0,
|
|
1973
|
-
uvTransform:
|
|
1832
|
+
uvTransform: A
|
|
1974
1833
|
}), null);
|
|
1975
1834
|
break;
|
|
1976
1835
|
case "shadowdenoise":
|
|
1977
1836
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1978
1837
|
texture: this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,
|
|
1979
1838
|
blending: 0,
|
|
1980
|
-
colorTransform:
|
|
1981
|
-
colorBase:
|
|
1839
|
+
colorTransform: Y.shadowTransform,
|
|
1840
|
+
colorBase: k,
|
|
1982
1841
|
multiplyChannels: 0,
|
|
1983
|
-
uvTransform:
|
|
1842
|
+
uvTransform: A
|
|
1984
1843
|
}), null);
|
|
1985
1844
|
break;
|
|
1986
1845
|
case "shadowfadein":
|
|
1987
1846
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1988
1847
|
texture: this.renderPassManager.shadowAndAoPass.fadeRenderTarget.texture,
|
|
1989
1848
|
blending: 0,
|
|
1990
|
-
colorTransform:
|
|
1991
|
-
colorBase:
|
|
1849
|
+
colorTransform: Y.shadowTransform,
|
|
1850
|
+
colorBase: k,
|
|
1992
1851
|
multiplyChannels: 0,
|
|
1993
|
-
uvTransform:
|
|
1852
|
+
uvTransform: A
|
|
1994
1853
|
}), null);
|
|
1995
1854
|
break;
|
|
1996
1855
|
case "shadowandao":
|
|
@@ -2011,40 +1870,40 @@ var He = class e extends b {
|
|
|
2011
1870
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
2012
1871
|
texture: this.renderPassManager.aoPassMapTexture,
|
|
2013
1872
|
blending: 0,
|
|
2014
|
-
colorTransform:
|
|
2015
|
-
colorBase:
|
|
1873
|
+
colorTransform: L,
|
|
1874
|
+
colorBase: k,
|
|
2016
1875
|
multiplyChannels: 0,
|
|
2017
|
-
uvTransform:
|
|
1876
|
+
uvTransform: A
|
|
2018
1877
|
}), null);
|
|
2019
1878
|
break;
|
|
2020
1879
|
case "groundreflection":
|
|
2021
1880
|
this.passRenderer.renderScreenSpace(e, this.getSrgbToLinearCopyMaterial({
|
|
2022
1881
|
texture: this.renderPassManager.groundReflectionPass.reflectionRenderTarget.texture,
|
|
2023
1882
|
blending: 0,
|
|
2024
|
-
colorTransform:
|
|
2025
|
-
colorBase:
|
|
1883
|
+
colorTransform: L,
|
|
1884
|
+
colorBase: k,
|
|
2026
1885
|
multiplyChannels: 0,
|
|
2027
|
-
uvTransform:
|
|
1886
|
+
uvTransform: Se
|
|
2028
1887
|
}), null);
|
|
2029
1888
|
break;
|
|
2030
1889
|
case "groundreflectionfinal":
|
|
2031
1890
|
this.passRenderer.renderScreenSpace(e, this.getSrgbToLinearCopyMaterial({
|
|
2032
1891
|
texture: this.renderPassManager.groundReflectionPass.intensityRenderTarget.texture,
|
|
2033
1892
|
blending: 0,
|
|
2034
|
-
colorTransform:
|
|
2035
|
-
colorBase:
|
|
1893
|
+
colorTransform: L,
|
|
1894
|
+
colorBase: k,
|
|
2036
1895
|
multiplyChannels: 0,
|
|
2037
|
-
uvTransform:
|
|
1896
|
+
uvTransform: Se
|
|
2038
1897
|
}), null);
|
|
2039
1898
|
break;
|
|
2040
1899
|
case "bakedgroundshadow":
|
|
2041
1900
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
2042
1901
|
texture: this.renderPassManager.bakedGroundContactShadowPass.renderTarget.texture,
|
|
2043
1902
|
blending: 0,
|
|
2044
|
-
colorTransform:
|
|
2045
|
-
colorBase:
|
|
1903
|
+
colorTransform: L,
|
|
1904
|
+
colorBase: k,
|
|
2046
1905
|
multiplyChannels: 0,
|
|
2047
|
-
uvTransform:
|
|
1906
|
+
uvTransform: A
|
|
2048
1907
|
}), null);
|
|
2049
1908
|
break;
|
|
2050
1909
|
case "environmentmap":
|
|
@@ -2053,14 +1912,14 @@ var He = class e extends b {
|
|
|
2053
1912
|
case "lightsourcedetection":
|
|
2054
1913
|
if (this.scene.userData?.environmentDefinition) {
|
|
2055
1914
|
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);
|
|
2056
|
-
r.background = new
|
|
1915
|
+
r.background = new D(16777215), e.render(r, n);
|
|
2057
1916
|
}
|
|
2058
1917
|
break;
|
|
2059
1918
|
}
|
|
2060
1919
|
}
|
|
2061
|
-
}, Lt = class extends
|
|
1920
|
+
}, Lt = class extends W {
|
|
2062
1921
|
constructor(e) {
|
|
2063
|
-
super(e), this.drawGround = !0, this.drawWithDebugMaterial = !1, this.grayDebugMaterial = new
|
|
1922
|
+
super(e), this.drawGround = !0, this.drawWithDebugMaterial = !1, this.grayDebugMaterial = new ee({
|
|
2064
1923
|
color: 12632256,
|
|
2065
1924
|
side: 2,
|
|
2066
1925
|
envMapIntensity: .4
|
|
@@ -2100,7 +1959,7 @@ var He = class e extends b {
|
|
|
2100
1959
|
this._reflectionPassMapIntensityUniform.value = e;
|
|
2101
1960
|
}
|
|
2102
1961
|
static addPlugin(t) {
|
|
2103
|
-
if (
|
|
1962
|
+
if (V(t)) return null;
|
|
2104
1963
|
if (t.userData.postProcessingMaterialPlugin !== void 0) return t.userData.postProcessingMaterialPlugin instanceof e ? t.userData.postProcessingMaterialPlugin : null;
|
|
2105
1964
|
let n = new e();
|
|
2106
1965
|
return t.userData.postProcessingMaterialPlugin = n, t.onBeforeCompile = (e, t) => n._onBeforeCompile(e, t), t.customProgramCacheKey = () => n._customProgramCacheKey(), n;
|
|
@@ -2121,15 +1980,15 @@ var He = class e extends b {
|
|
|
2121
1980
|
_initUniforms(e) {
|
|
2122
1981
|
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);
|
|
2123
1982
|
}
|
|
2124
|
-
}, 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
|
|
1983
|
+
}, 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 z {
|
|
2125
1984
|
constructor(e, t = "tDiffuse") {
|
|
2126
|
-
super(), this.textureID = t, this.uniforms = null, this.material = null, e instanceof p ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms =
|
|
1985
|
+
super(), this.textureID = t, this.uniforms = null, this.material = null, e instanceof p ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms = w.clone(e.uniforms), this.material = new p({
|
|
2127
1986
|
name: e.name === void 0 ? "unspecified" : e.name,
|
|
2128
1987
|
defines: Object.assign({}, e.defines),
|
|
2129
1988
|
uniforms: this.uniforms,
|
|
2130
1989
|
vertexShader: e.vertexShader,
|
|
2131
1990
|
fragmentShader: e.fragmentShader
|
|
2132
|
-
})), this._fsQuad = new
|
|
1991
|
+
})), this._fsQuad = new B(this.material);
|
|
2133
1992
|
}
|
|
2134
1993
|
render(e, t, n) {
|
|
2135
1994
|
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));
|
|
@@ -2188,8 +2047,8 @@ var He = class e extends b {
|
|
|
2188
2047
|
if (s = i.exec(e), s !== null && p.set(Number(s[1]), Number(s[2]), Number(s[3])), s = a.exec(e), s !== null && m.set(Number(s[1]), Number(s[2]), Number(s[3])), p.x > m.x || p.y > m.y || p.z > m.z) throw Error("THREE.LUTCubeLoader: Invalid input domain");
|
|
2189
2048
|
let h = this.type === 1009 ? 255 : 1, g = 0;
|
|
2190
2049
|
for (; (s = o.exec(e)) !== null;) f[g++] = Number(s[1]) * h, f[g++] = Number(s[2]) * h, f[g++] = Number(s[3]) * h, f[g++] = h;
|
|
2191
|
-
let _ = new
|
|
2192
|
-
return _.image.data = f, _.image.width = l, _.image.height = l, _.image.depth = l, _.type = this.type, _.magFilter =
|
|
2050
|
+
let _ = new ye();
|
|
2051
|
+
return _.image.data = f, _.image.width = l, _.image.height = l, _.image.depth = l, _.type = this.type, _.magFilter = T, _.minFilter = T, _.wrapS = u, _.wrapT = u, _.wrapR = u, _.generateMipmaps = !1, _.needsUpdate = !0, {
|
|
2193
2052
|
title: c,
|
|
2194
2053
|
size: l,
|
|
2195
2054
|
domainMin: p,
|
|
@@ -2202,7 +2061,7 @@ var He = class e extends b {
|
|
|
2202
2061
|
super(e), this.flip = !1;
|
|
2203
2062
|
}
|
|
2204
2063
|
load(e, t, n, r) {
|
|
2205
|
-
let i = new
|
|
2064
|
+
let i = new he(this.manager);
|
|
2206
2065
|
i.setCrossOrigin(this.crossOrigin), i.setPath(this.path), i.load(e, (n) => {
|
|
2207
2066
|
try {
|
|
2208
2067
|
let e;
|
|
@@ -2213,8 +2072,8 @@ var He = class e extends b {
|
|
|
2213
2072
|
}, n, r);
|
|
2214
2073
|
}
|
|
2215
2074
|
parse(e, t) {
|
|
2216
|
-
let n = new Uint8Array(e), r = new
|
|
2217
|
-
return r.image.data = n, r.image.width = t, r.image.height = t, r.image.depth = t, r.format = o, r.type = C, r.magFilter =
|
|
2075
|
+
let n = new Uint8Array(e), r = new ye();
|
|
2076
|
+
return r.image.data = n, r.image.width = t, r.image.height = t, r.image.depth = t, r.format = o, r.type = C, r.magFilter = T, r.minFilter = T, r.wrapS = u, r.wrapT = u, r.wrapR = u, r.generateMipmaps = !1, r.needsUpdate = !0, {
|
|
2218
2077
|
size: t,
|
|
2219
2078
|
texture3D: r
|
|
2220
2079
|
};
|
|
@@ -2270,8 +2129,8 @@ var He = class e extends b {
|
|
|
2270
2129
|
let t = e + 1, n = e + 2, r = e + 3;
|
|
2271
2130
|
m[e] = l[e] / p * h, m[t] = l[t] / p * h, m[n] = l[n] / p * h, m[r] = h;
|
|
2272
2131
|
}
|
|
2273
|
-
let g = new
|
|
2274
|
-
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 =
|
|
2132
|
+
let g = new ye();
|
|
2133
|
+
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, {
|
|
2275
2134
|
size: s,
|
|
2276
2135
|
texture3D: g
|
|
2277
2136
|
};
|
|
@@ -2284,14 +2143,14 @@ var He = class e extends b {
|
|
|
2284
2143
|
},
|
|
2285
2144
|
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 }",
|
|
2286
2145
|
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 }"
|
|
2287
|
-
}, qt = class extends
|
|
2146
|
+
}, qt = class extends z {
|
|
2288
2147
|
constructor() {
|
|
2289
|
-
super(), this.isOutputPass = !0, this.uniforms =
|
|
2148
|
+
super(), this.isOutputPass = !0, this.uniforms = w.clone($.uniforms), this.material = new f({
|
|
2290
2149
|
name: $.name,
|
|
2291
2150
|
uniforms: this.uniforms,
|
|
2292
2151
|
vertexShader: $.vertexShader,
|
|
2293
2152
|
fragmentShader: $.fragmentShader
|
|
2294
|
-
}), this._fsQuad = new
|
|
2153
|
+
}), this._fsQuad = new B(this.material), this._outputColorSpace = null, this._toneMapping = null;
|
|
2295
2154
|
}
|
|
2296
2155
|
render(e, t, n) {
|
|
2297
2156
|
this.uniforms.tDiffuse.value = n.texture, this.uniforms.toneMappingExposure.value = e.toneMappingExposure, (this._outputColorSpace !== e.outputColorSpace || this._toneMapping !== e.toneMapping) && (this._outputColorSpace = e.outputColorSpace, this._toneMapping = e.toneMapping, this.material.defines = {}, i.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));
|
|
@@ -2365,7 +2224,7 @@ var He = class e extends b {
|
|
|
2365
2224
|
return this._sceneRenderer.debugOutput;
|
|
2366
2225
|
}
|
|
2367
2226
|
constructor(t, n) {
|
|
2368
|
-
this.materialsNeedUpdate = !0, this._passRenderer = new
|
|
2227
|
+
this.materialsNeedUpdate = !0, this._passRenderer = new Pe(), this._outlinePass = null, this._debugPass = null, this._cameraUpdate = new M(), this._cameraChanged = !0, this._noUpdateNeededCount = 0, this._noOStaticFrames = 0, this._maxSamples = 1, this._passUpdateStates = {
|
|
2369
2228
|
updateGroundReflection: !1,
|
|
2370
2229
|
updateGBuffer: !1,
|
|
2371
2230
|
updateScreenSpaceShadow: !1,
|
|
@@ -2380,12 +2239,12 @@ var He = class e extends b {
|
|
|
2380
2239
|
width: this._sceneRenderer.width,
|
|
2381
2240
|
height: this._sceneRenderer.height,
|
|
2382
2241
|
samples: i,
|
|
2383
|
-
textureMinificationFilter: r ?
|
|
2384
|
-
textureMagnificationFilter: r ?
|
|
2242
|
+
textureMinificationFilter: r ? T : y,
|
|
2243
|
+
textureMagnificationFilter: r ? T : y
|
|
2385
2244
|
}), this._groundReflectionPass = new ct(this, this._sceneRenderer.width, this._sceneRenderer.height, this._maxSamples, {}), this._screenSpaceShadowMapPass = new vt(this, new d(this._sceneRenderer.width, this._sceneRenderer.height), {
|
|
2386
2245
|
samples: a,
|
|
2387
2246
|
alwaysUpdate: !1
|
|
2388
|
-
}), this._shadowAndAoPass = new
|
|
2247
|
+
}), this._shadowAndAoPass = new Y(this, this._sceneRenderer.width, this._sceneRenderer.height, i), this._lutPass = new Ut({
|
|
2389
2248
|
lut: void 0,
|
|
2390
2249
|
intensity: 1
|
|
2391
2250
|
}), this._outputPass = new qt();
|
|
@@ -2414,7 +2273,7 @@ var He = class e extends b {
|
|
|
2414
2273
|
});
|
|
2415
2274
|
}
|
|
2416
2275
|
createOutlinePass() {
|
|
2417
|
-
return this._outlinePass ||= new
|
|
2276
|
+
return this._outlinePass ||= new Dt(this, new d(this._sceneRenderer.width, this._sceneRenderer.height), this.scene, this.camera, [], {
|
|
2418
2277
|
downSampleRatio: 2,
|
|
2419
2278
|
edgeDetectionFxaa: !0
|
|
2420
2279
|
}), this._outlinePass;
|
|
@@ -2439,7 +2298,7 @@ var He = class e extends b {
|
|
|
2439
2298
|
_evaluateIfShadowAndAoUpdateIsNeeded() {
|
|
2440
2299
|
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;
|
|
2441
2300
|
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;
|
|
2442
|
-
let r = !t || n < .99 ? this.parameters.shadowOnCameraChange :
|
|
2301
|
+
let r = !t || n < .99 ? this.parameters.shadowOnCameraChange : q.OFF;
|
|
2443
2302
|
return {
|
|
2444
2303
|
needsUpdate: t,
|
|
2445
2304
|
shadowOnCameraChange: r,
|
|
@@ -2447,7 +2306,7 @@ var He = class e extends b {
|
|
|
2447
2306
|
};
|
|
2448
2307
|
}
|
|
2449
2308
|
_dynamicChanges(e) {
|
|
2450
|
-
return e.needsUpdate || e.shadowOnCameraChange !==
|
|
2309
|
+
return e.needsUpdate || e.shadowOnCameraChange !== q.OFF;
|
|
2451
2310
|
}
|
|
2452
2311
|
_updateSceneRenderPass() {
|
|
2453
2312
|
this._sceneRenderPass.drawWithDebugMaterial = !1;
|
|
@@ -2457,7 +2316,7 @@ var He = class e extends b {
|
|
|
2457
2316
|
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;
|
|
2458
2317
|
}
|
|
2459
2318
|
_updateGBufferPass(e) {
|
|
2460
|
-
this._passUpdateStates.updateGBuffer = !1, this._gBufferRenderPass.needsUpdate = e.needsUpdate || e.shadowOnCameraChange ===
|
|
2319
|
+
this._passUpdateStates.updateGBuffer = !1, this._gBufferRenderPass.needsUpdate = e.needsUpdate || e.shadowOnCameraChange === q.POISSON, this.gBufferRenderPass.drawGround = this._sceneRenderer.boundingVolumeSet && this._shadowAndAoPass.parameters.aoOnGround;
|
|
2461
2320
|
}
|
|
2462
2321
|
_updateGroundReflectionPass(e) {
|
|
2463
2322
|
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);
|
|
@@ -2476,7 +2335,7 @@ var He = class e extends b {
|
|
|
2476
2335
|
}
|
|
2477
2336
|
this._shadowAndAoPass.shadowAndAoPassSettings = {
|
|
2478
2337
|
shadowMapTexture: this._screenSpaceShadowMapPass.shadowTexture,
|
|
2479
|
-
shadowBlurType: e.needsUpdate ?
|
|
2338
|
+
shadowBlurType: e.needsUpdate ? q.FULL : e.shadowOnCameraChange,
|
|
2480
2339
|
shadowFadeInBlurType: e.shadowOnCameraChange,
|
|
2481
2340
|
shadowFadeInMix: 1 - e.intensityScale,
|
|
2482
2341
|
noOStaticFrames: this.noOStaticFrames
|
|
@@ -2517,7 +2376,7 @@ var He = class e extends b {
|
|
|
2517
2376
|
this.materialsNeedUpdate = !1, t.traverse((e) => {
|
|
2518
2377
|
if (e.isMesh) {
|
|
2519
2378
|
let t = e.material;
|
|
2520
|
-
t instanceof
|
|
2379
|
+
t instanceof ee && this._updateMaterial(e, t, n);
|
|
2521
2380
|
}
|
|
2522
2381
|
});
|
|
2523
2382
|
}
|
|
@@ -2538,7 +2397,7 @@ var He = class e extends b {
|
|
|
2538
2397
|
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);
|
|
2539
2398
|
}
|
|
2540
2399
|
};
|
|
2541
|
-
|
|
2400
|
+
He([Ve, Be("design:type", Object)], Yt.prototype, "_initData", void 0);
|
|
2542
2401
|
//#endregion
|
|
2543
2402
|
//#region packages/common-core/src/webgl/renderer/scene-renderer.ts
|
|
2544
2403
|
var Xt = {
|
|
@@ -2578,7 +2437,7 @@ var Xt = {
|
|
|
2578
2437
|
return this._shadowAndAoGroundPlane;
|
|
2579
2438
|
}
|
|
2580
2439
|
constructor(e, t, n, r, i) {
|
|
2581
|
-
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
|
|
2440
|
+
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 je(), this.boundingVolumeSet = !1, this.renderCacheManager = new Ge(), this.selectedObjects = [], this.groundGroup = new fe(), this._shadingType = Le.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 H((e) => e === this.groundGroup)), this.renderCacheManager.registerCache("groundReflection", new H((e) => e === this.groundGroup || e.name === "dimensioning" ? !0 : !!(e instanceof b && V(e.material)))), this.renderCacheManager.registerCache("debug", new H()), this.renderCacheManager.registerCache("floorDepthWrite", new Ke((e) => e.userData?.isFloor)), this._shadowAndAoGroundPlane = new U(null), this.groundGroup.rotateX(-Math.PI / 2), this._renderPassManager = new Yt(e, this), this.outlineRenderer = new $e(this._renderPassManager, null, {}), this.parameters = {
|
|
2582
2441
|
gBufferRenderTargetParameters: this.gBufferRenderPass.parameters,
|
|
2583
2442
|
bakedGroundContactShadowParameters: this.bakedGroundContactShadowPass.parameters,
|
|
2584
2443
|
screenSpaceShadowMapParameters: this.screenSpaceShadowMapPass.parameters,
|
|
@@ -2588,7 +2447,7 @@ var Xt = {
|
|
|
2588
2447
|
effectSuspendFrames: 0,
|
|
2589
2448
|
effectFadeInFrames: 0,
|
|
2590
2449
|
suspendGroundReflection: !1,
|
|
2591
|
-
shadowOnCameraChange:
|
|
2450
|
+
shadowOnCameraChange: q.OFF
|
|
2592
2451
|
}, this._addEventListeners(this.renderer);
|
|
2593
2452
|
}
|
|
2594
2453
|
_addEventListeners(e) {
|
|
@@ -2634,14 +2493,14 @@ var Xt = {
|
|
|
2634
2493
|
applyCurrentParameters() {
|
|
2635
2494
|
let e = [];
|
|
2636
2495
|
this._qualityMap.has(this._qualityLevel) && e.push(this._qualityMap.get(this._qualityLevel));
|
|
2637
|
-
let t =
|
|
2496
|
+
let t = Fe(this._shadingType);
|
|
2638
2497
|
t && e.push(t);
|
|
2639
|
-
let n =
|
|
2640
|
-
if (n && e.push(n), this._customShadingParameters && e.push(
|
|
2498
|
+
let n = Me(this.uiInteractionMode);
|
|
2499
|
+
if (n && e.push(n), this._customShadingParameters && e.push(Ae(this._customShadingParameters)), this._customOutlineParameters && e.push({ outlineParameters: {
|
|
2641
2500
|
visibleEdgeColor: this._customOutlineParameters.outlineVisibleEdgeColor,
|
|
2642
2501
|
hiddenEdgeColor: this._customOutlineParameters.outlineHiddenEdgeColor
|
|
2643
2502
|
} }), e.length > 0) {
|
|
2644
|
-
let t =
|
|
2503
|
+
let t = De(...e);
|
|
2645
2504
|
this.updateParameters(t), this.bakedGroundContactShadowPass.applyParameters();
|
|
2646
2505
|
}
|
|
2647
2506
|
}
|
|
@@ -2707,8 +2566,8 @@ var Xt = {
|
|
|
2707
2566
|
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));
|
|
2708
2567
|
}
|
|
2709
2568
|
};
|
|
2710
|
-
|
|
2569
|
+
He([Ve, Be("design:type", Object)], Zt.prototype, "_initData", void 0);
|
|
2711
2570
|
//#endregion
|
|
2712
|
-
export { ft as a, Mt as i, Zt as n,
|
|
2571
|
+
export { ft as a, Mt as i, Zt as n, q as o, Q as r, Xt as t };
|
|
2713
2572
|
|
|
2714
|
-
//# sourceMappingURL=scene-renderer-
|
|
2573
|
+
//# sourceMappingURL=scene-renderer-B8SBMSQ7.mjs.map
|