@roomle/web-sdk 5.1.0-alpha.3 → 5.1.0-alpha.5
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-Bl5whHAB.mjs → BufferGeometry-CxlpBjLq.mjs} +192 -195
- package/lib/BufferGeometry-CxlpBjLq.mjs.map +1 -0
- package/lib/ConfiguratorKernel.wasm +0 -0
- package/lib/{GLTFExporter-yQ7mMauu.mjs → GLTFExporter-DeNw0qAI.mjs} +86 -80
- package/lib/GLTFExporter-DeNw0qAI.mjs.map +1 -0
- package/lib/GaussianBlurNode-BR1cKBsX.mjs +65 -0
- package/lib/GaussianBlurNode-BR1cKBsX.mjs.map +1 -0
- package/lib/{Object3D-BHdngbxB.mjs → Object3D-CALIQdg1.mjs} +142 -59
- package/lib/Object3D-CALIQdg1.mjs.map +1 -0
- package/lib/{Pass-DLiMLT5k.mjs → Pass-DCljS3Z-.mjs} +4 -4
- package/lib/{Pass-DLiMLT5k.mjs.map → Pass-DCljS3Z-.mjs.map} +1 -1
- package/lib/{PointLightHelper-CuPSBuDU.mjs → PointLightHelper-C_0CYp7R.mjs} +35 -32
- package/lib/PointLightHelper-C_0CYp7R.mjs.map +1 -0
- package/lib/RoomleCore.wasm +0 -0
- package/lib/RoomleToolsCore.wasm +0 -0
- package/lib/{SpotLightHelper-m-Rh8vGU.mjs → SpotLightHelper-UUIHn43T.mjs} +22 -19
- package/lib/SpotLightHelper-UUIHn43T.mjs.map +1 -0
- package/lib/{USDZExporter-MdkuT226.mjs → USDZExporter-BBNw7Hey.mjs} +6 -3
- package/lib/USDZExporter-BBNw7Hey.mjs.map +1 -0
- package/lib/{Vector4-C7TlIAyy.mjs → Vector4-BOcWTZJI.mjs} +2 -2
- package/lib/Vector4-BOcWTZJI.mjs.map +1 -0
- package/lib/{api-KWh-ESd5.mjs → api-CwEjmjrn.mjs} +2 -2
- package/lib/{api-KWh-ESd5.mjs.map → api-CwEjmjrn.mjs.map} +1 -1
- package/lib/asset-loader.worker-CzI1oyTY.mjs.map +1 -1
- package/lib/{banana-for-scale-DpKXNBt_.mjs → banana-for-scale-Cf41yXTl.mjs} +3 -3
- package/lib/{banana-for-scale-DpKXNBt_.mjs.map → banana-for-scale-Cf41yXTl.mjs.map} +1 -1
- package/lib/budgeteer.sw-D80jTmYa.mjs.map +1 -1
- package/lib/{common-utils-DbL4tku0.mjs → common-utils-OTJQGohe.mjs} +3 -3
- package/lib/common-utils-OTJQGohe.mjs.map +1 -0
- package/lib/{component-dimensioning-luQ3LgrU.mjs → component-dimensioning-yPK46Y5o.mjs} +26 -26
- package/lib/{component-dimensioning-luQ3LgrU.mjs.map → component-dimensioning-yPK46Y5o.mjs.map} +1 -1
- package/lib/{component-raycast-helper-hj6sm7jw.mjs → component-raycast-helper-CnpnRaFg.mjs} +15 -15
- package/lib/{component-raycast-helper-hj6sm7jw.mjs.map → component-raycast-helper-CnpnRaFg.mjs.map} +1 -1
- package/lib/{configurator-CQ7KsW0O.mjs → configurator-iYlO_buA.mjs} +4 -4
- package/lib/{configurator-CQ7KsW0O.mjs.map → configurator-iYlO_buA.mjs.map} +1 -1
- package/lib/configurator-y7zIaUe_.mjs +2 -0
- package/lib/{continuous-drawing-helper-DqHIR_qF.mjs → continuous-drawing-helper-CTfGRTfH.mjs} +3 -3
- package/lib/{continuous-drawing-helper-DqHIR_qF.mjs.map → continuous-drawing-helper-CTfGRTfH.mjs.map} +1 -1
- package/lib/dimensioning-helper-CQlesi-m.mjs +2 -0
- package/lib/{dimensioning-helper-CGPjS2hW.mjs → dimensioning-helper-DSlkLDmx.mjs} +42 -36
- package/lib/dimensioning-helper-DSlkLDmx.mjs.map +1 -0
- package/lib/{glb-viewer-BWMMzvuG.mjs → glb-viewer-AGV-_xKd.mjs} +33 -33
- package/lib/{glb-viewer-BWMMzvuG.mjs.map → glb-viewer-AGV-_xKd.mjs.map} +1 -1
- package/lib/glb-viewer-DSzNR4CI.mjs +2 -0
- package/lib/{highlight-coordinator-DYjBxYpy.mjs → highlight-coordinator-DU6oFunq.mjs} +6 -6
- package/lib/{highlight-coordinator-DYjBxYpy.mjs.map → highlight-coordinator-DU6oFunq.mjs.map} +1 -1
- package/lib/{homag-intelligence-lbse0Y0v.mjs → homag-intelligence-D_yBv0ig.mjs} +3 -3
- package/lib/{homag-intelligence-lbse0Y0v.mjs.map → homag-intelligence-D_yBv0ig.mjs.map} +1 -1
- package/lib/{hosek-wilkie-sky-iMar2iw-.mjs → hosek-wilkie-sky-DmTvnxMA.mjs} +33 -33
- package/lib/{hosek-wilkie-sky-iMar2iw-.mjs.map → hosek-wilkie-sky-DmTvnxMA.mjs.map} +1 -1
- package/lib/{imos-ix-poc-export-helper-CyGqK7nu.mjs → imos-ix-poc-export-helper-BGN97m8W.mjs} +3 -3
- package/lib/{imos-ix-poc-export-helper-CyGqK7nu.mjs.map → imos-ix-poc-export-helper-BGN97m8W.mjs.map} +1 -1
- package/lib/kernel-BWfRHWkW.mjs.map +1 -1
- package/lib/{kernel-utils-BvatnA7U.mjs → kernel-utils-BYKmP0mf.mjs} +13 -13
- package/lib/{kernel-utils-BvatnA7U.mjs.map → kernel-utils-BYKmP0mf.mjs.map} +1 -1
- package/lib/{material-viewer-BKTxh5Ui.mjs → material-viewer-BuBSXGw6.mjs} +18 -18
- package/lib/{material-viewer-BKTxh5Ui.mjs.map → material-viewer-BuBSXGw6.mjs.map} +1 -1
- package/lib/{packages-B4K6xrdJ.mjs → packages-CduZDHYG.mjs} +5 -5
- package/lib/{packages-B4K6xrdJ.mjs.map → packages-CduZDHYG.mjs.map} +1 -1
- package/lib/planner-B-SWR4R8.mjs +2 -0
- package/lib/{planner-HMMHSMAp.mjs → planner-BuBkFbra.mjs} +3 -3
- package/lib/{planner-HMMHSMAp.mjs.map → planner-BuBkFbra.mjs.map} +1 -1
- package/lib/{plugin-system-CRaC04G5.mjs → plugin-system-CPf99Zkf.mjs} +2 -2
- package/lib/{plugin-system-CRaC04G5.mjs.map → plugin-system-CPf99Zkf.mjs.map} +1 -1
- package/lib/{render-cache-DCPIQbO1.mjs → render-cache-CPppt7Rd.mjs} +5 -5
- package/lib/{render-cache-DCPIQbO1.mjs.map → render-cache-CPppt7Rd.mjs.map} +1 -1
- package/lib/{render-order-BPF2wDMw.mjs → render-order-a0QAbB7Q.mjs} +2 -2
- package/lib/{render-order-BPF2wDMw.mjs.map → render-order-a0QAbB7Q.mjs.map} +1 -1
- package/lib/roomle-headless.d.ts +21 -6
- package/lib/roomle-headless.js +14 -14
- package/lib/{roomle-renderer-Ato6RMrd.mjs → roomle-renderer-UJINLYxS.mjs} +2 -2
- package/lib/roomle-renderer-UJINLYxS.mjs.map +1 -0
- package/lib/{roomle-sdk-5aB4wxLW.mjs → roomle-sdk-CcNdTp_n.mjs} +2109 -2117
- package/lib/roomle-sdk-CcNdTp_n.mjs.map +1 -0
- package/lib/roomle-sdk.d.ts +21 -6
- package/lib/roomle-sdk.js +7 -7
- package/lib/{roomle-webgpu-renderer-BfZKcXSz.mjs → roomle-webgpu-renderer-BSvxbopA.mjs} +900 -707
- package/lib/roomle-webgpu-renderer-BSvxbopA.mjs.map +1 -0
- package/lib/{scene-renderer-DXvavD4L.mjs → scene-renderer--DzrpIl_.mjs} +309 -309
- package/lib/{scene-renderer-DXvavD4L.mjs.map → scene-renderer--DzrpIl_.mjs.map} +1 -1
- package/lib/{script-loader-axxcKvph.mjs → script-loader-D6i0wQ_j.mjs} +2 -2
- package/lib/{script-loader-axxcKvph.mjs.map → script-loader-D6i0wQ_j.mjs.map} +1 -1
- package/lib/{shading-settings-BBhR7KcS.mjs → shading-settings-6v-7O_Sz.mjs} +49 -49
- package/lib/{shading-settings-BBhR7KcS.mjs.map → shading-settings-6v-7O_Sz.mjs.map} +1 -1
- package/lib/src-6KtBPZXp.mjs +2 -0
- package/lib/{src-HhklrVDg.mjs → src-Dg0wYIom.mjs} +150 -150
- package/lib/{src-HhklrVDg.mjs.map → src-Dg0wYIom.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/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-BSmoG68E.mjs → stats-helper-DYjPPDnz.mjs} +2 -2
- package/lib/{stats-helper-BSmoG68E.mjs.map → stats-helper-DYjPPDnz.mjs.map} +1 -1
- package/lib/{three.core-0KaTx8dm.mjs → three.core-BTUCraWz.mjs} +976 -884
- package/lib/three.core-BTUCraWz.mjs.map +1 -0
- package/lib/{three.module-dym6j3lO.mjs → three.module-DUSFrLM6.mjs} +1789 -1739
- package/lib/three.module-DUSFrLM6.mjs.map +1 -0
- package/lib/three.tsl-De6A-G56.mjs +158 -0
- package/lib/three.tsl-De6A-G56.mjs.map +1 -0
- package/lib/three.tsl-DtfvggFX.mjs +2 -0
- package/lib/three.webgpu-B1OhMci_.mjs +3 -0
- package/lib/{three.webgpu-D3nSEIjD.mjs → three.webgpu-wPiwbpFM.mjs} +5806 -4926
- package/lib/three.webgpu-wPiwbpFM.mjs.map +1 -0
- package/lib/{threejs-utils-CLdyrCet.mjs → threejs-utils-lVSsgAiQ.mjs} +193 -202
- package/lib/threejs-utils-lVSsgAiQ.mjs.map +1 -0
- package/lib/{tools-core-DusxT3AY.mjs → tools-core-CRGER_KC.mjs} +3 -3
- package/lib/{tools-core-DusxT3AY.mjs.map → tools-core-CRGER_KC.mjs.map} +1 -1
- package/lib/{webgpu-BHAP6BLI.mjs → webgpu-BxYJfBjz.mjs} +555 -555
- package/lib/{webgpu-BHAP6BLI.mjs.map → webgpu-BxYJfBjz.mjs.map} +1 -1
- package/package.json +5 -5
- package/lib/BufferGeometry-Bl5whHAB.mjs.map +0 -1
- package/lib/GLTFExporter-yQ7mMauu.mjs.map +0 -1
- package/lib/GaussianBlurNode-DNBEf5-n.mjs +0 -59
- package/lib/GaussianBlurNode-DNBEf5-n.mjs.map +0 -1
- package/lib/Object3D-BHdngbxB.mjs.map +0 -1
- package/lib/PointLightHelper-CuPSBuDU.mjs.map +0 -1
- package/lib/SpotLightHelper-m-Rh8vGU.mjs.map +0 -1
- package/lib/USDZExporter-MdkuT226.mjs.map +0 -1
- package/lib/Vector4-C7TlIAyy.mjs.map +0 -1
- package/lib/common-utils-DbL4tku0.mjs.map +0 -1
- package/lib/configurator-ymHt9qjg.mjs +0 -2
- package/lib/dimensioning-helper-CGPjS2hW.mjs.map +0 -1
- package/lib/dimensioning-helper-VndKlIXS.mjs +0 -2
- package/lib/glb-viewer-D5QHd6Da.mjs +0 -2
- package/lib/planner-BM825oIz.mjs +0 -2
- package/lib/roomle-renderer-Ato6RMrd.mjs.map +0 -1
- package/lib/roomle-sdk-5aB4wxLW.mjs.map +0 -1
- package/lib/roomle-webgpu-renderer-BfZKcXSz.mjs.map +0 -1
- package/lib/src-Bbq3Hqzn.mjs +0 -2
- package/lib/three.core-0KaTx8dm.mjs.map +0 -1
- package/lib/three.module-dym6j3lO.mjs.map +0 -1
- package/lib/three.tsl-BTc4fg8T.mjs +0 -2
- package/lib/three.tsl-Cf0-sCqB.mjs +0 -152
- package/lib/three.tsl-Cf0-sCqB.mjs.map +0 -1
- package/lib/three.webgpu-ClICiWlK.mjs +0 -3
- package/lib/three.webgpu-D3nSEIjD.mjs.map +0 -1
- package/lib/threejs-utils-CLdyrCet.mjs.map +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { j as e } from "./threejs-utils-
|
|
2
|
-
import {
|
|
3
|
-
import { r as
|
|
4
|
-
import { C as
|
|
5
|
-
import { n as
|
|
6
|
-
import { t as
|
|
7
|
-
import { n as
|
|
8
|
-
import "./dimensioning-helper-
|
|
9
|
-
import { a as
|
|
1
|
+
import { j as e } from "./threejs-utils-lVSsgAiQ.mjs";
|
|
2
|
+
import { Ai as t, Ar as n, Bt as r, Di as i, Dn as a, E as o, Ei as s, Er as c, Gr as l, Ht as u, J as d, Jt as f, Kn as p, Kr as m, Pr as h, S as g, Ti as _, V as v, Y as ee, Z as y, _i as b, _n as te, at as ne, ci as re, cn as x, ct as S, dn as ie, f as ae, gi as C, gn as oe, h as se, hn as ce, ht as le, ii as w, jn as ue, kn as de, li as fe, ln as T, mt as pe, pn as me, st as he, tn as ge, un as E, vn as _e, w as D, xn as O, y as ve, yi as ye, z as k } from "./three.core-BTUCraWz.mjs";
|
|
3
|
+
import { r as be } from "./three.module-DUSFrLM6.mjs";
|
|
4
|
+
import { C as A, D as xe, E as Se, O as j, S as M, T as Ce, _ as we, a as Te, b as N, d as Ee, f as De, g as P, h as Oe, i as ke, l as F, m as Ae, n as je, o as Me, p as Ne, r as Pe, s as Fe, t as Ie, u as I, v as Le, w as L, x as R, y as z } from "./shading-settings-6v-7O_Sz.mjs";
|
|
5
|
+
import { n as B, t as V } from "./Pass-DCljS3Z-.mjs";
|
|
6
|
+
import { t as Re } from "./render-order-a0QAbB7Q.mjs";
|
|
7
|
+
import { n as ze, r as Be, t as Ve } from "./decorate-Bl-JF_YY.mjs";
|
|
8
|
+
import "./dimensioning-helper-DSlkLDmx.mjs";
|
|
9
|
+
import { a as H, i as U, n as He, o as Ue, r as We, t as Ge } from "./render-cache-CPppt7Rd.mjs";
|
|
10
10
|
//#region packages/common-core/src/webgl/renderer/objects/shadow-ground-plane.ts
|
|
11
|
-
var
|
|
11
|
+
var W = class e extends T {
|
|
12
12
|
static {
|
|
13
13
|
this.alphaMap = !0;
|
|
14
14
|
}
|
|
15
|
-
constructor(
|
|
16
|
-
super(new
|
|
15
|
+
constructor(t, n) {
|
|
16
|
+
super(new ue(1, 1, 10, 10), new te({
|
|
17
17
|
color: e.alphaMap ? 0 : 16777215,
|
|
18
18
|
transparent: !0,
|
|
19
19
|
depthWrite: !1,
|
|
20
20
|
polygonOffset: !0,
|
|
21
21
|
name: "ShadowGroundPlaneMaterial"
|
|
22
|
-
})), this.name = "ShadowGroundPlane", this.userData.isFloor = !0, this.renderOrder =
|
|
22
|
+
})), this.name = "ShadowGroundPlane", this.userData.isFloor = !0, this.renderOrder = Re.SHADOW_GROUND_PLANE, this.receiveShadow = !1, this.layers.disableAll(), n && this.updateMaterial(n), this.setShadowMap(t);
|
|
23
23
|
}
|
|
24
24
|
setVisibility(e) {
|
|
25
25
|
this.visible = e, this.setVisibilityLayers(e);
|
|
@@ -42,7 +42,7 @@ var U = class e extends b {
|
|
|
42
42
|
let t = this.material;
|
|
43
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;
|
|
44
44
|
}
|
|
45
|
-
},
|
|
45
|
+
}, G = class extends B {
|
|
46
46
|
get renderPassManager() {
|
|
47
47
|
return this._renderPassManager;
|
|
48
48
|
}
|
|
@@ -67,19 +67,19 @@ var U = class e extends b {
|
|
|
67
67
|
render(e, t, n, r, i) {
|
|
68
68
|
this.renderPass(e);
|
|
69
69
|
}
|
|
70
|
-
},
|
|
70
|
+
}, Ke = {
|
|
71
71
|
uniforms: {
|
|
72
72
|
tDiffuse: { value: null },
|
|
73
|
-
intensity: { value: new
|
|
73
|
+
intensity: { value: new _(1, 1) }
|
|
74
74
|
},
|
|
75
75
|
vertexShader: "\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",
|
|
76
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 }"
|
|
77
|
-
}, qe = class extends
|
|
77
|
+
}, qe = class extends l {
|
|
78
78
|
constructor(e) {
|
|
79
79
|
super({
|
|
80
|
-
uniforms:
|
|
81
|
-
vertexShader:
|
|
82
|
-
fragmentShader:
|
|
80
|
+
uniforms: C.clone(Ke.uniforms),
|
|
81
|
+
vertexShader: Ke.vertexShader,
|
|
82
|
+
fragmentShader: Ke.fragmentShader,
|
|
83
83
|
transparent: !0,
|
|
84
84
|
depthTest: !1,
|
|
85
85
|
depthWrite: !1,
|
|
@@ -89,7 +89,7 @@ var U = class e extends b {
|
|
|
89
89
|
blendSrcAlpha: 206,
|
|
90
90
|
blendDstAlpha: 200,
|
|
91
91
|
blendEquationAlpha: 100
|
|
92
|
-
}), this._intensity = new
|
|
92
|
+
}), this._intensity = new _(1, 1), this.uniforms.intensity.value = this._intensity, this.update(e);
|
|
93
93
|
}
|
|
94
94
|
update(e) {
|
|
95
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;
|
|
@@ -101,13 +101,13 @@ var U = class e extends b {
|
|
|
101
101
|
a += `vec3(${n.x}, ${n.y}, ${n.z})${t < e - 1 ? "," : ")"}`;
|
|
102
102
|
}
|
|
103
103
|
return a;
|
|
104
|
-
}, Ye = (e, t,
|
|
105
|
-
let
|
|
106
|
-
for (let
|
|
107
|
-
let
|
|
108
|
-
|
|
104
|
+
}, Ye = (e, t, n, r) => {
|
|
105
|
+
let i = [];
|
|
106
|
+
for (let a = 0; a < e; a++) {
|
|
107
|
+
let o = 2 * Math.PI * t * a / e, c = (1 + (n - 1) * (a / (e - 1)) ** r) / n;
|
|
108
|
+
i.push(new s(Math.cos(o), Math.sin(o), c));
|
|
109
109
|
}
|
|
110
|
-
return
|
|
110
|
+
return i;
|
|
111
111
|
}, K = {
|
|
112
112
|
name: "PoissonDenoiseShader",
|
|
113
113
|
defines: {
|
|
@@ -127,10 +127,10 @@ var U = class e extends b {
|
|
|
127
127
|
tNormal: { value: null },
|
|
128
128
|
tDepth: { value: null },
|
|
129
129
|
tNoise: { value: null },
|
|
130
|
-
resolution: { value: new
|
|
131
|
-
cameraProjectionMatrix: { value: new
|
|
132
|
-
cameraProjectionMatrixInverse: { value: new
|
|
133
|
-
cameraWorldMatrix: { value: new
|
|
130
|
+
resolution: { value: new _() },
|
|
131
|
+
cameraProjectionMatrix: { value: new x() },
|
|
132
|
+
cameraProjectionMatrixInverse: { value: new x() },
|
|
133
|
+
cameraWorldMatrix: { value: new x() },
|
|
134
134
|
lumaPhi: { value: 5 },
|
|
135
135
|
depthPhi: { value: 1 },
|
|
136
136
|
normalPhi: { value: 1 },
|
|
@@ -138,8 +138,8 @@ var U = class e extends b {
|
|
|
138
138
|
radiusExponent: { value: 1.3 },
|
|
139
139
|
iteration: { value: 0 },
|
|
140
140
|
noOfIterations: { value: 2 },
|
|
141
|
-
sceneBoxMin: { value: new
|
|
142
|
-
sceneBoxMax: { value: new
|
|
141
|
+
sceneBoxMin: { value: new s(-1, -1, -1) },
|
|
142
|
+
sceneBoxMax: { value: new s(1, 1, 1) }
|
|
143
143
|
},
|
|
144
144
|
vertexShader: "\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
145
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}"
|
|
@@ -161,24 +161,24 @@ var U = class e extends b {
|
|
|
161
161
|
this._inputTexture = e;
|
|
162
162
|
}
|
|
163
163
|
constructor(e, t, n, r) {
|
|
164
|
-
this.needsUpdate = !0, this.parameters = { ...Xe }, this._width = 0, this._height = 0, this._samples = 0, this._normalVectorSourceType =
|
|
164
|
+
this.needsUpdate = !0, this.parameters = { ...Xe }, this._width = 0, this._height = 0, this._samples = 0, this._normalVectorSourceType = I.FLOAT_BUFFER_NORMAL, this._depthValueSourceType = F.NORMAL_VECTOR_ALPHA, this._inputTexture = null, this.depthTexture = null, this.normalTexture = null, this._noiseTexture = null, this._renderTargets = [], this._outputRenderTargetIndex = 0, this._passRenderer = new Ne(), this._rgInputTexture = !1, this._luminanceWeighted = !0, this._width = e, this._height = t, this._samples = n, this._normalVectorSourceType = r?.normalVectorSourceType || I.FLOAT_BUFFER_NORMAL, this._depthValueSourceType = r?.depthValueSourceType || F.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);
|
|
165
165
|
}
|
|
166
166
|
_getNoiseTexture(e = 64) {
|
|
167
167
|
if (!this._noiseTexture) {
|
|
168
|
-
let t = new
|
|
168
|
+
let t = new Oe(), n = new Uint8Array(e * e * 4);
|
|
169
169
|
for (let r = 0; r < e; r++) for (let i = 0; i < e; i++) {
|
|
170
170
|
let a = r, o = i;
|
|
171
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;
|
|
172
172
|
}
|
|
173
|
-
this._noiseTexture = new
|
|
173
|
+
this._noiseTexture = new v(n, e, e, p, b), this._noiseTexture.wrapS = h, this._noiseTexture.wrapT = h, this._noiseTexture.needsUpdate = !0;
|
|
174
174
|
}
|
|
175
175
|
return this._noiseTexture;
|
|
176
176
|
}
|
|
177
177
|
_getMaterial(e, t) {
|
|
178
178
|
let n = t;
|
|
179
|
-
return this._pdMaterial || (this._pdMaterial = new
|
|
179
|
+
return this._pdMaterial || (this._pdMaterial = new l({
|
|
180
180
|
defines: Object.assign({}, K.defines),
|
|
181
|
-
uniforms:
|
|
181
|
+
uniforms: C.clone(K.uniforms),
|
|
182
182
|
vertexShader: K.vertexShader,
|
|
183
183
|
fragmentShader: K.fragmentShader,
|
|
184
184
|
depthTest: !1,
|
|
@@ -186,25 +186,25 @@ var U = class e extends b {
|
|
|
186
186
|
}), this._pdMaterial.uniforms.tNoise.value = this._getNoiseTexture(), n = !0), n && this._updateShader(this._pdMaterial), this._updateUniforms(this._pdMaterial, e, n), this._pdMaterial;
|
|
187
187
|
}
|
|
188
188
|
_updateShader(e) {
|
|
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 ===
|
|
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 === I.FLOAT_BUFFER_NORMAL ? 2 : 1, e.defines.DEPTH_VALUE_SOURCE = this._depthValueSourceType === F.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;
|
|
190
190
|
}
|
|
191
191
|
_updateUniforms(e, t, n) {
|
|
192
|
-
let r = this._depthValueSourceType ===
|
|
192
|
+
let r = this._depthValueSourceType === F.NORMAL_VECTOR_ALPHA ? this.normalTexture : this.depthTexture;
|
|
193
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)));
|
|
194
194
|
}
|
|
195
195
|
_getRenderTargets() {
|
|
196
|
-
return this._renderTargets.length < 2 && (this._renderTargets = [new
|
|
196
|
+
return this._renderTargets.length < 2 && (this._renderTargets = [new t(this._width, this._height, {
|
|
197
197
|
samples: this._samples,
|
|
198
|
-
format:
|
|
198
|
+
format: p,
|
|
199
199
|
type: le,
|
|
200
|
-
magFilter:
|
|
201
|
-
minFilter:
|
|
202
|
-
}), new
|
|
200
|
+
magFilter: O,
|
|
201
|
+
minFilter: O
|
|
202
|
+
}), new t(this._width, this._height, {
|
|
203
203
|
samples: this._samples,
|
|
204
|
-
format:
|
|
204
|
+
format: p,
|
|
205
205
|
type: le,
|
|
206
|
-
magFilter:
|
|
207
|
-
minFilter:
|
|
206
|
+
magFilter: O,
|
|
207
|
+
minFilter: O
|
|
208
208
|
})]), this._renderTargets;
|
|
209
209
|
}
|
|
210
210
|
dispose() {
|
|
@@ -214,7 +214,7 @@ var U = class e extends b {
|
|
|
214
214
|
this._width = e, this._height = t, this._renderTargets.forEach((n) => n.setSize(e, t)), this.needsUpdate = !0;
|
|
215
215
|
}
|
|
216
216
|
updateBounds(e) {
|
|
217
|
-
this._sceneClipBox = new
|
|
217
|
+
this._sceneClipBox = new ae().copy(e), this.needsUpdate = !0;
|
|
218
218
|
}
|
|
219
219
|
updateParameters(e) {
|
|
220
220
|
for (let t in e) this.parameters.hasOwnProperty(t) && (this.parameters[t] = e[t], this.needsUpdate = !0);
|
|
@@ -252,12 +252,12 @@ var U = class e extends b {
|
|
|
252
252
|
shadowOnGround: !1,
|
|
253
253
|
alwaysUpdate: !1,
|
|
254
254
|
progressiveDenoiseIterations: 0
|
|
255
|
-
}, Y = class extends
|
|
255
|
+
}, Y = class extends G {
|
|
256
256
|
static {
|
|
257
|
-
this.shadowTransform = new
|
|
257
|
+
this.shadowTransform = new x().set(0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1);
|
|
258
258
|
}
|
|
259
259
|
get aoAndSoftShadowRenderTarget() {
|
|
260
|
-
return this._aoAndSoftShadowRenderTarget = this._aoAndSoftShadowRenderTarget ?? new
|
|
260
|
+
return this._aoAndSoftShadowRenderTarget = this._aoAndSoftShadowRenderTarget ?? new t(this._width, this._height, {
|
|
261
261
|
samples: this._samples,
|
|
262
262
|
format: 1030,
|
|
263
263
|
magFilter: this._samples > 1 ? 1006 : 1003,
|
|
@@ -265,9 +265,9 @@ var U = class e extends b {
|
|
|
265
265
|
}), this._aoAndSoftShadowRenderTarget;
|
|
266
266
|
}
|
|
267
267
|
get aoRenderPass() {
|
|
268
|
-
return this._aoPass ||= new
|
|
269
|
-
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
270
|
-
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
268
|
+
return this._aoPass ||= new Me(this._width, this._height, this._samples, !this.parameters.applyToMaterial, {
|
|
269
|
+
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? I.FLOAT_BUFFER_NORMAL : I.INPUT_RGB_NORMAL,
|
|
270
|
+
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? F.NORMAL_VECTOR_ALPHA : F.SEPARATE_BUFFER,
|
|
271
271
|
modulateRedChannel: !0,
|
|
272
272
|
aoParameters: this.parameters.ao
|
|
273
273
|
}), this._aoPass;
|
|
@@ -277,8 +277,8 @@ var U = class e extends b {
|
|
|
277
277
|
inputTexture: void 0,
|
|
278
278
|
depthTexture: this.gBufferTextures.depthBufferTexture,
|
|
279
279
|
normalTexture: this.gBufferTextures.gBufferTexture,
|
|
280
|
-
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
281
|
-
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
280
|
+
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? I.FLOAT_BUFFER_NORMAL : I.INPUT_RGB_NORMAL,
|
|
281
|
+
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? F.NORMAL_VECTOR_ALPHA : F.SEPARATE_BUFFER,
|
|
282
282
|
rgInputTexture: !0,
|
|
283
283
|
luminanceWeighted: !1,
|
|
284
284
|
fragmentOutput: "vec4(1.0, denoised.x, 0.0, 1.0)",
|
|
@@ -301,7 +301,7 @@ var U = class e extends b {
|
|
|
301
301
|
return this._softShadowPass;
|
|
302
302
|
}
|
|
303
303
|
get fadeRenderTarget() {
|
|
304
|
-
return this._fadeRenderTarget = this._fadeRenderTarget ?? new
|
|
304
|
+
return this._fadeRenderTarget = this._fadeRenderTarget ?? new t(this._width, this._height, {
|
|
305
305
|
samples: this._samples,
|
|
306
306
|
format: 1030,
|
|
307
307
|
magFilter: this._samples > 1 ? 1006 : 1003,
|
|
@@ -313,8 +313,8 @@ var U = class e extends b {
|
|
|
313
313
|
inputTexture: this.aoAndSoftShadowRenderTarget.texture,
|
|
314
314
|
depthTexture: this.gBufferTextures.depthBufferTexture,
|
|
315
315
|
normalTexture: this.gBufferTextures.gBufferTexture,
|
|
316
|
-
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
317
|
-
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ?
|
|
316
|
+
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? I.FLOAT_BUFFER_NORMAL : I.INPUT_RGB_NORMAL,
|
|
317
|
+
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? F.NORMAL_VECTOR_ALPHA : F.SEPARATE_BUFFER,
|
|
318
318
|
rgInputTexture: !0,
|
|
319
319
|
luminanceWeighted: !1,
|
|
320
320
|
fragmentOutput: "vec4(denoised.xy, vec2(fract(depth * 1024.0), floor(depth * 1024.0)))",
|
|
@@ -339,7 +339,7 @@ var U = class e extends b {
|
|
|
339
339
|
shadowFadeInBlurType: q.FULL,
|
|
340
340
|
shadowFadeInMix: 0,
|
|
341
341
|
noOStaticFrames: 0
|
|
342
|
-
}, this._cameraUpdate = new
|
|
342
|
+
}, this._cameraUpdate = new De(), this._finalTexture = null, this._onlyHardShadow = !1, this._width = t, this._height = n, this._samples = r, this.parameters = {
|
|
343
343
|
enabled: i?.enabled ?? J.enabled,
|
|
344
344
|
applyToMaterial: i?.applyToMaterial ?? J.applyToMaterial,
|
|
345
345
|
aoIntensity: i?.aoIntensity ?? J.aoIntensity,
|
|
@@ -349,9 +349,9 @@ var U = class e extends b {
|
|
|
349
349
|
alwaysUpdate: i?.alwaysUpdate ?? J.alwaysUpdate,
|
|
350
350
|
progressiveDenoiseIterations: i?.progressiveDenoiseIterations ?? J.progressiveDenoiseIterations,
|
|
351
351
|
shadow: { ...Qe },
|
|
352
|
-
ao: { ...
|
|
352
|
+
ao: { ...Fe },
|
|
353
353
|
poissonDenoise: { ...Xe }
|
|
354
|
-
}, this._copyMaterial = new
|
|
354
|
+
}, this._copyMaterial = new N(), this._blendMaterial = new N({}, z.DEFAULT), this._blendAoAndShadowMaterial = new qe();
|
|
355
355
|
}
|
|
356
356
|
dispose() {
|
|
357
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();
|
|
@@ -420,13 +420,13 @@ var U = class e extends b {
|
|
|
420
420
|
return i && (this._copyMaterial.update({
|
|
421
421
|
texture: t,
|
|
422
422
|
blending: 0,
|
|
423
|
-
colorTransform:
|
|
424
|
-
colorBase:
|
|
423
|
+
colorTransform: R,
|
|
424
|
+
colorBase: j,
|
|
425
425
|
multiplyChannels: 0
|
|
426
426
|
}), this.passRenderer.renderScreenSpace(e, this._copyMaterial, this.fadeRenderTarget)), r > .001 && (this._blendMaterial.update({
|
|
427
427
|
texture: n,
|
|
428
428
|
blending: i ? 5 : 0,
|
|
429
|
-
colorTransform: new
|
|
429
|
+
colorTransform: new x().set(0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, i ? r : 1),
|
|
430
430
|
multiplyChannels: 0
|
|
431
431
|
}), this.passRenderer.renderScreenSpace(e, this._blendMaterial, this.fadeRenderTarget)), this.fadeRenderTarget.texture;
|
|
432
432
|
}
|
|
@@ -487,22 +487,22 @@ var U = class e extends b {
|
|
|
487
487
|
if (!e.isMesh || !e.castShadow && !e.userData?.meshId) return !1;
|
|
488
488
|
let t = e.material;
|
|
489
489
|
return !t.transparent || t.opacity > .5;
|
|
490
|
-
}, tt = class extends
|
|
490
|
+
}, tt = class extends G {
|
|
491
491
|
static {
|
|
492
492
|
this.addTestMesh = !1;
|
|
493
493
|
}
|
|
494
494
|
get shadowGroundPlane() {
|
|
495
495
|
let e = this._sharedShadowGroundPlane;
|
|
496
|
-
return e ||= (this._shadowGroundPlane ??= new
|
|
496
|
+
return e ||= (this._shadowGroundPlane ??= new W(this.renderTarget.texture, this.parameters), this._shadowGroundPlane), e.parent !== this._groundGroup && this._groundGroup.add(e), e;
|
|
497
497
|
}
|
|
498
|
-
constructor(e,
|
|
499
|
-
super(e), this.limitPlaneSize = !0, this.needsUpdate = !0, this.noNeedOfUpdateCount = 0, this._blurScale = 1, this._shadowScale = 1, this._groundGroup =
|
|
498
|
+
constructor(e, n, r, i) {
|
|
499
|
+
super(e), this.limitPlaneSize = !0, this.needsUpdate = !0, this.noNeedOfUpdateCount = 0, this._blurScale = 1, this._shadowScale = 1, this._groundGroup = r, this.shadowMapSize = i.shadowMapSize ?? 2048, this.parameters = this._getDefaultParameters(i), this._groundShadowFar = this.parameters.cameraFar, this._renderer = n, this.renderCacheManager?.registerCache(this, new U((e) => e.isMesh && !et(e) || e.name !== void 0 && ["Ground", "Floor"].includes(e.name))), this.renderTarget = new t(this.shadowMapSize, this.shadowMapSize), this.renderTarget.texture.generateMipmaps = !1, this._renderTargetBlur = new t(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 ie(), this._depthMaterial.userData.fadeoutBias = { value: this.parameters.fadeoutBias }, this._depthMaterial.userData.fadeoutFalloff = { value: this.parameters.fadeoutFalloff }, this._depthMaterial.onBeforeCompile = (e) => {
|
|
500
500
|
e.uniforms.fadeoutBias = this._depthMaterial.userData.fadeoutBias, e.uniforms.fadeoutFalloff = this._depthMaterial.userData.fadeoutFalloff, e.fragmentShader = `
|
|
501
501
|
uniform float fadeoutBias;
|
|
502
502
|
uniform float fadeoutFalloff;
|
|
503
|
-
${e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );",
|
|
503
|
+
${e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );", W.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));")}
|
|
504
504
|
`;
|
|
505
|
-
}, 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 Ee(Le, {
|
|
506
506
|
...i,
|
|
507
507
|
passRenderer: this.renderPassManager.passRenderer
|
|
508
508
|
}), this.updatePlaneAndShadowCamera();
|
|
@@ -608,7 +608,7 @@ var U = class e extends b {
|
|
|
608
608
|
setCameraHelperVisibility(e) {
|
|
609
609
|
this.cameraHelper && (this.cameraHelper.visible = e);
|
|
610
610
|
}
|
|
611
|
-
}, rt = "varying vec3 vNormal;\n#if LINEAR_DEPTH == 1\n varying float vZ; \n#endif\n\n void main() {\n vNormal = normalMatrix * normal;\n vec4 viewPosition = modelViewMatrix * vec4(position, 1.0);\n #if LINEAR_DEPTH == 1\n vZ = viewPosition.z; \n #endif\n gl_Position = projectionMatrix * viewPosition;\n }", it = "varying vec3 vNormal;\n#if LINEAR_DEPTH == 1\n varying float vZ; \n uniform float cameraNear;\n uniform float cameraFar;\n#endif\n\n void main() {\n #if FLOAT_BUFFER == 1\n vec3 normal = normalize(vNormal);\n #else\n vec3 normal = normalize(vNormal) * 0.5 + 0.5;\n #endif\n #if LINEAR_DEPTH == 1\n float depth = (-vZ - cameraNear) / (cameraFar - cameraNear);\n #else\n float depth = gl_FragCoord.z;\n #endif\n gl_FragColor = vec4(normal, depth);\n }", at = class e extends
|
|
611
|
+
}, rt = "varying vec3 vNormal;\n#if LINEAR_DEPTH == 1\n varying float vZ; \n#endif\n\n void main() {\n vNormal = normalMatrix * normal;\n vec4 viewPosition = modelViewMatrix * vec4(position, 1.0);\n #if LINEAR_DEPTH == 1\n vZ = viewPosition.z; \n #endif\n gl_Position = projectionMatrix * viewPosition;\n }", it = "varying vec3 vNormal;\n#if LINEAR_DEPTH == 1\n varying float vZ; \n uniform float cameraNear;\n uniform float cameraFar;\n#endif\n\n void main() {\n #if FLOAT_BUFFER == 1\n vec3 normal = normalize(vNormal);\n #else\n vec3 normal = normalize(vNormal) * 0.5 + 0.5;\n #endif\n #if LINEAR_DEPTH == 1\n float depth = (-vZ - cameraNear) / (cameraFar - cameraNear);\n #else\n float depth = gl_FragCoord.z;\n #endif\n gl_FragColor = vec4(normal, depth);\n }", at = class e extends l {
|
|
612
612
|
static {
|
|
613
613
|
this._normalAndDepthShader = {
|
|
614
614
|
uniforms: {
|
|
@@ -630,7 +630,7 @@ var U = class e extends b {
|
|
|
630
630
|
FLOAT_BUFFER: t?.floatBufferType ? 1 : 0,
|
|
631
631
|
LINEAR_DEPTH: t?.linearDepth ? 1 : 0
|
|
632
632
|
}),
|
|
633
|
-
uniforms:
|
|
633
|
+
uniforms: C.clone(e._normalAndDepthShader.uniforms),
|
|
634
634
|
vertexShader: e._normalAndDepthShader.vertexShader,
|
|
635
635
|
fragmentShader: e._normalAndDepthShader.fragmentShader,
|
|
636
636
|
blending: t?.blending ?? 0
|
|
@@ -643,7 +643,7 @@ var U = class e extends b {
|
|
|
643
643
|
}
|
|
644
644
|
return this;
|
|
645
645
|
}
|
|
646
|
-
}, ot = class extends
|
|
646
|
+
}, ot = class extends G {
|
|
647
647
|
set groundDepthWrite(e) {
|
|
648
648
|
this._gBufferMaterialCache && (this._gBufferMaterialCache.groundDepthWrite = e);
|
|
649
649
|
}
|
|
@@ -664,18 +664,18 @@ var U = class e extends b {
|
|
|
664
664
|
blending: 0,
|
|
665
665
|
floatBufferType: !0,
|
|
666
666
|
linearDepth: !1
|
|
667
|
-
}) : new
|
|
667
|
+
}) : new ce({ blending: 0 })), this._gBufferRenderMaterial instanceof at && this._gBufferRenderMaterial.update({ camera: e }), this._gBufferRenderMaterial;
|
|
668
668
|
}
|
|
669
669
|
get depthNormalRenderTarget() {
|
|
670
|
-
if (!this._depthNormalRenderTarget) if (this.floatRgbNormalAlphaDepth) this._depthNormalRenderTarget = new
|
|
670
|
+
if (!this._depthNormalRenderTarget) if (this.floatRgbNormalAlphaDepth) this._depthNormalRenderTarget = new t(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale, {
|
|
671
671
|
minFilter: this._targetMinificationTextureFilter,
|
|
672
672
|
magFilter: this._targetMagnificationTextureFilter,
|
|
673
|
-
type:
|
|
673
|
+
type: S,
|
|
674
674
|
samples: this._samples
|
|
675
675
|
});
|
|
676
676
|
else {
|
|
677
|
-
let e = new
|
|
678
|
-
e.format =
|
|
677
|
+
let e = new ee(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale);
|
|
678
|
+
e.format = d, e.type = ye, this._depthNormalRenderTarget = new t(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale, {
|
|
679
679
|
minFilter: this._targetMinificationTextureFilter,
|
|
680
680
|
magFilter: this._targetMagnificationTextureFilter,
|
|
681
681
|
depthTexture: e
|
|
@@ -684,10 +684,10 @@ var U = class e extends b {
|
|
|
684
684
|
return this._depthNormalRenderTarget;
|
|
685
685
|
}
|
|
686
686
|
get separateDeptRenderTarget() {
|
|
687
|
-
return this._separateDeptRenderTarget ||= new
|
|
687
|
+
return this._separateDeptRenderTarget ||= new t(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale, {
|
|
688
688
|
minFilter: this._targetMinificationTextureFilter,
|
|
689
689
|
magFilter: this._targetMagnificationTextureFilter,
|
|
690
|
-
type:
|
|
690
|
+
type: S,
|
|
691
691
|
samples: 0
|
|
692
692
|
}), this._separateDeptRenderTarget;
|
|
693
693
|
}
|
|
@@ -709,19 +709,19 @@ var U = class e extends b {
|
|
|
709
709
|
this.passRenderer.renderWithOverrideMaterial(e, t, n, this.updateGBufferRenderMaterial(n), this.depthNormalRenderTarget, 7829503, 1);
|
|
710
710
|
}
|
|
711
711
|
getCopyMaterial(e) {
|
|
712
|
-
return this._copyMaterial ??= new
|
|
712
|
+
return this._copyMaterial ??= new N(), this._copyMaterial.update(e);
|
|
713
713
|
}
|
|
714
714
|
_copyDepthToSeparateDepthTexture(e, t) {
|
|
715
715
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
716
716
|
texture: t.texture,
|
|
717
717
|
blending: 0,
|
|
718
|
-
colorTransform:
|
|
719
|
-
colorBase:
|
|
718
|
+
colorTransform: we,
|
|
719
|
+
colorBase: P,
|
|
720
720
|
multiplyChannels: 0,
|
|
721
|
-
uvTransform:
|
|
721
|
+
uvTransform: M
|
|
722
722
|
}), this.separateDeptRenderTarget);
|
|
723
723
|
}
|
|
724
|
-
}, st = class extends
|
|
724
|
+
}, st = class extends He {
|
|
725
725
|
set groundDepthWrite(e) {
|
|
726
726
|
this._groundDepthWrite = e;
|
|
727
727
|
}
|
|
@@ -733,12 +733,12 @@ var U = class e extends b {
|
|
|
733
733
|
this.addToCache(e, { visible: !1 });
|
|
734
734
|
}
|
|
735
735
|
addMesh(e) {
|
|
736
|
-
e.userData.isFloor ? this.addToCache(e, { visible: this._groundDepthWrite }) : e.visible && (
|
|
736
|
+
e.userData.isFloor ? this.addToCache(e, { visible: this._groundDepthWrite }) : e.visible && (Ue(e.material, .7) || H(e.material)) && this.addToCache(e, { visible: !1 });
|
|
737
737
|
}
|
|
738
738
|
addObject(e) {
|
|
739
739
|
e.name === "dimensioning" && this.addToCache(e, { visible: !1 });
|
|
740
740
|
}
|
|
741
|
-
}, ct = class extends
|
|
741
|
+
}, ct = class extends G {
|
|
742
742
|
get reflectionRenderTarget() {
|
|
743
743
|
return this._reflectionRenderTarget = this._reflectionRenderTarget ?? this._newRenderTarget(!0), this._reflectionRenderTarget;
|
|
744
744
|
}
|
|
@@ -762,18 +762,18 @@ var U = class e extends b {
|
|
|
762
762
|
groundReflectionScale: 1,
|
|
763
763
|
renderTargetDownScale: 4,
|
|
764
764
|
...i
|
|
765
|
-
}, this._copyMaterial = new
|
|
765
|
+
}, this._copyMaterial = new N({}, z.ADDITIVE, !0, !0), this._updateCopyMaterial(null), this._reflectionIntensityMaterial = new dt({
|
|
766
766
|
width: this._width / this.parameters.renderTargetDownScale,
|
|
767
767
|
height: this._height / this.parameters.renderTargetDownScale
|
|
768
|
-
}), this._blurPass = new
|
|
768
|
+
}), this._blurPass = new Ee(Le, {
|
|
769
769
|
...i,
|
|
770
770
|
passRenderer: this.renderPassManager.passRenderer
|
|
771
771
|
});
|
|
772
772
|
}
|
|
773
773
|
_newRenderTarget(e) {
|
|
774
|
-
let
|
|
775
|
-
return e ? (i.depthTexture = new
|
|
776
|
-
format:
|
|
774
|
+
let n = this._width / this.parameters.renderTargetDownScale, r = this._height / this.parameters.renderTargetDownScale, i = {};
|
|
775
|
+
return e ? (i.depthTexture = new ee(n, r), i.samples = this._samples) : i.samples = 1, new t(n, r, {
|
|
776
|
+
format: p,
|
|
777
777
|
...i
|
|
778
778
|
});
|
|
779
779
|
}
|
|
@@ -796,13 +796,13 @@ var U = class e extends b {
|
|
|
796
796
|
let n = this.parameters.intensity * t, r = this.parameters.brightness;
|
|
797
797
|
this._copyMaterial.update({
|
|
798
798
|
texture: e?.texture ?? void 0,
|
|
799
|
-
colorTransform: new
|
|
799
|
+
colorTransform: new x().set(r, 0, 0, 0, 0, r, 0, 0, 0, 0, r, 0, 0, 0, 0, n),
|
|
800
800
|
multiplyChannels: 0,
|
|
801
|
-
uvTransform:
|
|
801
|
+
uvTransform: A
|
|
802
802
|
}), this._copyMaterial.depthTest = !0, this._copyMaterial.depthWrite = !1;
|
|
803
803
|
}
|
|
804
804
|
renderPass(e) {
|
|
805
|
-
if (!this.parameters.enabled || !(this.camera instanceof
|
|
805
|
+
if (!this.parameters.enabled || !(this.camera instanceof de)) return;
|
|
806
806
|
let t = this._createGroundReflectionCamera(this.camera);
|
|
807
807
|
this.renderCacheManager.render("groundReflection", this.scene, () => {
|
|
808
808
|
this._renderGroundReflection(e, this.scene, t, this.reflectionRenderTarget);
|
|
@@ -827,9 +827,9 @@ var U = class e extends b {
|
|
|
827
827
|
fadeOutExponent: this.parameters.fadeOutExponent
|
|
828
828
|
}), e.getRenderTarget()), e.setRenderTarget(r);
|
|
829
829
|
}
|
|
830
|
-
blurReflection(e, t,
|
|
831
|
-
let
|
|
832
|
-
this._blurPass.render(e,
|
|
830
|
+
blurReflection(e, t, n) {
|
|
831
|
+
let r = new s(t.matrixWorld.elements[4], t.matrixWorld.elements[5], t.matrixWorld.elements[6]), i = this.parameters.blurHorizontal / this._width, a = this.parameters.blurVertical / this._height * Math.abs(r.dot(new s(0, 0, 1)));
|
|
832
|
+
this._blurPass.render(e, n, [i * 4, a * 4], [i * 4 * (1 + this.parameters.blurAscent), a * 4 * (1 + this.parameters.blurAscent)]);
|
|
833
833
|
}
|
|
834
834
|
_createGroundReflectionCamera(e) {
|
|
835
835
|
let t = e.clone(), n = t;
|
|
@@ -840,18 +840,18 @@ var U = class e extends b {
|
|
|
840
840
|
bottom: 1 - n._offset.top
|
|
841
841
|
}, t.position.set(e.position.x, -e.position.y + 2 * this.parameters.groundLevel, e.position.z), t.rotation.set(-e.rotation.x, e.rotation.y, -e.rotation.z), t.updateMatrixWorld(), t.updateProjectionMatrix(), t;
|
|
842
842
|
}
|
|
843
|
-
}, lt = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }", ut = "\n uniform sampler2D tDiffuse;\n uniform sampler2D tDepth;\n uniform vec2 resolution;\n uniform float cameraNear;\n uniform float cameraFar;\n uniform mat4 cameraProjectionMatrix;\n uniform mat4 cameraInverseProjectionMatrix;\n uniform mat4 inverseViewMatrix;\n uniform float groundLevel;\n uniform float fadeOutDistance;\n uniform float fadeOutExponent;\n varying vec2 vUv;\n\n #include <packing>\n\n float getDepth(const in vec2 screenPosition) {\n return texture2D(tDepth, screenPosition).x;\n }\n\n float getLinearDepth(const in vec2 screenPosition) {\n #if PERSPECTIVE_CAMERA == 1\n float fragCoordZ = texture2D(tDepth, screenPosition).x;\n float viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\n return viewZToOrthographicDepth(viewZ, cameraNear, cameraFar);\n #else\n return texture2D(tDepth, screenPosition).x;\n #endif\n }\n\n float getViewZ(const in float depth) {\n #if PERSPECTIVE_CAMERA == 1\n return perspectiveDepthToViewZ(depth, cameraNear, cameraFar);\n #else\n return 0.0;//orthographicDepthToViewZ(depth, cameraNear, cameraFar);\n #endif\n }\n\n vec3 getViewPosition(const in vec2 screenPosition, const in float depth, const in float viewZ ) {\n float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];\n vec4 clipPosition = vec4((vec3(screenPosition, depth) - 0.5) * 2.0, 1.0);\n clipPosition *= clipW;\n return (cameraInverseProjectionMatrix * clipPosition).xyz;\n }\n\n void main() {\n float verticalBias = 1.5 / resolution.y;\n vec2 uv = vUv.xy + vec2(0.0, verticalBias);\n float depth = getDepth(uv);\n float viewZ = getViewZ(depth);\n vec4 worldPosition = inverseViewMatrix * vec4(getViewPosition(uv, depth, viewZ), 1.0);\n float distance = worldPosition.y - groundLevel;\n vec2 diffuseTextureSize = vec2(textureSize(tDiffuse, 0 ));\n vec4 fragColor = texelFetch(tDiffuse, ivec2(uv * diffuseTextureSize), 0).rgba;\n #if LINEAR_TO_SRGB == 1\n fragColor.rgb = mix(fragColor.rgb * 12.92, 1.055 * pow(fragColor.rgb, vec3(0.41666)) - 0.055, step(0.0031308, fragColor.rgb));\n #endif\n float fadeOutAlpha = pow(clamp(1.0 - distance / fadeOutDistance, 0.0, 1.0), fadeOutExponent);\n fragColor.a *= fadeOutAlpha * step(depth, 0.9999);\n #if PREMULTIPLIED_ALPHA == 1\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n #else\n gl_FragColor = fragColor;\n #endif\n }", dt = class e extends
|
|
843
|
+
}, lt = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }", ut = "\n uniform sampler2D tDiffuse;\n uniform sampler2D tDepth;\n uniform vec2 resolution;\n uniform float cameraNear;\n uniform float cameraFar;\n uniform mat4 cameraProjectionMatrix;\n uniform mat4 cameraInverseProjectionMatrix;\n uniform mat4 inverseViewMatrix;\n uniform float groundLevel;\n uniform float fadeOutDistance;\n uniform float fadeOutExponent;\n varying vec2 vUv;\n\n #include <packing>\n\n float getDepth(const in vec2 screenPosition) {\n return texture2D(tDepth, screenPosition).x;\n }\n\n float getLinearDepth(const in vec2 screenPosition) {\n #if PERSPECTIVE_CAMERA == 1\n float fragCoordZ = texture2D(tDepth, screenPosition).x;\n float viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\n return viewZToOrthographicDepth(viewZ, cameraNear, cameraFar);\n #else\n return texture2D(tDepth, screenPosition).x;\n #endif\n }\n\n float getViewZ(const in float depth) {\n #if PERSPECTIVE_CAMERA == 1\n return perspectiveDepthToViewZ(depth, cameraNear, cameraFar);\n #else\n return 0.0;//orthographicDepthToViewZ(depth, cameraNear, cameraFar);\n #endif\n }\n\n vec3 getViewPosition(const in vec2 screenPosition, const in float depth, const in float viewZ ) {\n float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];\n vec4 clipPosition = vec4((vec3(screenPosition, depth) - 0.5) * 2.0, 1.0);\n clipPosition *= clipW;\n return (cameraInverseProjectionMatrix * clipPosition).xyz;\n }\n\n void main() {\n float verticalBias = 1.5 / resolution.y;\n vec2 uv = vUv.xy + vec2(0.0, verticalBias);\n float depth = getDepth(uv);\n float viewZ = getViewZ(depth);\n vec4 worldPosition = inverseViewMatrix * vec4(getViewPosition(uv, depth, viewZ), 1.0);\n float distance = worldPosition.y - groundLevel;\n vec2 diffuseTextureSize = vec2(textureSize(tDiffuse, 0 ));\n vec4 fragColor = texelFetch(tDiffuse, ivec2(uv * diffuseTextureSize), 0).rgba;\n #if LINEAR_TO_SRGB == 1\n fragColor.rgb = mix(fragColor.rgb * 12.92, 1.055 * pow(fragColor.rgb, vec3(0.41666)) - 0.055, step(0.0031308, fragColor.rgb));\n #endif\n float fadeOutAlpha = pow(clamp(1.0 - distance / fadeOutDistance, 0.0, 1.0), fadeOutExponent);\n fragColor.a *= fadeOutAlpha * step(depth, 0.9999);\n #if PREMULTIPLIED_ALPHA == 1\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n #else\n gl_FragColor = fragColor;\n #endif\n }", dt = class e extends l {
|
|
844
844
|
static {
|
|
845
845
|
this.shader = {
|
|
846
846
|
uniforms: {
|
|
847
847
|
tDiffuse: { value: null },
|
|
848
848
|
tDepth: { value: null },
|
|
849
|
-
resolution: { value: new
|
|
849
|
+
resolution: { value: new _() },
|
|
850
850
|
cameraNear: { value: .1 },
|
|
851
851
|
cameraFar: { value: 1 },
|
|
852
|
-
cameraProjectionMatrix: { value: new
|
|
853
|
-
cameraInverseProjectionMatrix: { value: new
|
|
854
|
-
inverseViewMatrix: { value: new
|
|
852
|
+
cameraProjectionMatrix: { value: new x() },
|
|
853
|
+
cameraInverseProjectionMatrix: { value: new x() },
|
|
854
|
+
inverseViewMatrix: { value: new x() },
|
|
855
855
|
groundLevel: { value: 0 },
|
|
856
856
|
fadeOutDistance: { value: 1 },
|
|
857
857
|
fadeOutExponent: { value: 1 }
|
|
@@ -868,7 +868,7 @@ var U = class e extends b {
|
|
|
868
868
|
constructor(t) {
|
|
869
869
|
super({
|
|
870
870
|
defines: Object.assign({}, e.shader.defines),
|
|
871
|
-
uniforms:
|
|
871
|
+
uniforms: C.clone(e.shader.uniforms),
|
|
872
872
|
vertexShader: e.shader.vertexShader,
|
|
873
873
|
fragmentShader: e.shader.fragmentShader,
|
|
874
874
|
blending: 0
|
|
@@ -885,7 +885,7 @@ var U = class e extends b {
|
|
|
885
885
|
}
|
|
886
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;
|
|
887
887
|
}
|
|
888
|
-
}, ft = class extends
|
|
888
|
+
}, ft = class extends r {
|
|
889
889
|
constructor(e, t) {
|
|
890
890
|
let n = [
|
|
891
891
|
1,
|
|
@@ -904,8 +904,8 @@ var U = class e extends b {
|
|
|
904
904
|
1,
|
|
905
905
|
0
|
|
906
906
|
], r = new se();
|
|
907
|
-
r.setAttribute("position", new
|
|
908
|
-
let i = new
|
|
907
|
+
r.setAttribute("position", new he(n, 3)), r.computeBoundingSphere();
|
|
908
|
+
let i = new u({ fog: !1 });
|
|
909
909
|
super(r, i), this.light = e, this.color = t, this.type = "RectAreaLightHelper";
|
|
910
910
|
let a = [
|
|
911
911
|
1,
|
|
@@ -927,7 +927,7 @@ var U = class e extends b {
|
|
|
927
927
|
-1,
|
|
928
928
|
0
|
|
929
929
|
], o = new se();
|
|
930
|
-
o.setAttribute("position", new
|
|
930
|
+
o.setAttribute("position", new he(a, 3)), o.computeBoundingSphere(), this.add(new T(o, new E({
|
|
931
931
|
side: 1,
|
|
932
932
|
fog: !1
|
|
933
933
|
})));
|
|
@@ -944,21 +944,21 @@ var U = class e extends b {
|
|
|
944
944
|
dispose() {
|
|
945
945
|
this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
|
|
946
946
|
}
|
|
947
|
-
}, pt = class e extends
|
|
947
|
+
}, pt = class e extends me {
|
|
948
948
|
static {
|
|
949
949
|
this._enableGroundBoundary = !1;
|
|
950
950
|
}
|
|
951
951
|
static {
|
|
952
|
-
this._shadowFadeOut = new
|
|
952
|
+
this._shadowFadeOut = new _(.1, 20);
|
|
953
953
|
}
|
|
954
954
|
static {
|
|
955
|
-
this._sceneBoxMin = new
|
|
955
|
+
this._sceneBoxMin = new s(-1, -1, -1);
|
|
956
956
|
}
|
|
957
957
|
static {
|
|
958
|
-
this._sceneBoxMax = new
|
|
958
|
+
this._sceneBoxMax = new s(1, 1, 1);
|
|
959
959
|
}
|
|
960
960
|
static {
|
|
961
|
-
this._distributionProperties = new
|
|
961
|
+
this._distributionProperties = new i(1, 1, 1, 1);
|
|
962
962
|
}
|
|
963
963
|
constructor(e) {
|
|
964
964
|
super(e), this.customProgramCacheKey = this._customProgramCacheKey, this.onBeforeCompile = this._onBeforeCompile;
|
|
@@ -996,21 +996,21 @@ var U = class e extends b {
|
|
|
996
996
|
groundBoundary: 1,
|
|
997
997
|
fadeOutDistance: .1,
|
|
998
998
|
fadeOutBlur: 5
|
|
999
|
-
}, vt = class extends
|
|
999
|
+
}, vt = class extends G {
|
|
1000
1000
|
get shadowTexture() {
|
|
1001
1001
|
return this._shadowRenderTarget.texture;
|
|
1002
1002
|
}
|
|
1003
1003
|
set shadowOnGround(e) {
|
|
1004
1004
|
this._shadowMapPassOverrideMaterialCache.shadowOnGround = e;
|
|
1005
1005
|
}
|
|
1006
|
-
constructor(e,
|
|
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
|
|
1008
|
-
let
|
|
1009
|
-
this._shadowRenderTarget = new
|
|
1010
|
-
samples:
|
|
1011
|
-
format:
|
|
1012
|
-
magFilter: this._samples > 0 ?
|
|
1013
|
-
minFilter: this._samples > 0 ?
|
|
1006
|
+
constructor(e, r, i) {
|
|
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 De(), this._viewportSize = new _(r.x, r.y), this._samples = i?.samples ?? 0, this._shadowMapSize = i?.shadowMapSize ?? 1024, this.parameters = this._getScreenSpaceShadowMapParameters(i), this.castShadow = this.parameters.enableShadowMap, this._shadowMapPassOverrideMaterialCache = new yt(), this.renderCacheManager?.registerCache(this, this._shadowMapPassOverrideMaterialCache);
|
|
1008
|
+
let a = this._samples;
|
|
1009
|
+
this._shadowRenderTarget = new t(this._viewportSize.x, this._viewportSize.y, {
|
|
1010
|
+
samples: a,
|
|
1011
|
+
format: n,
|
|
1012
|
+
magFilter: this._samples > 0 ? f : O,
|
|
1013
|
+
minFilter: this._samples > 0 ? f : O
|
|
1014
1014
|
});
|
|
1015
1015
|
}
|
|
1016
1016
|
_getScreenSpaceShadowMapParameters(e) {
|
|
@@ -1073,9 +1073,9 @@ var U = class e extends b {
|
|
|
1073
1073
|
}
|
|
1074
1074
|
_addShadowFromLightSources(e, t) {
|
|
1075
1075
|
e.forEach((e) => {
|
|
1076
|
-
let
|
|
1077
|
-
if (
|
|
1078
|
-
let t = new Ct(new
|
|
1076
|
+
let n = e.maxIntensity * t;
|
|
1077
|
+
if (n >= .1 && e.position.z >= 0) {
|
|
1078
|
+
let t = new Ct(new s(e.position.x, e.position.z, e.position.y).multiplyScalar(7), n, {
|
|
1079
1079
|
shadowMapSize: this._shadowMapSize,
|
|
1080
1080
|
shadowLightSourceType: this.parameters.shadowLightSourceType
|
|
1081
1081
|
});
|
|
@@ -1086,13 +1086,13 @@ var U = class e extends b {
|
|
|
1086
1086
|
_createShadowLightSourceArray(e) {
|
|
1087
1087
|
let t = [];
|
|
1088
1088
|
if (e) {
|
|
1089
|
-
let e = new wt(new
|
|
1089
|
+
let e = new wt(new s(0, 7, 0), { shadowMapSize: this._shadowMapSize });
|
|
1090
1090
|
t.push(e);
|
|
1091
1091
|
}
|
|
1092
1092
|
return this.parameters.enableGroundBoundary = e, t;
|
|
1093
1093
|
}
|
|
1094
1094
|
setSize(e, t) {
|
|
1095
|
-
this._viewportSize = new
|
|
1095
|
+
this._viewportSize = new _(e, t), this._shadowRenderTarget.setSize(this._viewportSize.x, this._viewportSize.y);
|
|
1096
1096
|
}
|
|
1097
1097
|
updatePositionAndTarget() {
|
|
1098
1098
|
this._shadowLightSources.forEach((e) => e.updatePositionAndTarget());
|
|
@@ -1135,7 +1135,7 @@ var U = class e extends b {
|
|
|
1135
1135
|
UNLIT: "unlit",
|
|
1136
1136
|
EMISSIVE: "emissive",
|
|
1137
1137
|
SHADOW: "shadow"
|
|
1138
|
-
}, yt = class e extends
|
|
1138
|
+
}, yt = class e extends He {
|
|
1139
1139
|
static {
|
|
1140
1140
|
this.useModifiedMaterial = !0;
|
|
1141
1141
|
}
|
|
@@ -1156,10 +1156,10 @@ var U = class e extends b {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
_createShadowMaterial(t) {
|
|
1158
1158
|
let n;
|
|
1159
|
-
return n = t === X.EMISSIVE || t === X.UNLIT ? new
|
|
1159
|
+
return n = t === X.EMISSIVE || t === X.UNLIT ? new E({
|
|
1160
1160
|
color: 16777215,
|
|
1161
1161
|
side: 2
|
|
1162
|
-
}) : t === X.SHADOW ? new
|
|
1162
|
+
}) : t === X.SHADOW ? new m({ side: 2 }) : e.useModifiedMaterial ? this._createCustomerShadowMaterial() : new oe({
|
|
1163
1163
|
color: 16777215,
|
|
1164
1164
|
shininess: 0,
|
|
1165
1165
|
polygonOffsetFactor: 0,
|
|
@@ -1180,14 +1180,14 @@ var U = class e extends b {
|
|
|
1180
1180
|
e.isLight && !e.userData.shadowLightSource && this.addToCache(e, { visible: !1 });
|
|
1181
1181
|
}
|
|
1182
1182
|
_setMeshMaterialAndVisibility(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) :
|
|
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) : Ue(e.material, .9) ? this.addToCache(e, { visible: !1 }) : e.receiveShadow ? this.addToCache(e, {
|
|
1184
1184
|
castShadow: !1,
|
|
1185
1185
|
material: this._receiveShadowMaterial
|
|
1186
1186
|
}) : this.addToCache(e, { visible: !1 });
|
|
1187
1187
|
}
|
|
1188
1188
|
_setShadowMaterialForOpaqueObject(e) {
|
|
1189
1189
|
let t = e.material;
|
|
1190
|
-
t instanceof
|
|
1190
|
+
t instanceof u || t instanceof E ? this.addToCache(e, { material: this._unlitMaterial }) : t instanceof _e ? this._setMeshShadowStandardMaterial(e, t) : this.addToCache(e, { material: e.receiveShadow ? this._shadowObjectMaterial : this._unlitMaterial });
|
|
1191
1191
|
}
|
|
1192
1192
|
_setMeshShadowStandardMaterial(e, t) {
|
|
1193
1193
|
let n = t.emissiveIntensity > 0 && (t.emissive.r > 0 || t.emissive.g > 0 || t.emissive.b > 0);
|
|
@@ -1257,7 +1257,7 @@ var U = class e extends b {
|
|
|
1257
1257
|
}
|
|
1258
1258
|
}, xt = class {
|
|
1259
1259
|
constructor(e, t) {
|
|
1260
|
-
this._isVisibleBackup = !0, this._castShadowBackup = !0, this._shadowMapSize = t?.shadowMapSize ?? 1024, this._blurSamples = t?.blurSamples ?? 8, this._shadowLightSource = e, this._shadowLightSource.visible = !1, this._shadowLightSource.castShadow = !0, this._shadowLightSource.shadow && (this._shadowLightSource.shadow.mapSize = new
|
|
1260
|
+
this._isVisibleBackup = !0, this._castShadowBackup = !0, this._shadowMapSize = t?.shadowMapSize ?? 1024, this._blurSamples = t?.blurSamples ?? 8, this._shadowLightSource = e, this._shadowLightSource.visible = !1, this._shadowLightSource.castShadow = !0, this._shadowLightSource.shadow && (this._shadowLightSource.shadow.mapSize = new _(this._shadowMapSize, this._shadowMapSize), this._shadowLightSource.shadow.blurSamples = this._blurSamples, this._shadowLightSource.shadow.autoUpdate = !1), this._shadowLightSource.userData.shadowLightSource = this;
|
|
1261
1261
|
}
|
|
1262
1262
|
getPosition() {
|
|
1263
1263
|
return this._shadowLightSource.position;
|
|
@@ -1278,10 +1278,10 @@ var U = class e extends b {
|
|
|
1278
1278
|
e.remove(this._shadowLightSource);
|
|
1279
1279
|
}
|
|
1280
1280
|
updatePositionAndTarget() {
|
|
1281
|
-
this._updateShadowPositionAndTarget(this.getPosition(), new
|
|
1281
|
+
this._updateShadowPositionAndTarget(this.getPosition(), new s(0, 0, 0));
|
|
1282
1282
|
}
|
|
1283
1283
|
updateBounds(e) {
|
|
1284
|
-
if (this._shadowLightSource instanceof
|
|
1284
|
+
if (this._shadowLightSource instanceof w) {
|
|
1285
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);
|
|
1286
1286
|
t.aspect = 1, t.near = r, t.far = i, this._shadowLightSource.angle = s;
|
|
1287
1287
|
} else if (this._shadowLightSource.shadow) {
|
|
@@ -1296,7 +1296,7 @@ var U = class e extends b {
|
|
|
1296
1296
|
this._shadowLightSource.shadow && (this._shadowLightSource.shadow.needsUpdate = !0);
|
|
1297
1297
|
}
|
|
1298
1298
|
_updateShadowPositionAndTarget(e, t) {
|
|
1299
|
-
if (this._shadowLightSource instanceof
|
|
1299
|
+
if (this._shadowLightSource instanceof w) {
|
|
1300
1300
|
let n = t.clone().sub(e), r = n.length();
|
|
1301
1301
|
n.normalize();
|
|
1302
1302
|
let i = t.clone().sub(n.clone().multiplyScalar(r * 4));
|
|
@@ -1318,10 +1318,10 @@ var U = class e extends b {
|
|
|
1318
1318
|
switch (t?.shadowLightSourceType) {
|
|
1319
1319
|
default:
|
|
1320
1320
|
case gt.DIRECTION_LIGHT_SHADOW:
|
|
1321
|
-
n = new
|
|
1321
|
+
n = new y(16777215, 1);
|
|
1322
1322
|
break;
|
|
1323
1323
|
case gt.SPOT_LIGHT_SHADOW:
|
|
1324
|
-
n = new
|
|
1324
|
+
n = new w(16777215, 1, 0, Math.PI / 4, 0);
|
|
1325
1325
|
break;
|
|
1326
1326
|
}
|
|
1327
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));
|
|
@@ -1347,7 +1347,7 @@ var U = class e extends b {
|
|
|
1347
1347
|
}
|
|
1348
1348
|
}, Ct = class extends xt {
|
|
1349
1349
|
constructor(e, t, n) {
|
|
1350
|
-
let r = new
|
|
1350
|
+
let r = new y(16777215, t);
|
|
1351
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;
|
|
1352
1352
|
}
|
|
1353
1353
|
getPosition() {
|
|
@@ -1365,7 +1365,7 @@ var U = class e extends b {
|
|
|
1365
1365
|
}
|
|
1366
1366
|
}, wt = class extends xt {
|
|
1367
1367
|
constructor(e, t) {
|
|
1368
|
-
let n = new
|
|
1368
|
+
let n = new y(16777215, 1);
|
|
1369
1369
|
n.position.copy(e), n.lookAt(0, 0, 0), n.updateMatrix(), n.castShadow = !0, super(n, t), this._position = e.clone();
|
|
1370
1370
|
}
|
|
1371
1371
|
getPosition() {
|
|
@@ -1393,35 +1393,35 @@ var U = class e extends b {
|
|
|
1393
1393
|
name: "FXAAShader",
|
|
1394
1394
|
uniforms: {
|
|
1395
1395
|
tDiffuse: { value: null },
|
|
1396
|
-
resolution: { value: new
|
|
1396
|
+
resolution: { value: new _(1 / 1024, 1 / 512) }
|
|
1397
1397
|
},
|
|
1398
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 }",
|
|
1399
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 }"
|
|
1400
|
-
}, Dt = class e extends
|
|
1400
|
+
}, Dt = class e extends G {
|
|
1401
1401
|
static {
|
|
1402
|
-
this.BlurDirectionX = new
|
|
1402
|
+
this.BlurDirectionX = new _(1, 0);
|
|
1403
1403
|
}
|
|
1404
1404
|
static {
|
|
1405
|
-
this.BlurDirectionY = new
|
|
1405
|
+
this.BlurDirectionY = new _(0, 1);
|
|
1406
1406
|
}
|
|
1407
1407
|
static {
|
|
1408
1408
|
this.highlightLines = !0;
|
|
1409
1409
|
}
|
|
1410
|
-
constructor(e,
|
|
1411
|
-
super(e), this.patternTexture = null, this.clearBackground = !1, this.renderScene =
|
|
1410
|
+
constructor(e, n, r, i, a, o) {
|
|
1411
|
+
super(e), this.patternTexture = null, this.clearBackground = !1, this.renderScene = r, 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 = n === void 0 ? new _(256, 256) : new _(n.x, n.y);
|
|
1412
1412
|
let s = Math.round(this.resolution.x / this.downSampleRatio), c = Math.round(this.resolution.y / this.downSampleRatio);
|
|
1413
|
-
this.renderTargetMaskBuffer = new
|
|
1414
|
-
let
|
|
1415
|
-
this.copyUniforms =
|
|
1413
|
+
this.renderTargetMaskBuffer = new t(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 = d(this.prepareMaskMaterial.fragmentShader, this.renderCamera), this.edgeDetectionFxaa && (this.fxaaRenderMaterial = new l(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 t(this.resolution.x, this.resolution.y), this.renderTargetFxaaBuffer.texture.name = "OutlinePass.fxaa", this.renderTargetFxaaBuffer.texture.generateMipmaps = !1), this.renderTargetMaskDownSampleBuffer = new t(s, c), this.renderTargetMaskDownSampleBuffer.texture.name = "OutlinePass.depthDownSample", this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = !1, this.renderTargetBlurBuffer1 = new t(s, c), this.renderTargetBlurBuffer1.texture.name = "OutlinePass.blur1", this.renderTargetBlurBuffer1.texture.generateMipmaps = !1, this.renderTargetBlurBuffer2 = new t(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 t(s, c), this.renderTargetEdgeBuffer1.texture.name = "OutlinePass.edge1", this.renderTargetEdgeBuffer1.texture.generateMipmaps = !1, this.renderTargetEdgeBuffer2 = new t(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 u = Tt;
|
|
1415
|
+
this.copyUniforms = C.clone(u.uniforms), this.copyUniforms.opacity.value = 1, this.materialCopy = new l({
|
|
1416
1416
|
uniforms: this.copyUniforms,
|
|
1417
|
-
vertexShader:
|
|
1418
|
-
fragmentShader:
|
|
1417
|
+
vertexShader: u.vertexShader,
|
|
1418
|
+
fragmentShader: u.fragmentShader,
|
|
1419
1419
|
blending: 0,
|
|
1420
1420
|
depthTest: !1,
|
|
1421
1421
|
depthWrite: !1,
|
|
1422
1422
|
transparent: !0
|
|
1423
|
-
}), this.enabled = !0, this.needsSwap = !1, this.oldClearColor = new D(), this.oldClearAlpha = 1, this.fsQuad = new
|
|
1424
|
-
function
|
|
1423
|
+
}), this.enabled = !0, this.needsSwap = !1, this.oldClearColor = new D(), this.oldClearAlpha = 1, this.fsQuad = new V(void 0), this.tempPulseColor1 = new D(), this.tempPulseColor2 = new D(), this.textureMatrix = new x();
|
|
1424
|
+
function d(e, t) {
|
|
1425
1425
|
let n = t.isPerspectiveCamera ? "perspective" : "orthographic";
|
|
1426
1426
|
return e.replace(/DEPTH_TO_VIEW_Z/g, n + "DepthToViewZ");
|
|
1427
1427
|
}
|
|
@@ -1479,10 +1479,10 @@ var U = class e extends b {
|
|
|
1479
1479
|
this.render(e, null, null, 0, !1);
|
|
1480
1480
|
}
|
|
1481
1481
|
_getPrepareMaskMaterial(e) {
|
|
1482
|
-
return new
|
|
1482
|
+
return new l({
|
|
1483
1483
|
uniforms: {
|
|
1484
1484
|
depthTexture: { value: null },
|
|
1485
|
-
cameraNearFar: { value: new
|
|
1485
|
+
cameraNearFar: { value: new _(.5, .5) },
|
|
1486
1486
|
textureMatrix: { value: null }
|
|
1487
1487
|
},
|
|
1488
1488
|
defines: { FLOAT_ALPHA_DEPTH: e ? 1 : 0 },
|
|
@@ -1491,24 +1491,24 @@ var U = class e extends b {
|
|
|
1491
1491
|
});
|
|
1492
1492
|
}
|
|
1493
1493
|
_getEdgeDetectionMaterial() {
|
|
1494
|
-
return new
|
|
1494
|
+
return new l({
|
|
1495
1495
|
uniforms: {
|
|
1496
1496
|
maskTexture: { value: null },
|
|
1497
|
-
texSize: { value: new
|
|
1498
|
-
visibleEdgeColor: { value: new
|
|
1499
|
-
hiddenEdgeColor: { value: new
|
|
1497
|
+
texSize: { value: new _(.5, .5) },
|
|
1498
|
+
visibleEdgeColor: { value: new s(1, 1, 1) },
|
|
1499
|
+
hiddenEdgeColor: { value: new s(1, 1, 1) }
|
|
1500
1500
|
},
|
|
1501
1501
|
vertexShader: "varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
1502
1502
|
fragmentShader: "varying vec2 vUv;\n\n uniform sampler2D maskTexture;\n uniform vec2 texSize;\n uniform vec3 visibleEdgeColor;\n uniform vec3 hiddenEdgeColor;\n\n void main() {\n vec2 invSize = 1.0 / texSize;\n vec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n vec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n vec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n vec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n vec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n float diff1 = (c1.r - c2.r)*0.5;\n float diff2 = (c3.r - c4.r)*0.5;\n float d = length( vec2(diff1, diff2) );\n float a1 = min(c1.g, c2.g);\n float a2 = min(c3.g, c4.g);\n float visibilityFactor = min(a1, a2);\n vec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n gl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n }"
|
|
1503
1503
|
});
|
|
1504
1504
|
}
|
|
1505
1505
|
_getSeperableBlurMaterial(e) {
|
|
1506
|
-
return new
|
|
1506
|
+
return new l({
|
|
1507
1507
|
defines: { MAX_RADIUS: e },
|
|
1508
1508
|
uniforms: {
|
|
1509
1509
|
colorTexture: { value: null },
|
|
1510
|
-
texSize: { value: new
|
|
1511
|
-
direction: { value: new
|
|
1510
|
+
texSize: { value: new _(.5, .5) },
|
|
1511
|
+
direction: { value: new _(.5, .5) },
|
|
1512
1512
|
kernelRadius: { value: 1 }
|
|
1513
1513
|
},
|
|
1514
1514
|
vertexShader: "varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
@@ -1516,7 +1516,7 @@ var U = class e extends b {
|
|
|
1516
1516
|
});
|
|
1517
1517
|
}
|
|
1518
1518
|
_getOverlayMaterial() {
|
|
1519
|
-
return new
|
|
1519
|
+
return new l({
|
|
1520
1520
|
uniforms: {
|
|
1521
1521
|
maskTexture: { value: null },
|
|
1522
1522
|
edgeTexture1: { value: null },
|
|
@@ -1538,10 +1538,10 @@ var U = class e extends b {
|
|
|
1538
1538
|
uniforms: { tDiffuse: { value: null } },
|
|
1539
1539
|
vertexShader: "\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",
|
|
1540
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 }"
|
|
1541
|
-
}, kt = class extends
|
|
1541
|
+
}, kt = class extends l {
|
|
1542
1542
|
constructor(e) {
|
|
1543
1543
|
super({
|
|
1544
|
-
uniforms:
|
|
1544
|
+
uniforms: C.clone(Ot.uniforms),
|
|
1545
1545
|
vertexShader: Ot.vertexShader,
|
|
1546
1546
|
fragmentShader: Ot.fragmentShader,
|
|
1547
1547
|
transparent: !0,
|
|
@@ -1553,18 +1553,18 @@ var U = class e extends b {
|
|
|
1553
1553
|
blendSrcAlpha: 206,
|
|
1554
1554
|
blendDstAlpha: 200,
|
|
1555
1555
|
blendEquationAlpha: 100
|
|
1556
|
-
}), this._intensity = new
|
|
1556
|
+
}), this._intensity = new _(1, 1), this.update(e);
|
|
1557
1557
|
}
|
|
1558
1558
|
update(e) {
|
|
1559
1559
|
return e?.texture !== void 0 && (this.uniforms.tDiffuse.value = e.texture), e?.blending !== void 0 && (this.blending = e.blending), this;
|
|
1560
1560
|
}
|
|
1561
|
-
}, At = (e) => new
|
|
1561
|
+
}, At = (e) => new _(Math.atan2(e.y, e.x) / (2 * Math.PI) + .5, Math.asin(e.z) / Math.PI + .5), jt = class {
|
|
1562
1562
|
get colorRenderTarget() {
|
|
1563
|
-
return this._colorRenderTarget = this._colorRenderTarget ?? new
|
|
1563
|
+
return this._colorRenderTarget = this._colorRenderTarget ?? new t(), this._colorRenderTarget;
|
|
1564
1564
|
}
|
|
1565
1565
|
environmentMapDecodeTarget(e) {
|
|
1566
|
-
let
|
|
1567
|
-
return this._environmentMapDecodeTarget = this._environmentMapDecodeTarget ?? new
|
|
1566
|
+
let n = e instanceof be && e.capabilities.isWebGL2 ? S : b;
|
|
1567
|
+
return this._environmentMapDecodeTarget = this._environmentMapDecodeTarget ?? new t(1, 1, { type: n }), this._environmentMapDecodeTarget;
|
|
1568
1568
|
}
|
|
1569
1569
|
environmentMapDecodeMaterial(e) {
|
|
1570
1570
|
return e ? (this._equirectangularDecodeMaterial = this._equirectangularDecodeMaterial ?? new Q(!0, !1), this._equirectangularDecodeMaterial) : (this._pmremDecodeMaterial = this._pmremDecodeMaterial ?? new Q(!1, !1), this._pmremDecodeMaterial);
|
|
@@ -1572,37 +1572,37 @@ var U = class e extends b {
|
|
|
1572
1572
|
get camera() {
|
|
1573
1573
|
return this._camera = this._camera ?? new a(-1, 1, 1, -1, -1, 1), this._camera;
|
|
1574
1574
|
}
|
|
1575
|
-
scaleTexture(e, n, r
|
|
1576
|
-
this.colorRenderTarget.setSize(
|
|
1577
|
-
let
|
|
1578
|
-
e.setRenderTarget(this.colorRenderTarget), e.render(this._planeMesh, this.camera), e.setRenderTarget(
|
|
1579
|
-
let
|
|
1580
|
-
return e.readRenderTargetPixels(this.colorRenderTarget, 0, 0,
|
|
1581
|
-
texture:
|
|
1582
|
-
pixels:
|
|
1575
|
+
scaleTexture(e, t, n, r) {
|
|
1576
|
+
this.colorRenderTarget.setSize(n, r), this._planeMesh = this._planeMesh ?? new T(new ue(2, 2), new E({ map: t }));
|
|
1577
|
+
let i = e.getRenderTarget();
|
|
1578
|
+
e.setRenderTarget(this.colorRenderTarget), e.render(this._planeMesh, this.camera), e.setRenderTarget(i);
|
|
1579
|
+
let a = this.environmentMapDecodeTarget(e).texture, o = new Uint8Array(n * r * 4);
|
|
1580
|
+
return e.readRenderTargetPixels(this.colorRenderTarget, 0, 0, n, r, o), {
|
|
1581
|
+
texture: a,
|
|
1582
|
+
pixels: o,
|
|
1583
1583
|
sRgbaPixels: !1
|
|
1584
1584
|
};
|
|
1585
1585
|
}
|
|
1586
|
-
newGrayscaleTexture(e, n, r
|
|
1587
|
-
let
|
|
1588
|
-
|
|
1589
|
-
let
|
|
1590
|
-
e.setRenderTarget(
|
|
1591
|
-
let
|
|
1592
|
-
return e.readRenderTargetPixels(
|
|
1593
|
-
texture:
|
|
1594
|
-
pixels:
|
|
1595
|
-
sRgbaPixels:
|
|
1586
|
+
newGrayscaleTexture(e, t, n, r) {
|
|
1587
|
+
let i = this.environmentMapDecodeMaterial(t.name === "PMREM.cubeUv"), a = this.environmentMapDecodeTarget(e);
|
|
1588
|
+
a.setSize(n, r), i.setSourceTexture(t), this._planeMesh = this._planeMesh ?? new T(new ue(2, 2), i);
|
|
1589
|
+
let o = e.getRenderTarget();
|
|
1590
|
+
e.setRenderTarget(a), e.render(this._planeMesh, this.camera), e.setRenderTarget(o);
|
|
1591
|
+
let s = a.texture, c = a.texture.type === S, l = c ? new Float32Array(n * r * 4) : new Uint8Array(n * r * 4);
|
|
1592
|
+
return e.readRenderTargetPixels(a, 0, 0, n, r, l), {
|
|
1593
|
+
texture: s,
|
|
1594
|
+
pixels: l,
|
|
1595
|
+
sRgbaPixels: c
|
|
1596
1596
|
};
|
|
1597
1597
|
}
|
|
1598
1598
|
}, Z = {
|
|
1599
1599
|
uniforms: { tDiffuse: { value: null } },
|
|
1600
1600
|
vertexShader: "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",
|
|
1601
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 }"
|
|
1602
|
-
}, Q = class extends
|
|
1602
|
+
}, Q = class extends l {
|
|
1603
1603
|
constructor(e, t) {
|
|
1604
1604
|
super({
|
|
1605
|
-
uniforms:
|
|
1605
|
+
uniforms: C.clone(Z.uniforms),
|
|
1606
1606
|
vertexShader: Z.vertexShader,
|
|
1607
1607
|
fragmentShader: Z.fragmentShader,
|
|
1608
1608
|
defines: {
|
|
@@ -1617,14 +1617,14 @@ var U = class e extends b {
|
|
|
1617
1617
|
}, Mt = class {
|
|
1618
1618
|
constructor(e) {
|
|
1619
1619
|
this.samplePoints = [], this.sampleUVs = [], this.grayscaleTexture = {
|
|
1620
|
-
texture: new
|
|
1620
|
+
texture: new re(),
|
|
1621
1621
|
pixels: new Uint8Array(),
|
|
1622
1622
|
sRgbaPixels: !1
|
|
1623
|
-
}, this.detectorTexture = new
|
|
1623
|
+
}, this.detectorTexture = new re(), this.detectorArray = new Float32Array(), this.lightSamples = [], this.lightGraph = new Pt(0), this.lightSources = [], this._grayScale = new s(.2126, .7152, .0722), this._createEquirectangularSamplePoints = (e) => {
|
|
1624
1624
|
let t = [];
|
|
1625
|
-
for (let
|
|
1626
|
-
let
|
|
1627
|
-
t.push(new
|
|
1625
|
+
for (let n = 0; n < e; n++) {
|
|
1626
|
+
let r = n * Math.PI * (3 - Math.sqrt(5)), i = 1 - n / (e - 1) * 2, a = Math.sqrt(1 - i * i), o = Math.cos(r) * a, c = Math.sin(r) * a;
|
|
1627
|
+
t.push(new s(o, c, i));
|
|
1628
1628
|
}
|
|
1629
1629
|
return t;
|
|
1630
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));
|
|
@@ -1632,17 +1632,17 @@ var U = class e extends b {
|
|
|
1632
1632
|
detectLightSources(e, t) {
|
|
1633
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);
|
|
1634
1634
|
}
|
|
1635
|
-
_redFromRgbaToNormalizedFloatArray(e, t,
|
|
1636
|
-
let
|
|
1635
|
+
_redFromRgbaToNormalizedFloatArray(e, t, n) {
|
|
1636
|
+
let r = new Float32Array(e.length / 4), i = 1, a = 0;
|
|
1637
1637
|
for (let t = 0; t < e.length / 4; ++t) {
|
|
1638
|
-
let
|
|
1639
|
-
e instanceof Float32Array &&
|
|
1640
|
-
let
|
|
1641
|
-
|
|
1638
|
+
let n = new D(...e.slice(t * 4, t * 4 + 3));
|
|
1639
|
+
e instanceof Float32Array && n.convertSRGBToLinear();
|
|
1640
|
+
let o = new s(n.r, n.g, n.b).dot(this._grayScale);
|
|
1641
|
+
i = Math.min(i, o), a = Math.max(a, o), r[t] = o;
|
|
1642
1642
|
}
|
|
1643
|
-
if (
|
|
1644
|
-
else if (!t) for (let e = 0; e <
|
|
1645
|
-
return
|
|
1643
|
+
if (n) for (let e = 0; e < r.length; ++e) r[e] = (t ? r[e] : (r[e] - i) / (a - i)) ** +n;
|
|
1644
|
+
else if (!t) for (let e = 0; e < r.length; ++e) r[e] = (r[e] - i) / (a - i);
|
|
1645
|
+
return r;
|
|
1646
1646
|
}
|
|
1647
1647
|
_grayscaleTextureFromFloatArray(e, t, n) {
|
|
1648
1648
|
let r = t * n, i = new Uint8Array(4 * r);
|
|
@@ -1650,7 +1650,7 @@ var U = class e extends b {
|
|
|
1650
1650
|
let n = e[t] * 255;
|
|
1651
1651
|
i[t * 4 + 0] = n, i[t * 4 + 1] = n, i[t * 4 + 2] = n, i[t * 4 + 3] = 255;
|
|
1652
1652
|
}
|
|
1653
|
-
let a = new
|
|
1653
|
+
let a = new v(i, t, n);
|
|
1654
1654
|
return a.needsUpdate = !0, a;
|
|
1655
1655
|
}
|
|
1656
1656
|
_filterLightSamples(e) {
|
|
@@ -1713,10 +1713,10 @@ var U = class e extends b {
|
|
|
1713
1713
|
}
|
|
1714
1714
|
}, Ft = class {
|
|
1715
1715
|
constructor(e) {
|
|
1716
|
-
this.position = new
|
|
1716
|
+
this.position = new s(), this.uv = new _(), this.averageIntensity = 0, this.maxIntensity = 0, this.size = 0, this.lightSamples = e;
|
|
1717
1717
|
}
|
|
1718
1718
|
calculateLightSourceProperties(e) {
|
|
1719
|
-
this.position = new
|
|
1719
|
+
this.position = new s(), this.averageIntensity = 0, this.maxIntensity = 0;
|
|
1720
1720
|
for (let t of this.lightSamples) {
|
|
1721
1721
|
this.position.add(t.position);
|
|
1722
1722
|
let n = e(t.uv);
|
|
@@ -1727,7 +1727,7 @@ var U = class e extends b {
|
|
|
1727
1727
|
for (let e of this.lightSamples) t += e.position.distanceTo(this.position);
|
|
1728
1728
|
t /= this.lightSamples.length, this.size = t / Math.PI;
|
|
1729
1729
|
}
|
|
1730
|
-
}, It = class extends
|
|
1730
|
+
}, It = class extends G {
|
|
1731
1731
|
constructor(e) {
|
|
1732
1732
|
super(e), this.debugOutput = "", this._environmentMapDecodeMaterial = new Q(!0, !1), this._environmentMapDecodeMaterial.blending = 0, this._environmentMapDecodeMaterial.depthTest = !1;
|
|
1733
1733
|
}
|
|
@@ -1735,7 +1735,7 @@ var U = class e extends b {
|
|
|
1735
1735
|
this._depthRenderMaterial?.dispose(), this._copyMaterial?.dispose(), this._srgbToLinearCopyMaterial?.dispose();
|
|
1736
1736
|
}
|
|
1737
1737
|
getCopyMaterial(e) {
|
|
1738
|
-
return this._copyMaterial = this._copyMaterial ?? new
|
|
1738
|
+
return this._copyMaterial = this._copyMaterial ?? new N(), this._copyMaterial.update(e);
|
|
1739
1739
|
}
|
|
1740
1740
|
getBlendAoAndShadowMaterial(e) {
|
|
1741
1741
|
return this._blendAoAndShadowMaterial = this._blendAoAndShadowMaterial ?? new qe({ blending: 0 }), this._blendAoAndShadowMaterial.update(e);
|
|
@@ -1744,12 +1744,12 @@ var U = class e extends b {
|
|
|
1744
1744
|
return this._blendAoPassDepthMaterial = this._blendAoPassDepthMaterial ?? new kt({ blending: 0 }), this._blendAoPassDepthMaterial.update(e);
|
|
1745
1745
|
}
|
|
1746
1746
|
getSrgbToLinearCopyMaterial(e) {
|
|
1747
|
-
return this._srgbToLinearCopyMaterial = this._copyMaterial ?? new
|
|
1747
|
+
return this._srgbToLinearCopyMaterial = this._copyMaterial ?? new N({}, z.ADDITIVE, !0, !0), this._srgbToLinearCopyMaterial.update(e);
|
|
1748
1748
|
}
|
|
1749
1749
|
_getDepthRenderMaterial(e) {
|
|
1750
|
-
return this._depthRenderMaterial = this._depthRenderMaterial ?? new
|
|
1750
|
+
return this._depthRenderMaterial = this._depthRenderMaterial ?? new Ce({
|
|
1751
1751
|
depthTexture: this.gBufferTextures.textureWithDepthValue,
|
|
1752
|
-
depthFilter: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? new
|
|
1752
|
+
depthFilter: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? new i(0, 0, 0, 1) : new i(1, 0, 0, 0)
|
|
1753
1753
|
}), this._depthRenderMaterial.update({ camera: e });
|
|
1754
1754
|
}
|
|
1755
1755
|
renderPass(e) {
|
|
@@ -1762,64 +1762,64 @@ var U = class e extends b {
|
|
|
1762
1762
|
this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1763
1763
|
texture: this.gBufferTextures?.gBufferTexture,
|
|
1764
1764
|
blending: 0,
|
|
1765
|
-
colorTransform: new
|
|
1766
|
-
colorBase: new
|
|
1765
|
+
colorTransform: new x().set(.5, 0, 0, 0, 0, .5, 0, 0, 0, 0, .5, 0, 0, 0, 0, 0),
|
|
1766
|
+
colorBase: new i(.5, .5, .5, 1),
|
|
1767
1767
|
multiplyChannels: 0,
|
|
1768
|
-
uvTransform:
|
|
1768
|
+
uvTransform: M
|
|
1769
1769
|
}), null) : this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1770
1770
|
texture: this.gBufferTextures?.gBufferTexture,
|
|
1771
1771
|
blending: 0,
|
|
1772
|
-
colorTransform:
|
|
1773
|
-
colorBase:
|
|
1772
|
+
colorTransform: xe,
|
|
1773
|
+
colorBase: P,
|
|
1774
1774
|
multiplyChannels: 0,
|
|
1775
|
-
uvTransform:
|
|
1775
|
+
uvTransform: M
|
|
1776
1776
|
}), null);
|
|
1777
1777
|
break;
|
|
1778
1778
|
case "g-depth":
|
|
1779
1779
|
this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1780
1780
|
texture: this.gBufferTextures?.gBufferTexture,
|
|
1781
1781
|
blending: 0,
|
|
1782
|
-
colorTransform:
|
|
1783
|
-
colorBase:
|
|
1782
|
+
colorTransform: we,
|
|
1783
|
+
colorBase: P,
|
|
1784
1784
|
multiplyChannels: 0,
|
|
1785
|
-
uvTransform:
|
|
1785
|
+
uvTransform: M
|
|
1786
1786
|
}), null) : this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1787
1787
|
texture: this.gBufferTextures?.depthBufferTexture,
|
|
1788
1788
|
blending: 0,
|
|
1789
|
-
colorTransform:
|
|
1790
|
-
colorBase:
|
|
1789
|
+
colorTransform: Se,
|
|
1790
|
+
colorBase: P,
|
|
1791
1791
|
multiplyChannels: 0,
|
|
1792
|
-
uvTransform:
|
|
1792
|
+
uvTransform: M
|
|
1793
1793
|
}), null);
|
|
1794
1794
|
break;
|
|
1795
1795
|
case "ssao":
|
|
1796
1796
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1797
1797
|
texture: this.renderPassManager.shadowAndAoPass.aoAndSoftShadowRenderTarget.texture,
|
|
1798
1798
|
blending: 0,
|
|
1799
|
-
colorTransform:
|
|
1800
|
-
colorBase:
|
|
1799
|
+
colorTransform: L,
|
|
1800
|
+
colorBase: j,
|
|
1801
1801
|
multiplyChannels: 0,
|
|
1802
|
-
uvTransform:
|
|
1802
|
+
uvTransform: M
|
|
1803
1803
|
}), null);
|
|
1804
1804
|
break;
|
|
1805
1805
|
case "ssaodenoise":
|
|
1806
1806
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1807
1807
|
texture: this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,
|
|
1808
1808
|
blending: 0,
|
|
1809
|
-
colorTransform:
|
|
1810
|
-
colorBase:
|
|
1809
|
+
colorTransform: L,
|
|
1810
|
+
colorBase: j,
|
|
1811
1811
|
multiplyChannels: 0,
|
|
1812
|
-
uvTransform:
|
|
1812
|
+
uvTransform: M
|
|
1813
1813
|
}), null);
|
|
1814
1814
|
break;
|
|
1815
1815
|
case "shadowmap":
|
|
1816
1816
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1817
1817
|
texture: this.renderPassManager.screenSpaceShadowMapPass.shadowTexture,
|
|
1818
1818
|
blending: 0,
|
|
1819
|
-
colorTransform:
|
|
1820
|
-
colorBase:
|
|
1819
|
+
colorTransform: L,
|
|
1820
|
+
colorBase: j,
|
|
1821
1821
|
multiplyChannels: 0,
|
|
1822
|
-
uvTransform:
|
|
1822
|
+
uvTransform: M
|
|
1823
1823
|
}), null);
|
|
1824
1824
|
break;
|
|
1825
1825
|
case "shadowsoft":
|
|
@@ -1827,9 +1827,9 @@ var U = class e extends b {
|
|
|
1827
1827
|
texture: this.renderPassManager.shadowAndAoPass.aoAndSoftShadowRenderTarget.texture,
|
|
1828
1828
|
blending: 0,
|
|
1829
1829
|
colorTransform: Y.shadowTransform,
|
|
1830
|
-
colorBase:
|
|
1830
|
+
colorBase: j,
|
|
1831
1831
|
multiplyChannels: 0,
|
|
1832
|
-
uvTransform:
|
|
1832
|
+
uvTransform: M
|
|
1833
1833
|
}), null);
|
|
1834
1834
|
break;
|
|
1835
1835
|
case "shadowdenoise":
|
|
@@ -1837,9 +1837,9 @@ var U = class e extends b {
|
|
|
1837
1837
|
texture: this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,
|
|
1838
1838
|
blending: 0,
|
|
1839
1839
|
colorTransform: Y.shadowTransform,
|
|
1840
|
-
colorBase:
|
|
1840
|
+
colorBase: j,
|
|
1841
1841
|
multiplyChannels: 0,
|
|
1842
|
-
uvTransform:
|
|
1842
|
+
uvTransform: M
|
|
1843
1843
|
}), null);
|
|
1844
1844
|
break;
|
|
1845
1845
|
case "shadowfadein":
|
|
@@ -1847,9 +1847,9 @@ var U = class e extends b {
|
|
|
1847
1847
|
texture: this.renderPassManager.shadowAndAoPass.fadeRenderTarget.texture,
|
|
1848
1848
|
blending: 0,
|
|
1849
1849
|
colorTransform: Y.shadowTransform,
|
|
1850
|
-
colorBase:
|
|
1850
|
+
colorBase: j,
|
|
1851
1851
|
multiplyChannels: 0,
|
|
1852
|
-
uvTransform:
|
|
1852
|
+
uvTransform: M
|
|
1853
1853
|
}), null);
|
|
1854
1854
|
break;
|
|
1855
1855
|
case "shadowandao":
|
|
@@ -1870,40 +1870,40 @@ var U = class e extends b {
|
|
|
1870
1870
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1871
1871
|
texture: this.renderPassManager.aoPassMapTexture,
|
|
1872
1872
|
blending: 0,
|
|
1873
|
-
colorTransform:
|
|
1874
|
-
colorBase:
|
|
1873
|
+
colorTransform: R,
|
|
1874
|
+
colorBase: j,
|
|
1875
1875
|
multiplyChannels: 0,
|
|
1876
|
-
uvTransform:
|
|
1876
|
+
uvTransform: M
|
|
1877
1877
|
}), null);
|
|
1878
1878
|
break;
|
|
1879
1879
|
case "groundreflection":
|
|
1880
1880
|
this.passRenderer.renderScreenSpace(e, this.getSrgbToLinearCopyMaterial({
|
|
1881
1881
|
texture: this.renderPassManager.groundReflectionPass.reflectionRenderTarget.texture,
|
|
1882
1882
|
blending: 0,
|
|
1883
|
-
colorTransform:
|
|
1884
|
-
colorBase:
|
|
1883
|
+
colorTransform: R,
|
|
1884
|
+
colorBase: j,
|
|
1885
1885
|
multiplyChannels: 0,
|
|
1886
|
-
uvTransform:
|
|
1886
|
+
uvTransform: A
|
|
1887
1887
|
}), null);
|
|
1888
1888
|
break;
|
|
1889
1889
|
case "groundreflectionfinal":
|
|
1890
1890
|
this.passRenderer.renderScreenSpace(e, this.getSrgbToLinearCopyMaterial({
|
|
1891
1891
|
texture: this.renderPassManager.groundReflectionPass.intensityRenderTarget.texture,
|
|
1892
1892
|
blending: 0,
|
|
1893
|
-
colorTransform:
|
|
1894
|
-
colorBase:
|
|
1893
|
+
colorTransform: R,
|
|
1894
|
+
colorBase: j,
|
|
1895
1895
|
multiplyChannels: 0,
|
|
1896
|
-
uvTransform:
|
|
1896
|
+
uvTransform: A
|
|
1897
1897
|
}), null);
|
|
1898
1898
|
break;
|
|
1899
1899
|
case "bakedgroundshadow":
|
|
1900
1900
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1901
1901
|
texture: this.renderPassManager.bakedGroundContactShadowPass.renderTarget.texture,
|
|
1902
1902
|
blending: 0,
|
|
1903
|
-
colorTransform:
|
|
1904
|
-
colorBase:
|
|
1903
|
+
colorTransform: R,
|
|
1904
|
+
colorBase: j,
|
|
1905
1905
|
multiplyChannels: 0,
|
|
1906
|
-
uvTransform:
|
|
1906
|
+
uvTransform: M
|
|
1907
1907
|
}), null);
|
|
1908
1908
|
break;
|
|
1909
1909
|
case "environmentmap":
|
|
@@ -1917,9 +1917,9 @@ var U = class e extends b {
|
|
|
1917
1917
|
break;
|
|
1918
1918
|
}
|
|
1919
1919
|
}
|
|
1920
|
-
}, Lt = class extends
|
|
1920
|
+
}, Lt = class extends G {
|
|
1921
1921
|
constructor(e) {
|
|
1922
|
-
super(e), this.drawGround = !0, this.drawWithDebugMaterial = !1, this.grayDebugMaterial = new
|
|
1922
|
+
super(e), this.drawGround = !0, this.drawWithDebugMaterial = !1, this.grayDebugMaterial = new _e({
|
|
1923
1923
|
color: 12632256,
|
|
1924
1924
|
side: 2,
|
|
1925
1925
|
envMapIntensity: .4
|
|
@@ -1959,7 +1959,7 @@ var U = class e extends b {
|
|
|
1959
1959
|
this._reflectionPassMapIntensityUniform.value = e;
|
|
1960
1960
|
}
|
|
1961
1961
|
static addPlugin(t) {
|
|
1962
|
-
if (
|
|
1962
|
+
if (H(t)) return null;
|
|
1963
1963
|
if (t.userData.postProcessingMaterialPlugin !== void 0) return t.userData.postProcessingMaterialPlugin instanceof e ? t.userData.postProcessingMaterialPlugin : null;
|
|
1964
1964
|
let n = new e();
|
|
1965
1965
|
return t.userData.postProcessingMaterialPlugin = n, t.onBeforeCompile = (e, t) => n._onBeforeCompile(e, t), t.customProgramCacheKey = () => n._customProgramCacheKey(), n;
|
|
@@ -1980,15 +1980,15 @@ var U = class e extends b {
|
|
|
1980
1980
|
_initUniforms(e) {
|
|
1981
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);
|
|
1982
1982
|
}
|
|
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
|
|
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 B {
|
|
1984
1984
|
constructor(e, t = "tDiffuse") {
|
|
1985
|
-
super(), this.textureID = t, this.uniforms = null, this.material = null, e instanceof
|
|
1985
|
+
super(), this.textureID = t, this.uniforms = null, this.material = null, e instanceof l ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms = C.clone(e.uniforms), this.material = new l({
|
|
1986
1986
|
name: e.name === void 0 ? "unspecified" : e.name,
|
|
1987
1987
|
defines: Object.assign({}, e.defines),
|
|
1988
1988
|
uniforms: this.uniforms,
|
|
1989
1989
|
vertexShader: e.vertexShader,
|
|
1990
1990
|
fragmentShader: e.fragmentShader
|
|
1991
|
-
})), this._fsQuad = new
|
|
1991
|
+
})), this._fsQuad = new V(this.material);
|
|
1992
1992
|
}
|
|
1993
1993
|
render(e, t, n) {
|
|
1994
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));
|
|
@@ -2023,15 +2023,15 @@ var U = class e extends b {
|
|
|
2023
2023
|
get intensity() {
|
|
2024
2024
|
return this.material.uniforms.intensity.value;
|
|
2025
2025
|
}
|
|
2026
|
-
}, Wt = class extends
|
|
2026
|
+
}, Wt = class extends ge {
|
|
2027
2027
|
constructor(e) {
|
|
2028
|
-
super(e), this.type =
|
|
2028
|
+
super(e), this.type = b;
|
|
2029
2029
|
}
|
|
2030
2030
|
setType(e) {
|
|
2031
2031
|
return this.type = e, this;
|
|
2032
2032
|
}
|
|
2033
2033
|
load(e, t, n, r) {
|
|
2034
|
-
let i = new
|
|
2034
|
+
let i = new ne(this.manager);
|
|
2035
2035
|
i.setPath(this.path), i.setResponseType("text"), i.load(e, (n) => {
|
|
2036
2036
|
try {
|
|
2037
2037
|
t(this.parse(n));
|
|
@@ -2041,27 +2041,27 @@ var U = class e extends b {
|
|
|
2041
2041
|
}, n, r);
|
|
2042
2042
|
}
|
|
2043
2043
|
parse(e) {
|
|
2044
|
-
let t = /TITLE +"([^"]*)"/,
|
|
2045
|
-
if (
|
|
2046
|
-
let l = Number(
|
|
2047
|
-
if (
|
|
2048
|
-
let h = this.type === 1009 ? 255 : 1,
|
|
2049
|
-
for (; (
|
|
2050
|
-
let
|
|
2051
|
-
return
|
|
2044
|
+
let t = /TITLE +"([^"]*)"/, n = /LUT_3D_SIZE +(\d+)/, r = /DOMAIN_MIN +([\d.]+) +([\d.]+) +([\d.]+)/, i = /DOMAIN_MAX +([\d.]+) +([\d.]+) +([\d.]+)/, a = /^([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+) *$/gm, o = t.exec(e), c = o === null ? null : o[1];
|
|
2045
|
+
if (o = n.exec(e), o === null) throw Error("THREE.LUTCubeLoader: Missing LUT_3D_SIZE information");
|
|
2046
|
+
let l = Number(o[1]), u = l ** 3 * 4, d = this.type === 1009 ? new Uint8Array(u) : new Float32Array(u), p = new s(0, 0, 0), m = new s(1, 1, 1);
|
|
2047
|
+
if (o = r.exec(e), o !== null && p.set(Number(o[1]), Number(o[2]), Number(o[3])), o = i.exec(e), o !== null && m.set(Number(o[1]), Number(o[2]), Number(o[3])), p.x > m.x || p.y > m.y || p.z > m.z) throw Error("THREE.LUTCubeLoader: Invalid input domain");
|
|
2048
|
+
let h = this.type === 1009 ? 255 : 1, _ = 0;
|
|
2049
|
+
for (; (o = a.exec(e)) !== null;) d[_++] = Number(o[1]) * h, d[_++] = Number(o[2]) * h, d[_++] = Number(o[3]) * h, d[_++] = h;
|
|
2050
|
+
let v = new k();
|
|
2051
|
+
return v.image.data = d, v.image.width = l, v.image.height = l, v.image.depth = l, v.type = this.type, v.magFilter = f, v.minFilter = f, v.wrapS = g, v.wrapT = g, v.wrapR = g, v.generateMipmaps = !1, v.needsUpdate = !0, {
|
|
2052
2052
|
title: c,
|
|
2053
2053
|
size: l,
|
|
2054
2054
|
domainMin: p,
|
|
2055
2055
|
domainMax: m,
|
|
2056
|
-
texture3D:
|
|
2056
|
+
texture3D: v
|
|
2057
2057
|
};
|
|
2058
2058
|
}
|
|
2059
|
-
}, Gt = class extends
|
|
2059
|
+
}, Gt = class extends ge {
|
|
2060
2060
|
constructor(e) {
|
|
2061
2061
|
super(e), this.flip = !1;
|
|
2062
2062
|
}
|
|
2063
2063
|
load(e, t, n, r) {
|
|
2064
|
-
let i = new
|
|
2064
|
+
let i = new fe(this.manager);
|
|
2065
2065
|
i.setCrossOrigin(this.crossOrigin), i.setPath(this.path), i.load(e, (n) => {
|
|
2066
2066
|
try {
|
|
2067
2067
|
let e;
|
|
@@ -2072,8 +2072,8 @@ var U = class e extends b {
|
|
|
2072
2072
|
}, n, r);
|
|
2073
2073
|
}
|
|
2074
2074
|
parse(e, t) {
|
|
2075
|
-
let n = new Uint8Array(e), r = new
|
|
2076
|
-
return r.image.data = n, r.image.width = t, r.image.height = t, r.image.depth = t, r.format =
|
|
2075
|
+
let n = new Uint8Array(e), r = new k();
|
|
2076
|
+
return r.image.data = n, r.image.width = t, r.image.height = t, r.image.depth = t, r.format = p, r.type = b, r.magFilter = f, r.minFilter = f, r.wrapS = g, r.wrapT = g, r.wrapR = g, r.generateMipmaps = !1, r.needsUpdate = !0, {
|
|
2077
2077
|
size: t,
|
|
2078
2078
|
texture3D: r
|
|
2079
2079
|
};
|
|
@@ -2095,15 +2095,15 @@ var U = class e extends b {
|
|
|
2095
2095
|
}
|
|
2096
2096
|
return i.getImageData(0, 0, t, n);
|
|
2097
2097
|
}
|
|
2098
|
-
}, Kt = class extends
|
|
2098
|
+
}, Kt = class extends ge {
|
|
2099
2099
|
constructor(e) {
|
|
2100
|
-
super(e), this.type =
|
|
2100
|
+
super(e), this.type = b;
|
|
2101
2101
|
}
|
|
2102
2102
|
setType(e) {
|
|
2103
2103
|
return this.type = e, this;
|
|
2104
2104
|
}
|
|
2105
2105
|
load(e, t, n, r) {
|
|
2106
|
-
let i = new
|
|
2106
|
+
let i = new ne(this.manager);
|
|
2107
2107
|
i.setPath(this.path), i.setResponseType("text"), i.load(e, (n) => {
|
|
2108
2108
|
try {
|
|
2109
2109
|
t(this.parse(n));
|
|
@@ -2115,24 +2115,24 @@ var U = class e extends b {
|
|
|
2115
2115
|
parse(e) {
|
|
2116
2116
|
let t = /^[\d ]+$/m, n = /^([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+) *$/gm, r = t.exec(e);
|
|
2117
2117
|
if (r === null) throw Error("THREE.LUT3dlLoader: Missing grid information");
|
|
2118
|
-
let i = r[0].trim().split(/\s+/g).map(Number), a = i[1] - i[0],
|
|
2118
|
+
let i = r[0].trim().split(/\s+/g).map(Number), a = i[1] - i[0], o = i.length, s = o ** 2;
|
|
2119
2119
|
for (let e = 1, t = i.length; e < t; ++e) if (a !== i[e] - i[e - 1]) throw Error("THREE.LUT3dlLoader: Inconsistent grid size");
|
|
2120
|
-
let
|
|
2120
|
+
let c = new Float32Array(o ** 3 * 4), l = 0, u = 0;
|
|
2121
2121
|
for (; (r = n.exec(e)) !== null;) {
|
|
2122
2122
|
let e = Number(r[1]), t = Number(r[2]), n = Number(r[3]);
|
|
2123
|
-
|
|
2124
|
-
let i =
|
|
2125
|
-
|
|
2123
|
+
l = Math.max(l, e, t, n);
|
|
2124
|
+
let i = u % o, a = Math.floor(u / o) % o, d = Math.floor(u / s) % o, f = (i * s + a * o + d) * 4;
|
|
2125
|
+
c[f + 0] = e, c[f + 1] = t, c[f + 2] = n, ++u;
|
|
2126
2126
|
}
|
|
2127
|
-
let
|
|
2127
|
+
let d = 2 ** Math.ceil(Math.log2(l)), m = this.type === 1009 ? new Uint8Array(c.length) : c, h = this.type === 1009 ? 255 : 1;
|
|
2128
2128
|
for (let e = 0, t = m.length; e < t; e += 4) {
|
|
2129
2129
|
let t = e + 1, n = e + 2, r = e + 3;
|
|
2130
|
-
m[e] =
|
|
2130
|
+
m[e] = c[e] / d * h, m[t] = c[t] / d * h, m[n] = c[n] / d * h, m[r] = h;
|
|
2131
2131
|
}
|
|
2132
|
-
let
|
|
2133
|
-
return
|
|
2134
|
-
size:
|
|
2135
|
-
texture3D:
|
|
2132
|
+
let _ = new k();
|
|
2133
|
+
return _.image.data = m, _.image.width = o, _.image.height = o, _.image.depth = o, _.format = p, _.type = this.type, _.magFilter = f, _.minFilter = f, _.wrapS = g, _.wrapT = g, _.wrapR = g, _.generateMipmaps = !1, _.needsUpdate = !0, {
|
|
2134
|
+
size: o,
|
|
2135
|
+
texture3D: _
|
|
2136
2136
|
};
|
|
2137
2137
|
}
|
|
2138
2138
|
}, $ = {
|
|
@@ -2143,17 +2143,17 @@ var U = class e extends b {
|
|
|
2143
2143
|
},
|
|
2144
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 }",
|
|
2145
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 }"
|
|
2146
|
-
}, qt = class extends
|
|
2146
|
+
}, qt = class extends B {
|
|
2147
2147
|
constructor() {
|
|
2148
|
-
super(), this.isOutputPass = !0, this.uniforms =
|
|
2148
|
+
super(), this.isOutputPass = !0, this.uniforms = C.clone($.uniforms), this.material = new c({
|
|
2149
2149
|
name: $.name,
|
|
2150
2150
|
uniforms: this.uniforms,
|
|
2151
2151
|
vertexShader: $.vertexShader,
|
|
2152
2152
|
fragmentShader: $.fragmentShader
|
|
2153
|
-
}), this._fsQuad = new
|
|
2153
|
+
}), this._fsQuad = new V(this.material), this._outputColorSpace = null, this._toneMapping = null;
|
|
2154
2154
|
}
|
|
2155
2155
|
render(e, t, n) {
|
|
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 = {},
|
|
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 = {}, o.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));
|
|
2157
2157
|
}
|
|
2158
2158
|
dispose() {
|
|
2159
2159
|
this.material.dispose(), this._fsQuad.dispose();
|
|
@@ -2224,7 +2224,7 @@ var U = class e extends b {
|
|
|
2224
2224
|
return this._sceneRenderer.debugOutput;
|
|
2225
2225
|
}
|
|
2226
2226
|
constructor(t, n) {
|
|
2227
|
-
this.materialsNeedUpdate = !0, this._passRenderer = new
|
|
2227
|
+
this.materialsNeedUpdate = !0, this._passRenderer = new Ne(), this._outlinePass = null, this._debugPass = null, this._cameraUpdate = new De(), this._cameraChanged = !0, this._noUpdateNeededCount = 0, this._noOStaticFrames = 0, this._maxSamples = 1, this._passUpdateStates = {
|
|
2228
2228
|
updateGroundReflection: !1,
|
|
2229
2229
|
updateGBuffer: !1,
|
|
2230
2230
|
updateScreenSpaceShadow: !1,
|
|
@@ -2239,9 +2239,9 @@ var U = class e extends b {
|
|
|
2239
2239
|
width: this._sceneRenderer.width,
|
|
2240
2240
|
height: this._sceneRenderer.height,
|
|
2241
2241
|
samples: i,
|
|
2242
|
-
textureMinificationFilter: r ?
|
|
2243
|
-
textureMagnificationFilter: r ?
|
|
2244
|
-
}), this._groundReflectionPass = new ct(this, this._sceneRenderer.width, this._sceneRenderer.height, this._maxSamples, {}), this._screenSpaceShadowMapPass = new vt(this, new
|
|
2242
|
+
textureMinificationFilter: r ? f : O,
|
|
2243
|
+
textureMagnificationFilter: r ? f : O
|
|
2244
|
+
}), this._groundReflectionPass = new ct(this, this._sceneRenderer.width, this._sceneRenderer.height, this._maxSamples, {}), this._screenSpaceShadowMapPass = new vt(this, new _(this._sceneRenderer.width, this._sceneRenderer.height), {
|
|
2245
2245
|
samples: a,
|
|
2246
2246
|
alwaysUpdate: !1
|
|
2247
2247
|
}), this._shadowAndAoPass = new Y(this, this._sceneRenderer.width, this._sceneRenderer.height, i), this._lutPass = new Ut({
|
|
@@ -2273,19 +2273,19 @@ var U = class e extends b {
|
|
|
2273
2273
|
});
|
|
2274
2274
|
}
|
|
2275
2275
|
createOutlinePass() {
|
|
2276
|
-
return this._outlinePass ||= new Dt(this, new
|
|
2276
|
+
return this._outlinePass ||= new Dt(this, new _(this._sceneRenderer.width, this._sceneRenderer.height), this.scene, this.camera, [], {
|
|
2277
2277
|
downSampleRatio: 2,
|
|
2278
2278
|
edgeDetectionFxaa: !0
|
|
2279
2279
|
}), this._outlinePass;
|
|
2280
2280
|
}
|
|
2281
2281
|
getRenderPassRenderTarget(e) {
|
|
2282
|
-
return this._lutPassParameters.enabled ? (this._passRenderTarget = this._passRenderTarget ?? new
|
|
2282
|
+
return this._lutPassParameters.enabled ? (this._passRenderTarget = this._passRenderTarget ?? new t(this._sceneRenderer.width * e.getPixelRatio(), this._sceneRenderer.height * e.getPixelRatio(), {
|
|
2283
2283
|
type: 1016,
|
|
2284
2284
|
samples: this._maxSamples
|
|
2285
2285
|
}), this._passRenderTarget) : null;
|
|
2286
2286
|
}
|
|
2287
2287
|
getPostPassRenderTarget(e) {
|
|
2288
|
-
return this._lutPassParameters.enabled ? (this._passPassRenderTarget = this._passPassRenderTarget ?? new
|
|
2288
|
+
return this._lutPassParameters.enabled ? (this._passPassRenderTarget = this._passPassRenderTarget ?? new t(this._sceneRenderer.width * e.getPixelRatio(), this._sceneRenderer.height * e.getPixelRatio(), { type: 1016 }), this._passPassRenderTarget) : null;
|
|
2289
2289
|
}
|
|
2290
2290
|
setGroundVisibility(e) {
|
|
2291
2291
|
this._sceneRenderer.shadowAndAoGroundPlane.setVisibility(e);
|
|
@@ -2376,7 +2376,7 @@ var U = class e extends b {
|
|
|
2376
2376
|
this.materialsNeedUpdate = !1, t.traverse((e) => {
|
|
2377
2377
|
if (e.isMesh) {
|
|
2378
2378
|
let t = e.material;
|
|
2379
|
-
t instanceof
|
|
2379
|
+
t instanceof _e && this._updateMaterial(e, t, n);
|
|
2380
2380
|
}
|
|
2381
2381
|
});
|
|
2382
2382
|
}
|
|
@@ -2397,7 +2397,7 @@ var U = class e extends b {
|
|
|
2397
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);
|
|
2398
2398
|
}
|
|
2399
2399
|
};
|
|
2400
|
-
|
|
2400
|
+
Ve([Be, ze("design:type", Object)], Yt.prototype, "_initData", void 0);
|
|
2401
2401
|
//#endregion
|
|
2402
2402
|
//#region packages/common-core/src/webgl/renderer/scene-renderer.ts
|
|
2403
2403
|
var Xt = {
|
|
@@ -2437,7 +2437,7 @@ var Xt = {
|
|
|
2437
2437
|
return this._shadowAndAoGroundPlane;
|
|
2438
2438
|
}
|
|
2439
2439
|
constructor(e, t, n, r, i) {
|
|
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
|
|
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 Ae(), this.boundingVolumeSet = !1, this.renderCacheManager = new We(), this.selectedObjects = [], this.groundGroup = new pe(), this._shadingType = Ie.DEFAULT, this._qualityLevel = Xt.HIGHEST, this._qualityMap = /* @__PURE__ */ new Map(), this._customShadingParameters = null, this._creator_ = e, this.width = n, this.height = r, this.linearAoFilter = i ?? !0, this.renderer = t, this.renderCacheManager.registerCache("inivisibleGround", new U((e) => e === this.groundGroup)), this.renderCacheManager.registerCache("groundReflection", new U((e) => e === this.groundGroup || e.name === "dimensioning" ? !0 : !!(e instanceof T && H(e.material)))), this.renderCacheManager.registerCache("debug", new U()), this.renderCacheManager.registerCache("floorDepthWrite", new Ge((e) => e.userData?.isFloor)), this._shadowAndAoGroundPlane = new W(null), this.groundGroup.rotateX(-Math.PI / 2), this._renderPassManager = new Yt(e, this), this.outlineRenderer = new $e(this._renderPassManager, null, {}), this.parameters = {
|
|
2441
2441
|
gBufferRenderTargetParameters: this.gBufferRenderPass.parameters,
|
|
2442
2442
|
bakedGroundContactShadowParameters: this.bakedGroundContactShadowPass.parameters,
|
|
2443
2443
|
screenSpaceShadowMapParameters: this.screenSpaceShadowMapPass.parameters,
|
|
@@ -2493,14 +2493,14 @@ var Xt = {
|
|
|
2493
2493
|
applyCurrentParameters() {
|
|
2494
2494
|
let e = [];
|
|
2495
2495
|
this._qualityMap.has(this._qualityLevel) && e.push(this._qualityMap.get(this._qualityLevel));
|
|
2496
|
-
let t =
|
|
2496
|
+
let t = Pe(this._shadingType);
|
|
2497
2497
|
t && e.push(t);
|
|
2498
|
-
let n =
|
|
2499
|
-
if (n && e.push(n), this._customShadingParameters && e.push(
|
|
2498
|
+
let n = je(this.uiInteractionMode);
|
|
2499
|
+
if (n && e.push(n), this._customShadingParameters && e.push(ke(this._customShadingParameters)), this._customOutlineParameters && e.push({ outlineParameters: {
|
|
2500
2500
|
visibleEdgeColor: this._customOutlineParameters.outlineVisibleEdgeColor,
|
|
2501
2501
|
hiddenEdgeColor: this._customOutlineParameters.outlineHiddenEdgeColor
|
|
2502
2502
|
} }), e.length > 0) {
|
|
2503
|
-
let t =
|
|
2503
|
+
let t = Te(...e);
|
|
2504
2504
|
this.updateParameters(t), this.bakedGroundContactShadowPass.applyParameters();
|
|
2505
2505
|
}
|
|
2506
2506
|
}
|
|
@@ -2566,8 +2566,8 @@ var Xt = {
|
|
|
2566
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));
|
|
2567
2567
|
}
|
|
2568
2568
|
};
|
|
2569
|
-
|
|
2569
|
+
Ve([Be, ze("design:type", Object)], Zt.prototype, "_initData", void 0);
|
|
2570
2570
|
//#endregion
|
|
2571
2571
|
export { ft as a, Mt as i, Zt as n, q as o, Q as r, Xt as t };
|
|
2572
2572
|
|
|
2573
|
-
//# sourceMappingURL=scene-renderer
|
|
2573
|
+
//# sourceMappingURL=scene-renderer--DzrpIl_.mjs.map
|