@roomle/web-sdk 4.0.0 → 4.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{BufferGeometry-CnbfgBmz.mjs → BufferGeometry-DcRNeLZD.mjs} +2 -2
- package/lib/{BufferGeometry-CnbfgBmz.mjs.map → BufferGeometry-DcRNeLZD.mjs.map} +1 -1
- package/lib/{GLTFExporter-BxcjPMva.mjs → GLTFExporter-DdzTpCjW.mjs} +46 -46
- package/lib/{GLTFExporter-BxcjPMva.mjs.map → GLTFExporter-DdzTpCjW.mjs.map} +1 -1
- package/lib/{GaussianBlurNode-8gO-I1qG.mjs → GaussianBlurNode-CLuzhfDu.mjs} +19 -19
- package/lib/{GaussianBlurNode-8gO-I1qG.mjs.map → GaussianBlurNode-CLuzhfDu.mjs.map} +1 -1
- package/lib/{Object3D-DMaDdv-D.mjs → Object3D-CEXK2mMb.mjs} +1 -1
- package/lib/{Object3D-DMaDdv-D.mjs.map → Object3D-CEXK2mMb.mjs.map} +1 -1
- package/lib/Pass-C7MZilDW.mjs +53 -0
- package/lib/Pass-C7MZilDW.mjs.map +1 -0
- package/lib/{PointLightHelper-CahXSxiA.mjs → PointLightHelper-dDeo1kUI.mjs} +4 -4
- package/lib/{PointLightHelper-CahXSxiA.mjs.map → PointLightHelper-dDeo1kUI.mjs.map} +1 -1
- package/lib/{SpotLightHelper-BEqeYq1p.mjs → SpotLightHelper-BsMEPgVo.mjs} +3 -3
- package/lib/{SpotLightHelper-BEqeYq1p.mjs.map → SpotLightHelper-BsMEPgVo.mjs.map} +1 -1
- package/lib/{USDZExporter-ZZoG1mne.mjs → USDZExporter-BIDQSKG4.mjs} +3 -3
- package/lib/{USDZExporter-ZZoG1mne.mjs.map → USDZExporter-BIDQSKG4.mjs.map} +1 -1
- package/lib/{Vector4-BkA_VGid.mjs → Vector4-D-4p8rfn.mjs} +2 -2
- package/lib/{Vector4-BkA_VGid.mjs.map → Vector4-D-4p8rfn.mjs.map} +1 -1
- package/lib/{api-CUyBdNba.mjs → api-BEszDVqh.mjs} +10 -10
- package/lib/{api-CUyBdNba.mjs.map → api-BEszDVqh.mjs.map} +1 -1
- package/lib/{asset-loader.worker-C_5RQYHp.mjs → asset-loader.worker-eqHzNAwa.mjs} +1 -1
- package/lib/asset-loader.worker-eqHzNAwa.mjs.map +1 -0
- package/lib/{banana-for-scale-B77S3z9R.mjs → banana-for-scale-CiCouumi.mjs} +4 -4
- package/lib/{banana-for-scale-B77S3z9R.mjs.map → banana-for-scale-CiCouumi.mjs.map} +1 -1
- package/lib/{budgeteer.sw-DxeAvd0v.mjs → budgeteer.sw-BUMElkO1.mjs} +1 -1
- package/lib/budgeteer.sw-BUMElkO1.mjs.map +1 -0
- package/lib/{common-utils-BiOW17Ao.mjs → common-utils-CCzT4Gnn.mjs} +2 -2
- package/lib/{common-utils-BiOW17Ao.mjs.map → common-utils-CCzT4Gnn.mjs.map} +1 -1
- package/lib/{component-dimensioning-DPyPzSsa.mjs → component-dimensioning-DWEZ4jZg.mjs} +7 -7
- package/lib/{component-dimensioning-DPyPzSsa.mjs.map → component-dimensioning-DWEZ4jZg.mjs.map} +1 -1
- package/lib/{component-raycast-helper-RiQIybsX.mjs → component-raycast-helper-D2hyLpdX.mjs} +17 -17
- package/lib/{component-raycast-helper-RiQIybsX.mjs.map → component-raycast-helper-D2hyLpdX.mjs.map} +1 -1
- package/lib/configurator-BENT3shs.mjs +2 -0
- package/lib/{configurator-C_rsqn9l.mjs → configurator-BjLLdSf8.mjs} +16 -16
- package/lib/{configurator-C_rsqn9l.mjs.map → configurator-BjLLdSf8.mjs.map} +1 -1
- package/lib/{continuous-drawing-helper-C_Yc0uuv.mjs → continuous-drawing-helper-CCuU99Vh.mjs} +3 -3
- package/lib/{continuous-drawing-helper-C_Yc0uuv.mjs.map → continuous-drawing-helper-CCuU99Vh.mjs.map} +1 -1
- package/lib/{dat.gui.module-BLjoST8r.mjs → dat.gui.module-B2PXSbre.mjs} +1 -1
- package/lib/{dat.gui.module-BLjoST8r.mjs.map → dat.gui.module-B2PXSbre.mjs.map} +1 -1
- package/lib/{decorate-BAtqSPNS.mjs → decorate-CX1ZGuFY.mjs} +1 -1
- package/lib/{decorate-BAtqSPNS.mjs.map → decorate-CX1ZGuFY.mjs.map} +1 -1
- package/lib/{dimensioning-helper-D9oxGkry.mjs → dimensioning-helper-CjuQqjBn.mjs} +14 -14
- package/lib/{dimensioning-helper-D9oxGkry.mjs.map → dimensioning-helper-CjuQqjBn.mjs.map} +1 -1
- package/lib/dimensioning-helper-ImsWfczi.mjs +2 -0
- package/lib/{dist-DGov-RNo.mjs → dist-Blgk0vU0.mjs} +1 -1
- package/lib/{dist-DGov-RNo.mjs.map → dist-Blgk0vU0.mjs.map} +1 -1
- package/lib/{fflate.module-CTnSdWOb.mjs → fflate.module-DTkA0kF8.mjs} +1 -1
- package/lib/{fflate.module-CTnSdWOb.mjs.map → fflate.module-DTkA0kF8.mjs.map} +1 -1
- package/lib/{glb-viewer-A5vSLFZ5.mjs → glb-viewer-9Ata6ZNJ.mjs} +59 -45
- package/lib/glb-viewer-9Ata6ZNJ.mjs.map +1 -0
- package/lib/glb-viewer-CGqSGT38.mjs +2 -0
- package/lib/{highlight-coordinator-CZEJGeXA.mjs → highlight-coordinator-PyWNABN9.mjs} +3 -3
- package/lib/{highlight-coordinator-CZEJGeXA.mjs.map → highlight-coordinator-PyWNABN9.mjs.map} +1 -1
- package/lib/{homag-intelligence-BdCDX7LF.mjs → homag-intelligence-BNqPqVgE.mjs} +3 -3
- package/lib/{homag-intelligence-BdCDX7LF.mjs.map → homag-intelligence-BNqPqVgE.mjs.map} +1 -1
- package/lib/{imos-ix-poc-export-helper-CaXXDNvP.mjs → imos-ix-poc-export-helper-C1LfrtjM.mjs} +3 -3
- package/lib/{imos-ix-poc-export-helper-CaXXDNvP.mjs.map → imos-ix-poc-export-helper-C1LfrtjM.mjs.map} +1 -1
- package/lib/{kernel-utils-BYEsHVYJ.mjs → kernel-utils-Cn4evFqF.mjs} +2 -2
- package/lib/{kernel-utils-BYEsHVYJ.mjs.map → kernel-utils-Cn4evFqF.mjs.map} +1 -1
- package/lib/{layer-CIWL5ZW3.mjs → layer-DvZF9ur3.mjs} +1 -1
- package/lib/{layer-CIWL5ZW3.mjs.map → layer-DvZF9ur3.mjs.map} +1 -1
- package/lib/{main-BUl8iCi1.mjs → main-n3n3jdja.mjs} +1097 -1017
- package/lib/{main-BUl8iCi1.mjs.map → main-n3n3jdja.mjs.map} +1 -1
- package/lib/{material-viewer-C4SqVaGG.mjs → material-viewer-Cv5Awgwm.mjs} +24 -24
- package/lib/{material-viewer-C4SqVaGG.mjs.map → material-viewer-Cv5Awgwm.mjs.map} +1 -1
- package/lib/{packages-C9gO5mKk.mjs → packages-B3bi3adH.mjs} +5 -5
- package/lib/{packages-C9gO5mKk.mjs.map → packages-B3bi3adH.mjs.map} +1 -1
- package/lib/planner-DIT2VvMG.mjs +44 -0
- package/lib/{planner-t4QH26WW.mjs.map → planner-DIT2VvMG.mjs.map} +1 -1
- package/lib/planner-DaI8ZwEe.mjs +2 -0
- package/lib/{plugin-system-COZJdJH_.mjs → plugin-system-FuZpDWqv.mjs} +3 -3
- package/lib/{plugin-system-COZJdJH_.mjs.map → plugin-system-FuZpDWqv.mjs.map} +1 -1
- package/lib/roomle-headless-setup-CMHahWyC.mjs +612 -0
- package/lib/roomle-headless-setup-CMHahWyC.mjs.map +1 -0
- package/lib/roomle-headless.d.ts +113 -34
- package/lib/roomle-headless.js +433 -84
- package/lib/roomle-headless.js.map +1 -1
- package/lib/{roomle-renderer-DhLUaHJZ.mjs → roomle-renderer-BR0UKz2y.mjs} +2 -2
- package/lib/{roomle-renderer-DhLUaHJZ.mjs.map → roomle-renderer-BR0UKz2y.mjs.map} +1 -1
- package/lib/roomle-sdk.d.ts +37 -9
- package/lib/roomle-sdk.js +8 -8
- package/lib/{roomle-webgpu-renderer-CRGcdahn.mjs → roomle-webgpu-renderer-fOYJoKJU.mjs} +175 -173
- package/lib/roomle-webgpu-renderer-fOYJoKJU.mjs.map +1 -0
- package/lib/{scene-renderer-D5CfxCag.mjs → scene-renderer-CAzAJ4pS.mjs} +212 -211
- package/lib/{scene-renderer-D5CfxCag.mjs.map → scene-renderer-CAzAJ4pS.mjs.map} +1 -1
- package/lib/{script-loader-D6IuUFjw.mjs → script-loader-BAWHLt9q.mjs} +3 -3
- package/lib/{script-loader-D6IuUFjw.mjs.map → script-loader-BAWHLt9q.mjs.map} +1 -1
- package/lib/{shading-settings-BEMqEGzB.mjs → shading-settings-BPpgt0Fq.mjs} +101 -146
- package/lib/shading-settings-BPpgt0Fq.mjs.map +1 -0
- package/lib/{stats-helper-DAfbSToL.mjs → stats-helper-CqiTcJuc.mjs} +3 -3
- package/lib/{stats-helper-DAfbSToL.mjs.map → stats-helper-CqiTcJuc.mjs.map} +1 -1
- package/lib/{svgo.browser-DYieWzyw.mjs → svgo.browser-EB1zkPfG.mjs} +1 -1
- package/lib/{svgo.browser-DYieWzyw.mjs.map → svgo.browser-EB1zkPfG.mjs.map} +1 -1
- package/lib/{three.core-DjCexDCp.mjs → three.core-CmmDf_BZ.mjs} +73 -38
- package/lib/{three.core-DjCexDCp.mjs.map → three.core-CmmDf_BZ.mjs.map} +1 -1
- package/lib/{three.module-CuRNgijg.mjs → three.module-BkkLbA6n.mjs} +857 -857
- package/lib/{three.module-CuRNgijg.mjs.map → three.module-BkkLbA6n.mjs.map} +1 -1
- package/lib/three.tsl-8HwZJGJ8.mjs +2 -0
- package/lib/{three.tsl-BIBER8nk.mjs → three.tsl-Cw9IeeKW.mjs} +64 -52
- package/lib/{three.tsl-BIBER8nk.mjs.map → three.tsl-Cw9IeeKW.mjs.map} +1 -1
- package/lib/three.webgpu-Bw4_U6Q1.mjs +3 -0
- package/lib/{three.webgpu-Bz4Xtk0X.mjs → three.webgpu-DL5l_0xI.mjs} +1742 -1728
- package/lib/{three.webgpu-Bz4Xtk0X.mjs.map → three.webgpu-DL5l_0xI.mjs.map} +1 -1
- package/lib/{threejs-utils-Dpvg3Czz.mjs → threejs-utils-PRhv_eX3.mjs} +63 -63
- package/lib/{threejs-utils-Dpvg3Czz.mjs.map → threejs-utils-PRhv_eX3.mjs.map} +1 -1
- package/lib/{tools-core-BDOFf9le.mjs → tools-core-CmrXkw3J.mjs} +3 -3
- package/lib/{tools-core-BDOFf9le.mjs.map → tools-core-CmrXkw3J.mjs.map} +1 -1
- package/lib/webgpu-wkXAkJ6p.mjs +5084 -0
- package/lib/webgpu-wkXAkJ6p.mjs.map +1 -0
- package/lib/workers-YGDNEfpU.mjs +6 -0
- package/lib/{workers-DcgrO-z7.mjs.map → workers-YGDNEfpU.mjs.map} +1 -1
- package/package.json +5 -4
- package/lib/asset-loader.worker-C_5RQYHp.mjs.map +0 -1
- package/lib/budgeteer.sw-DxeAvd0v.mjs.map +0 -1
- package/lib/configurator-BBlZVIId.mjs +0 -2
- package/lib/dimensioning-helper-Bzf1sbpy.mjs +0 -2
- package/lib/glb-viewer-A5vSLFZ5.mjs.map +0 -1
- package/lib/glb-viewer-B4ILlvw0.mjs +0 -2
- package/lib/planner-49YwTdiA.mjs +0 -2
- package/lib/planner-t4QH26WW.mjs +0 -44
- package/lib/roomle-headless-setup-Cc8EAnVe.mjs +0 -1204
- package/lib/roomle-headless-setup-Cc8EAnVe.mjs.map +0 -1
- package/lib/roomle-webgpu-renderer-CRGcdahn.mjs.map +0 -1
- package/lib/shading-settings-BEMqEGzB.mjs.map +0 -1
- package/lib/three.tsl-Q-21y0pO.mjs +0 -2
- package/lib/three.webgpu-dtN0kDKB.mjs +0 -3
- package/lib/workers-DcgrO-z7.mjs +0 -6
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { k as e } from "./threejs-utils-
|
|
2
|
-
import { An as t, Ci as n,
|
|
3
|
-
import { r as
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
6
|
-
import "./
|
|
1
|
+
import { k as e } from "./threejs-utils-PRhv_eX3.mjs";
|
|
2
|
+
import { An as t, Ci as n, Di as r, E as i, En as a, Gn as o, J as s, Mr as c, On as l, S as u, Si as d, Tr as f, Ur as p, V as m, Vt as h, Wr as g, Y as _, Z as ee, _n as v, at as te, bn as y, cn as b, ct as x, en as ne, f as re, fn as ie, gi as ae, gn as oe, h as se, hn as ce, ht as le, kr as ue, ln as S, mi as C, mn as de, mt as fe, ni as w, oi as pe, pi as T, qt as E, si as me, sn as D, st as he, un as ge, w as O, wi as k, y as _e, z as A, zt as ve } from "./three.core-CmmDf_BZ.mjs";
|
|
3
|
+
import { r as ye } from "./three.module-BkkLbA6n.mjs";
|
|
4
|
+
import { C as j, D as be, E as xe, O as M, S as N, T as Se, _ as Ce, a as we, b as P, d as Te, f as F, g as I, h as Ee, i as De, l as L, m as Oe, n as ke, o as Ae, p as je, r as Me, s as Ne, t as Pe, u as R, v as Fe, w as z, x as B, y as Ie } from "./shading-settings-BPpgt0Fq.mjs";
|
|
5
|
+
import { n as Le, t as Re } from "./Pass-C7MZilDW.mjs";
|
|
6
|
+
import { n as ze, r as Be, t as Ve } from "./decorate-CX1ZGuFY.mjs";
|
|
7
|
+
import "./dimensioning-helper-CjuQqjBn.mjs";
|
|
7
8
|
//#region packages/common-core/src/webgl/renderer/objects/shadow-ground-plane.ts
|
|
8
9
|
var He = class e extends b {
|
|
9
10
|
static {
|
|
10
11
|
this.alphaMap = !0;
|
|
11
12
|
}
|
|
12
13
|
constructor(n, r) {
|
|
13
|
-
super(new t(1, 1, 10, 10), new
|
|
14
|
+
super(new t(1, 1, 10, 10), new oe({
|
|
14
15
|
color: e.alphaMap ? 0 : 16777215,
|
|
15
16
|
transparent: !0,
|
|
16
17
|
depthWrite: !1,
|
|
@@ -39,7 +40,7 @@ var He = class e extends b {
|
|
|
39
40
|
let t = this.material;
|
|
40
41
|
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;
|
|
41
42
|
}
|
|
42
|
-
}, V = class extends
|
|
43
|
+
}, V = class extends Le {
|
|
43
44
|
get renderPassManager() {
|
|
44
45
|
return this._renderPassManager;
|
|
45
46
|
}
|
|
@@ -67,14 +68,14 @@ var He = class e extends b {
|
|
|
67
68
|
}, H = {
|
|
68
69
|
uniforms: {
|
|
69
70
|
tDiffuse: { value: null },
|
|
70
|
-
intensity: { value: new
|
|
71
|
+
intensity: { value: new d(1, 1) }
|
|
71
72
|
},
|
|
72
73
|
vertexShader: "\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",
|
|
73
74
|
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 }"
|
|
74
75
|
}, Ue = class extends p {
|
|
75
76
|
constructor(e) {
|
|
76
77
|
super({
|
|
77
|
-
uniforms:
|
|
78
|
+
uniforms: T.clone(H.uniforms),
|
|
78
79
|
vertexShader: H.vertexShader,
|
|
79
80
|
fragmentShader: H.fragmentShader,
|
|
80
81
|
transparent: !0,
|
|
@@ -86,7 +87,7 @@ var He = class e extends b {
|
|
|
86
87
|
blendSrcAlpha: 206,
|
|
87
88
|
blendDstAlpha: 200,
|
|
88
89
|
blendEquationAlpha: 100
|
|
89
|
-
}), this._intensity = new
|
|
90
|
+
}), this._intensity = new d(1, 1), this.uniforms.intensity.value = this._intensity, this.update(e);
|
|
90
91
|
}
|
|
91
92
|
update(e) {
|
|
92
93
|
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;
|
|
@@ -98,13 +99,13 @@ var He = class e extends b {
|
|
|
98
99
|
a += `vec3(${n.x}, ${n.y}, ${n.z})${t < e - 1 ? "," : ")"}`;
|
|
99
100
|
}
|
|
100
101
|
return a;
|
|
101
|
-
}, Ge = (e, t,
|
|
102
|
-
let
|
|
103
|
-
for (let
|
|
104
|
-
let
|
|
105
|
-
|
|
102
|
+
}, Ge = (e, t, r, i) => {
|
|
103
|
+
let a = [];
|
|
104
|
+
for (let o = 0; o < e; o++) {
|
|
105
|
+
let s = 2 * Math.PI * t * o / e, c = (1 + (r - 1) * (o / (e - 1)) ** i) / r;
|
|
106
|
+
a.push(new n(Math.cos(s), Math.sin(s), c));
|
|
106
107
|
}
|
|
107
|
-
return
|
|
108
|
+
return a;
|
|
108
109
|
}, U = {
|
|
109
110
|
name: "PoissonDenoiseShader",
|
|
110
111
|
defines: {
|
|
@@ -124,10 +125,10 @@ var He = class e extends b {
|
|
|
124
125
|
tNormal: { value: null },
|
|
125
126
|
tDepth: { value: null },
|
|
126
127
|
tNoise: { value: null },
|
|
127
|
-
resolution: { value: new
|
|
128
|
-
cameraProjectionMatrix: { value: new
|
|
129
|
-
cameraProjectionMatrixInverse: { value: new
|
|
130
|
-
cameraWorldMatrix: { value: new
|
|
128
|
+
resolution: { value: new d() },
|
|
129
|
+
cameraProjectionMatrix: { value: new D() },
|
|
130
|
+
cameraProjectionMatrixInverse: { value: new D() },
|
|
131
|
+
cameraWorldMatrix: { value: new D() },
|
|
131
132
|
lumaPhi: { value: 5 },
|
|
132
133
|
depthPhi: { value: 1 },
|
|
133
134
|
normalPhi: { value: 1 },
|
|
@@ -135,8 +136,8 @@ var He = class e extends b {
|
|
|
135
136
|
radiusExponent: { value: 1.3 },
|
|
136
137
|
iteration: { value: 0 },
|
|
137
138
|
noOfIterations: { value: 2 },
|
|
138
|
-
sceneBoxMin: { value: new
|
|
139
|
-
sceneBoxMax: { value: new
|
|
139
|
+
sceneBoxMin: { value: new n(-1, -1, -1) },
|
|
140
|
+
sceneBoxMax: { value: new n(1, 1, 1) }
|
|
140
141
|
},
|
|
141
142
|
vertexShader: "\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
142
143
|
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}"
|
|
@@ -158,16 +159,16 @@ var He = class e extends b {
|
|
|
158
159
|
this._inputTexture = e;
|
|
159
160
|
}
|
|
160
161
|
constructor(e, t, n, r) {
|
|
161
|
-
this.needsUpdate = !0, this.parameters = { ...Ke }, this._width = 0, this._height = 0, this._samples = 0, this._normalVectorSourceType = R.FLOAT_BUFFER_NORMAL, this._depthValueSourceType = L.NORMAL_VECTOR_ALPHA, this._inputTexture = null, this.depthTexture = null, this.normalTexture = null, this._noiseTexture = null, this._renderTargets = [], this._outputRenderTargetIndex = 0, this._passRenderer = new
|
|
162
|
+
this.needsUpdate = !0, this.parameters = { ...Ke }, this._width = 0, this._height = 0, this._samples = 0, this._normalVectorSourceType = R.FLOAT_BUFFER_NORMAL, this._depthValueSourceType = L.NORMAL_VECTOR_ALPHA, this._inputTexture = null, this.depthTexture = null, this.normalTexture = null, this._noiseTexture = null, this._renderTargets = [], this._outputRenderTargetIndex = 0, this._passRenderer = new je(), this._rgInputTexture = !1, this._luminanceWeighted = !0, this._width = e, this._height = t, this._samples = n, this._normalVectorSourceType = r?.normalVectorSourceType || R.FLOAT_BUFFER_NORMAL, this._depthValueSourceType = r?.depthValueSourceType || L.NORMAL_VECTOR_ALPHA, this._inputTexture = r?.inputTexture || null, this.depthTexture = r?.depthTexture || null, this.normalTexture = r?.normalTexture || null, this._rgInputTexture = r?.rgInputTexture || !1, this._luminanceWeighted = r?.luminanceWeighted === !0, this._luminanceType = r?.luminanceType || "vec3", this._sampleLuminance = r?.sampleLuminance || "a", this._fragmentOutput = r?.fragmentOutput || "vec4(denoised.xyz, 1.)", r?.poissonDenoisePassParameters && (this.parameters = r.poissonDenoisePassParameters), r && this.updateTextures(r);
|
|
162
163
|
}
|
|
163
164
|
_getNoiseTexture(e = 64) {
|
|
164
165
|
if (!this._noiseTexture) {
|
|
165
|
-
let t = new
|
|
166
|
+
let t = new Ee(), n = new Uint8Array(e * e * 4);
|
|
166
167
|
for (let r = 0; r < e; r++) for (let i = 0; i < e; i++) {
|
|
167
168
|
let a = r, o = i;
|
|
168
169
|
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;
|
|
169
170
|
}
|
|
170
|
-
this._noiseTexture = new m(n, e, e, o,
|
|
171
|
+
this._noiseTexture = new m(n, e, e, o, C), this._noiseTexture.wrapS = c, this._noiseTexture.wrapT = c, this._noiseTexture.needsUpdate = !0;
|
|
171
172
|
}
|
|
172
173
|
return this._noiseTexture;
|
|
173
174
|
}
|
|
@@ -175,7 +176,7 @@ var He = class e extends b {
|
|
|
175
176
|
let n = t;
|
|
176
177
|
return this._pdMaterial || (this._pdMaterial = new p({
|
|
177
178
|
defines: Object.assign({}, U.defines),
|
|
178
|
-
uniforms:
|
|
179
|
+
uniforms: T.clone(U.uniforms),
|
|
179
180
|
vertexShader: U.vertexShader,
|
|
180
181
|
fragmentShader: U.fragmentShader,
|
|
181
182
|
depthTest: !1,
|
|
@@ -190,13 +191,13 @@ var He = class e extends b {
|
|
|
190
191
|
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)));
|
|
191
192
|
}
|
|
192
193
|
_getRenderTargets() {
|
|
193
|
-
return this._renderTargets.length < 2 && (this._renderTargets = [new
|
|
194
|
+
return this._renderTargets.length < 2 && (this._renderTargets = [new r(this._width, this._height, {
|
|
194
195
|
samples: this._samples,
|
|
195
196
|
format: o,
|
|
196
197
|
type: le,
|
|
197
198
|
magFilter: y,
|
|
198
199
|
minFilter: y
|
|
199
|
-
}), new
|
|
200
|
+
}), new r(this._width, this._height, {
|
|
200
201
|
samples: this._samples,
|
|
201
202
|
format: o,
|
|
202
203
|
type: le,
|
|
@@ -251,10 +252,10 @@ var He = class e extends b {
|
|
|
251
252
|
progressiveDenoiseIterations: 0
|
|
252
253
|
}, K = class extends V {
|
|
253
254
|
static {
|
|
254
|
-
this.shadowTransform = new
|
|
255
|
+
this.shadowTransform = new D().set(0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1);
|
|
255
256
|
}
|
|
256
257
|
get aoAndSoftShadowRenderTarget() {
|
|
257
|
-
return this._aoAndSoftShadowRenderTarget = this._aoAndSoftShadowRenderTarget ?? new
|
|
258
|
+
return this._aoAndSoftShadowRenderTarget = this._aoAndSoftShadowRenderTarget ?? new r(this._width, this._height, {
|
|
258
259
|
samples: this._samples,
|
|
259
260
|
format: 1030,
|
|
260
261
|
magFilter: this._samples > 1 ? 1006 : 1003,
|
|
@@ -262,7 +263,7 @@ var He = class e extends b {
|
|
|
262
263
|
}), this._aoAndSoftShadowRenderTarget;
|
|
263
264
|
}
|
|
264
265
|
get aoRenderPass() {
|
|
265
|
-
return this._aoPass ||= new
|
|
266
|
+
return this._aoPass ||= new Ae(this._width, this._height, this._samples, !this.parameters.applyToMaterial, {
|
|
266
267
|
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? R.FLOAT_BUFFER_NORMAL : R.INPUT_RGB_NORMAL,
|
|
267
268
|
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? L.NORMAL_VECTOR_ALPHA : L.SEPARATE_BUFFER,
|
|
268
269
|
modulateRedChannel: !0,
|
|
@@ -298,7 +299,7 @@ var He = class e extends b {
|
|
|
298
299
|
return this._softShadowPass;
|
|
299
300
|
}
|
|
300
301
|
get fadeRenderTarget() {
|
|
301
|
-
return this._fadeRenderTarget = this._fadeRenderTarget ?? new
|
|
302
|
+
return this._fadeRenderTarget = this._fadeRenderTarget ?? new r(this._width, this._height, {
|
|
302
303
|
samples: this._samples,
|
|
303
304
|
format: 1030,
|
|
304
305
|
magFilter: this._samples > 1 ? 1006 : 1003,
|
|
@@ -346,9 +347,9 @@ var He = class e extends b {
|
|
|
346
347
|
alwaysUpdate: i?.alwaysUpdate ?? G.alwaysUpdate,
|
|
347
348
|
progressiveDenoiseIterations: i?.progressiveDenoiseIterations ?? G.progressiveDenoiseIterations,
|
|
348
349
|
shadow: { ...Je },
|
|
349
|
-
ao: { ...
|
|
350
|
+
ao: { ...Ne },
|
|
350
351
|
poissonDenoise: { ...Ke }
|
|
351
|
-
}, this._copyMaterial = new
|
|
352
|
+
}, this._copyMaterial = new P(), this._blendMaterial = new P({}, Ie.DEFAULT), this._blendAoAndShadowMaterial = new Ue();
|
|
352
353
|
}
|
|
353
354
|
dispose() {
|
|
354
355
|
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();
|
|
@@ -417,13 +418,13 @@ var He = class e extends b {
|
|
|
417
418
|
return i && (this._copyMaterial.update({
|
|
418
419
|
texture: t,
|
|
419
420
|
blending: 0,
|
|
420
|
-
colorTransform:
|
|
421
|
-
colorBase:
|
|
421
|
+
colorTransform: B,
|
|
422
|
+
colorBase: M,
|
|
422
423
|
multiplyChannels: 0
|
|
423
424
|
}), this.passRenderer.renderScreenSpace(e, this._copyMaterial, this.fadeRenderTarget)), r > .001 && (this._blendMaterial.update({
|
|
424
425
|
texture: n,
|
|
425
426
|
blending: i ? 5 : 0,
|
|
426
|
-
colorTransform: new
|
|
427
|
+
colorTransform: new D().set(0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, i ? r : 1),
|
|
427
428
|
multiplyChannels: 0
|
|
428
429
|
}), this.passRenderer.renderScreenSpace(e, this._blendMaterial, this.fadeRenderTarget)), this.fadeRenderTarget.texture;
|
|
429
430
|
}
|
|
@@ -480,7 +481,7 @@ var He = class e extends b {
|
|
|
480
481
|
updateOutline(e, t, n) {
|
|
481
482
|
n.length > 0 ? (this._parameterNeedsUpdate && this.applyParameters(), this.activateOutline(e, t), this.outlinePass && (this.outlinePass.selectedObjects = n)) : this.deactivateOutline();
|
|
482
483
|
}
|
|
483
|
-
}, q = (e, t) => Array.isArray(e) ? e.some((e) => q(e, t)) : e.transparent && e.opacity < t || e.alphaTest > 0, J = (e) => Array.isArray(e) ? e.some((e) => J(e)) : e instanceof
|
|
484
|
+
}, q = (e, t) => Array.isArray(e) ? e.some((e) => q(e, t)) : e.transparent && e.opacity < t || e.alphaTest > 0, J = (e) => Array.isArray(e) ? e.some((e) => J(e)) : e instanceof oe && e.transmission > 0, Xe = class {
|
|
484
485
|
constructor(e) {
|
|
485
486
|
this.needsUpdate = !0, this._cache = null, this._cache = e;
|
|
486
487
|
}
|
|
@@ -631,15 +632,15 @@ var He = class e extends b {
|
|
|
631
632
|
let e = this._sharedShadowGroundPlane;
|
|
632
633
|
return e ||= (this._shadowGroundPlane ??= new He(this.renderTarget.texture, this.parameters), this._shadowGroundPlane), e.parent !== this._groundGroup && this._groundGroup.add(e), e;
|
|
633
634
|
}
|
|
634
|
-
constructor(e, t, n,
|
|
635
|
-
super(e), this.limitPlaneSize = !0, this.needsUpdate = !0, this.noNeedOfUpdateCount = 0, this._blurScale = 1, this._shadowScale = 1, this._groundGroup = n, this.shadowMapSize =
|
|
635
|
+
constructor(e, t, n, i) {
|
|
636
|
+
super(e), this.limitPlaneSize = !0, this.needsUpdate = !0, this.noNeedOfUpdateCount = 0, this._blurScale = 1, this._shadowScale = 1, this._groundGroup = n, this.shadowMapSize = i.shadowMapSize ?? 2048, this.parameters = this._getDefaultParameters(i), this._groundShadowFar = this.parameters.cameraFar, this._renderer = t, this.renderCacheManager?.registerCache(this, new Y((e) => e.isMesh && !et(e) || e.name !== void 0 && ["Ground", "Floor"].includes(e.name))), this.renderTarget = new r(this.shadowMapSize, this.shadowMapSize), this.renderTarget.texture.generateMipmaps = !1, this._renderTargetBlur = new r(this.shadowMapSize, this.shadowMapSize), this._renderTargetBlur.texture.generateMipmaps = !1, this._sharedShadowGroundPlane = i?.sharedShadowGroundPlane, this.shadowGroundPlane.setShadowMap(this.renderTarget.texture), this.shadowGroundPlane.updateMaterial(this.parameters), this._groundContactCamera = new nt(), this._groundGroup.add(this._groundContactCamera), this._depthMaterial = new ge(), this._depthMaterial.userData.fadeoutBias = { value: this.parameters.fadeoutBias }, this._depthMaterial.userData.fadeoutFalloff = { value: this.parameters.fadeoutFalloff }, this._depthMaterial.onBeforeCompile = (e) => {
|
|
636
637
|
e.uniforms.fadeoutBias = this._depthMaterial.userData.fadeoutBias, e.uniforms.fadeoutFalloff = this._depthMaterial.userData.fadeoutFalloff, e.fragmentShader = `
|
|
637
638
|
uniform float fadeoutBias;
|
|
638
639
|
uniform float fadeoutFalloff;
|
|
639
640
|
${e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );", He.alphaMap ? "gl_FragColor = vec4(clamp(pow(1.0 + fadeoutBias - fragCoordZ, 1.0/(1.0-fadeoutFalloff)), 0.0, 1.0));" : "gl_FragColor = vec4(vec3(0.0), clamp(pow(1.0 + fadeoutBias - fragCoordZ, 1.0/(1.0-fadeoutFalloff)), 0.0, 1.0));")}
|
|
640
641
|
`;
|
|
641
|
-
}, this._depthMaterial.side = 2, this._depthMaterial.depthTest = !0, this._depthMaterial.depthWrite = !0, this._blurPass = new
|
|
642
|
-
...
|
|
642
|
+
}, this._depthMaterial.side = 2, this._depthMaterial.depthTest = !0, this._depthMaterial.depthWrite = !0, this._blurPass = new Te(Fe, {
|
|
643
|
+
...i,
|
|
643
644
|
passRenderer: this.renderPassManager.passRenderer
|
|
644
645
|
}), this.updatePlaneAndShadowCamera();
|
|
645
646
|
}
|
|
@@ -739,7 +740,7 @@ var He = class e extends b {
|
|
|
739
740
|
this.far = e, this.updateProjectionMatrix(), this.cameraHelper?.update();
|
|
740
741
|
}
|
|
741
742
|
updateCameraHelper(e, t) {
|
|
742
|
-
e ? (this.cameraHelper = this.cameraHelper ?? new
|
|
743
|
+
e ? (this.cameraHelper = this.cameraHelper ?? new _e(this), this.cameraHelper.visible = !0, t?.add(this.cameraHelper)) : this.cameraHelper?.parent && this.cameraHelper?.removeFromParent();
|
|
743
744
|
}
|
|
744
745
|
setCameraHelperVisibility(e) {
|
|
745
746
|
this.cameraHelper && (this.cameraHelper.visible = e);
|
|
@@ -766,7 +767,7 @@ var He = class e extends b {
|
|
|
766
767
|
FLOAT_BUFFER: t?.floatBufferType ? 1 : 0,
|
|
767
768
|
LINEAR_DEPTH: t?.linearDepth ? 1 : 0
|
|
768
769
|
}),
|
|
769
|
-
uniforms:
|
|
770
|
+
uniforms: T.clone(e._normalAndDepthShader.uniforms),
|
|
770
771
|
vertexShader: e._normalAndDepthShader.vertexShader,
|
|
771
772
|
fragmentShader: e._normalAndDepthShader.fragmentShader,
|
|
772
773
|
blending: t?.blending ?? 0
|
|
@@ -803,7 +804,7 @@ var He = class e extends b {
|
|
|
803
804
|
}) : new de({ blending: 0 })), this._gBufferRenderMaterial instanceof at && this._gBufferRenderMaterial.update({ camera: e }), this._gBufferRenderMaterial;
|
|
804
805
|
}
|
|
805
806
|
get depthNormalRenderTarget() {
|
|
806
|
-
if (!this._depthNormalRenderTarget) if (this.floatRgbNormalAlphaDepth) this._depthNormalRenderTarget = new
|
|
807
|
+
if (!this._depthNormalRenderTarget) if (this.floatRgbNormalAlphaDepth) this._depthNormalRenderTarget = new r(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale, {
|
|
807
808
|
minFilter: this._targetMinificationTextureFilter,
|
|
808
809
|
magFilter: this._targetMagnificationTextureFilter,
|
|
809
810
|
type: x,
|
|
@@ -811,7 +812,7 @@ var He = class e extends b {
|
|
|
811
812
|
});
|
|
812
813
|
else {
|
|
813
814
|
let e = new _(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale);
|
|
814
|
-
e.format = s, e.type =
|
|
815
|
+
e.format = s, e.type = ae, this._depthNormalRenderTarget = new r(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale, {
|
|
815
816
|
minFilter: this._targetMinificationTextureFilter,
|
|
816
817
|
magFilter: this._targetMagnificationTextureFilter,
|
|
817
818
|
depthTexture: e
|
|
@@ -820,7 +821,7 @@ var He = class e extends b {
|
|
|
820
821
|
return this._depthNormalRenderTarget;
|
|
821
822
|
}
|
|
822
823
|
get separateDeptRenderTarget() {
|
|
823
|
-
return this._separateDeptRenderTarget ||= new
|
|
824
|
+
return this._separateDeptRenderTarget ||= new r(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale, {
|
|
824
825
|
minFilter: this._targetMinificationTextureFilter,
|
|
825
826
|
magFilter: this._targetMagnificationTextureFilter,
|
|
826
827
|
type: x,
|
|
@@ -845,16 +846,16 @@ var He = class e extends b {
|
|
|
845
846
|
this.passRenderer.renderWithOverrideMaterial(e, t, n, this.updateGBufferRenderMaterial(n), this.depthNormalRenderTarget, 7829503, 1);
|
|
846
847
|
}
|
|
847
848
|
getCopyMaterial(e) {
|
|
848
|
-
return this._copyMaterial ??= new
|
|
849
|
+
return this._copyMaterial ??= new P(), this._copyMaterial.update(e);
|
|
849
850
|
}
|
|
850
851
|
_copyDepthToSeparateDepthTexture(e, t) {
|
|
851
852
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
852
853
|
texture: t.texture,
|
|
853
854
|
blending: 0,
|
|
854
|
-
colorTransform:
|
|
855
|
-
colorBase:
|
|
855
|
+
colorTransform: Ce,
|
|
856
|
+
colorBase: I,
|
|
856
857
|
multiplyChannels: 0,
|
|
857
|
-
uvTransform:
|
|
858
|
+
uvTransform: N
|
|
858
859
|
}), this.separateDeptRenderTarget);
|
|
859
860
|
}
|
|
860
861
|
}, st = class extends $e {
|
|
@@ -898,19 +899,19 @@ var He = class e extends b {
|
|
|
898
899
|
groundReflectionScale: 1,
|
|
899
900
|
renderTargetDownScale: 4,
|
|
900
901
|
...i
|
|
901
|
-
}, this._copyMaterial = new
|
|
902
|
+
}, this._copyMaterial = new P({}, Ie.ADDITIVE, !0, !0), this._updateCopyMaterial(null), this._reflectionIntensityMaterial = new dt({
|
|
902
903
|
width: this._width / this.parameters.renderTargetDownScale,
|
|
903
904
|
height: this._height / this.parameters.renderTargetDownScale
|
|
904
|
-
}), this._blurPass = new
|
|
905
|
+
}), this._blurPass = new Te(Fe, {
|
|
905
906
|
...i,
|
|
906
907
|
passRenderer: this.renderPassManager.passRenderer
|
|
907
908
|
});
|
|
908
909
|
}
|
|
909
910
|
_newRenderTarget(e) {
|
|
910
|
-
let t = this._width / this.parameters.renderTargetDownScale, n = this._height / this.parameters.renderTargetDownScale,
|
|
911
|
-
return e ? (
|
|
911
|
+
let t = this._width / this.parameters.renderTargetDownScale, n = this._height / this.parameters.renderTargetDownScale, i = {};
|
|
912
|
+
return e ? (i.depthTexture = new _(t, n), i.samples = this._samples) : i.samples = 1, new r(t, n, {
|
|
912
913
|
format: o,
|
|
913
|
-
...
|
|
914
|
+
...i
|
|
914
915
|
});
|
|
915
916
|
}
|
|
916
917
|
dispose() {
|
|
@@ -932,9 +933,9 @@ var He = class e extends b {
|
|
|
932
933
|
let n = this.parameters.intensity * t, r = this.parameters.brightness;
|
|
933
934
|
this._copyMaterial.update({
|
|
934
935
|
texture: e?.texture ?? void 0,
|
|
935
|
-
colorTransform: new
|
|
936
|
+
colorTransform: new D().set(r, 0, 0, 0, 0, r, 0, 0, 0, 0, r, 0, 0, 0, 0, n),
|
|
936
937
|
multiplyChannels: 0,
|
|
937
|
-
uvTransform:
|
|
938
|
+
uvTransform: j
|
|
938
939
|
}), this._copyMaterial.depthTest = !0, this._copyMaterial.depthWrite = !1;
|
|
939
940
|
}
|
|
940
941
|
renderPass(e) {
|
|
@@ -963,9 +964,9 @@ var He = class e extends b {
|
|
|
963
964
|
fadeOutExponent: this.parameters.fadeOutExponent
|
|
964
965
|
}), e.getRenderTarget()), e.setRenderTarget(r);
|
|
965
966
|
}
|
|
966
|
-
blurReflection(e, t,
|
|
967
|
-
let
|
|
968
|
-
this._blurPass.render(e,
|
|
967
|
+
blurReflection(e, t, r) {
|
|
968
|
+
let i = new n(t.matrixWorld.elements[4], t.matrixWorld.elements[5], t.matrixWorld.elements[6]), a = this.parameters.blurHorizontal / this._width, o = this.parameters.blurVertical / this._height * Math.abs(i.dot(new n(0, 0, 1)));
|
|
969
|
+
this._blurPass.render(e, r, [a * 4, o * 4], [a * 4 * (1 + this.parameters.blurAscent), o * 4 * (1 + this.parameters.blurAscent)]);
|
|
969
970
|
}
|
|
970
971
|
_createGroundReflectionCamera(e) {
|
|
971
972
|
let t = e.clone(), n = t;
|
|
@@ -982,12 +983,12 @@ var He = class e extends b {
|
|
|
982
983
|
uniforms: {
|
|
983
984
|
tDiffuse: { value: null },
|
|
984
985
|
tDepth: { value: null },
|
|
985
|
-
resolution: { value: new
|
|
986
|
+
resolution: { value: new d() },
|
|
986
987
|
cameraNear: { value: .1 },
|
|
987
988
|
cameraFar: { value: 1 },
|
|
988
|
-
cameraProjectionMatrix: { value: new
|
|
989
|
-
cameraInverseProjectionMatrix: { value: new
|
|
990
|
-
inverseViewMatrix: { value: new
|
|
989
|
+
cameraProjectionMatrix: { value: new D() },
|
|
990
|
+
cameraInverseProjectionMatrix: { value: new D() },
|
|
991
|
+
inverseViewMatrix: { value: new D() },
|
|
991
992
|
groundLevel: { value: 0 },
|
|
992
993
|
fadeOutDistance: { value: 1 },
|
|
993
994
|
fadeOutExponent: { value: 1 }
|
|
@@ -1004,7 +1005,7 @@ var He = class e extends b {
|
|
|
1004
1005
|
constructor(t) {
|
|
1005
1006
|
super({
|
|
1006
1007
|
defines: Object.assign({}, e.shader.defines),
|
|
1007
|
-
uniforms:
|
|
1008
|
+
uniforms: T.clone(e.shader.uniforms),
|
|
1008
1009
|
vertexShader: e.shader.vertexShader,
|
|
1009
1010
|
fragmentShader: e.shader.fragmentShader,
|
|
1010
1011
|
blending: 0
|
|
@@ -1021,7 +1022,7 @@ var He = class e extends b {
|
|
|
1021
1022
|
}
|
|
1022
1023
|
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;
|
|
1023
1024
|
}
|
|
1024
|
-
}, ft = class extends
|
|
1025
|
+
}, ft = class extends ve {
|
|
1025
1026
|
constructor(e, t) {
|
|
1026
1027
|
let n = [
|
|
1027
1028
|
1,
|
|
@@ -1039,8 +1040,8 @@ var He = class e extends b {
|
|
|
1039
1040
|
1,
|
|
1040
1041
|
1,
|
|
1041
1042
|
0
|
|
1042
|
-
], r = new
|
|
1043
|
-
r.setAttribute("position", new
|
|
1043
|
+
], r = new se();
|
|
1044
|
+
r.setAttribute("position", new he(n, 3)), r.computeBoundingSphere();
|
|
1044
1045
|
let i = new h({ fog: !1 });
|
|
1045
1046
|
super(r, i), this.light = e, this.color = t, this.type = "RectAreaLightHelper";
|
|
1046
1047
|
let a = [
|
|
@@ -1062,8 +1063,8 @@ var He = class e extends b {
|
|
|
1062
1063
|
1,
|
|
1063
1064
|
-1,
|
|
1064
1065
|
0
|
|
1065
|
-
], o = new
|
|
1066
|
-
o.setAttribute("position", new
|
|
1066
|
+
], o = new se();
|
|
1067
|
+
o.setAttribute("position", new he(a, 3)), o.computeBoundingSphere(), this.add(new b(o, new S({
|
|
1067
1068
|
side: 1,
|
|
1068
1069
|
fog: !1
|
|
1069
1070
|
})));
|
|
@@ -1085,16 +1086,16 @@ var He = class e extends b {
|
|
|
1085
1086
|
this._enableGroundBoundary = !1;
|
|
1086
1087
|
}
|
|
1087
1088
|
static {
|
|
1088
|
-
this._shadowFadeOut = new
|
|
1089
|
+
this._shadowFadeOut = new d(.1, 20);
|
|
1089
1090
|
}
|
|
1090
1091
|
static {
|
|
1091
|
-
this._sceneBoxMin = new
|
|
1092
|
+
this._sceneBoxMin = new n(-1, -1, -1);
|
|
1092
1093
|
}
|
|
1093
1094
|
static {
|
|
1094
|
-
this._sceneBoxMax = new
|
|
1095
|
+
this._sceneBoxMax = new n(1, 1, 1);
|
|
1095
1096
|
}
|
|
1096
1097
|
static {
|
|
1097
|
-
this._distributionProperties = new
|
|
1098
|
+
this._distributionProperties = new k(1, 1, 1, 1);
|
|
1098
1099
|
}
|
|
1099
1100
|
constructor(e) {
|
|
1100
1101
|
super(e), this.customProgramCacheKey = this._customProgramCacheKey, this.onBeforeCompile = this._onBeforeCompile;
|
|
@@ -1140,13 +1141,13 @@ var He = class e extends b {
|
|
|
1140
1141
|
this._shadowMapPassOverrideMaterialCache.shadowOnGround = e;
|
|
1141
1142
|
}
|
|
1142
1143
|
constructor(e, t, n) {
|
|
1143
|
-
super(e), this.needsUpdate = !1, this.drawGround = !0, this.shadowTypeNeedsUpdate = !0, this.shadowConfiguration = new bt(), this._shadowLightSources = [], this._shadowScale = 1, this._groundMapScale = 1, this._cameraUpdate = new F(), this._viewportSize = new
|
|
1144
|
-
let
|
|
1145
|
-
this._shadowRenderTarget = new
|
|
1146
|
-
samples:
|
|
1144
|
+
super(e), this.needsUpdate = !1, this.drawGround = !0, this.shadowTypeNeedsUpdate = !0, this.shadowConfiguration = new bt(), this._shadowLightSources = [], this._shadowScale = 1, this._groundMapScale = 1, this._cameraUpdate = new F(), this._viewportSize = new d(t.x, t.y), this._samples = n?.samples ?? 0, this._shadowMapSize = n?.shadowMapSize ?? 1024, this.parameters = this._getScreenSpaceShadowMapParameters(n), this.castShadow = this.parameters.enableShadowMap, this._shadowMapPassOverrideMaterialCache = new yt(), this.renderCacheManager?.registerCache(this, this._shadowMapPassOverrideMaterialCache);
|
|
1145
|
+
let i = this._samples;
|
|
1146
|
+
this._shadowRenderTarget = new r(this._viewportSize.x, this._viewportSize.y, {
|
|
1147
|
+
samples: i,
|
|
1147
1148
|
format: ue,
|
|
1148
|
-
magFilter: this._samples > 0 ?
|
|
1149
|
-
minFilter: this._samples > 0 ?
|
|
1149
|
+
magFilter: this._samples > 0 ? E : y,
|
|
1150
|
+
minFilter: this._samples > 0 ? E : y
|
|
1150
1151
|
});
|
|
1151
1152
|
}
|
|
1152
1153
|
_getScreenSpaceShadowMapParameters(e) {
|
|
@@ -1209,9 +1210,9 @@ var He = class e extends b {
|
|
|
1209
1210
|
}
|
|
1210
1211
|
_addShadowFromLightSources(e, t) {
|
|
1211
1212
|
e.forEach((e) => {
|
|
1212
|
-
let
|
|
1213
|
-
if (
|
|
1214
|
-
let t = new St(new
|
|
1213
|
+
let r = e.maxIntensity * t;
|
|
1214
|
+
if (r >= .1 && e.position.z >= 0) {
|
|
1215
|
+
let t = new St(new n(e.position.x, e.position.z, e.position.y).multiplyScalar(7), r, {
|
|
1215
1216
|
shadowMapSize: this._shadowMapSize,
|
|
1216
1217
|
shadowLightSourceType: this.parameters.shadowLightSourceType
|
|
1217
1218
|
});
|
|
@@ -1222,13 +1223,13 @@ var He = class e extends b {
|
|
|
1222
1223
|
_createShadowLightSourceArray(e) {
|
|
1223
1224
|
let t = [];
|
|
1224
1225
|
if (e) {
|
|
1225
|
-
let e = new Ct(new
|
|
1226
|
+
let e = new Ct(new n(0, 7, 0), { shadowMapSize: this._shadowMapSize });
|
|
1226
1227
|
t.push(e);
|
|
1227
1228
|
}
|
|
1228
1229
|
return this.parameters.enableGroundBoundary = e, t;
|
|
1229
1230
|
}
|
|
1230
1231
|
setSize(e, t) {
|
|
1231
|
-
this._viewportSize = new
|
|
1232
|
+
this._viewportSize = new d(e, t), this._shadowRenderTarget.setSize(this._viewportSize.x, this._viewportSize.y);
|
|
1232
1233
|
}
|
|
1233
1234
|
updatePositionAndTarget() {
|
|
1234
1235
|
this._shadowLightSources.forEach((e) => e.updatePositionAndTarget());
|
|
@@ -1292,7 +1293,7 @@ var He = class e extends b {
|
|
|
1292
1293
|
}
|
|
1293
1294
|
_createShadowMaterial(t) {
|
|
1294
1295
|
let n;
|
|
1295
|
-
return n = t === X.EMISSIVE || t === X.UNLIT ? new
|
|
1296
|
+
return n = t === X.EMISSIVE || t === X.UNLIT ? new S({
|
|
1296
1297
|
color: 16777215,
|
|
1297
1298
|
side: 2
|
|
1298
1299
|
}) : t === X.SHADOW ? new g({ side: 2 }) : e.useModifiedMaterial ? this._createCustomerShadowMaterial() : new ce({
|
|
@@ -1323,7 +1324,7 @@ var He = class e extends b {
|
|
|
1323
1324
|
}
|
|
1324
1325
|
_setShadowMaterialForOpaqueObject(e) {
|
|
1325
1326
|
let t = e.material;
|
|
1326
|
-
t instanceof h || t instanceof
|
|
1327
|
+
t instanceof h || t instanceof S ? this.addToCache(e, { material: this._unlitMaterial }) : t instanceof v ? this._setMeshShadowStandardMaterial(e, t) : this.addToCache(e, { material: e.receiveShadow ? this._shadowObjectMaterial : this._unlitMaterial });
|
|
1327
1328
|
}
|
|
1328
1329
|
_setMeshShadowStandardMaterial(e, t) {
|
|
1329
1330
|
let n = t.emissiveIntensity > 0 && (t.emissive.r > 0 || t.emissive.g > 0 || t.emissive.b > 0);
|
|
@@ -1393,7 +1394,7 @@ var He = class e extends b {
|
|
|
1393
1394
|
}
|
|
1394
1395
|
}, xt = class {
|
|
1395
1396
|
constructor(e, t) {
|
|
1396
|
-
this._isVisibleBackup = !0, this._castShadowBackup = !0, this._shadowMapSize = t?.shadowMapSize ?? 1024, this._blurSamples = t?.blurSamples ?? 8, this._shadowLightSource = e, this._shadowLightSource.visible = !1, this._shadowLightSource.castShadow = !0, this._shadowLightSource.shadow && (this._shadowLightSource.shadow.mapSize = new
|
|
1397
|
+
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 d(this._shadowMapSize, this._shadowMapSize), this._shadowLightSource.shadow.blurSamples = this._blurSamples, this._shadowLightSource.shadow.autoUpdate = !1), this._shadowLightSource.userData.shadowLightSource = this;
|
|
1397
1398
|
}
|
|
1398
1399
|
getPosition() {
|
|
1399
1400
|
return this._shadowLightSource.position;
|
|
@@ -1414,10 +1415,10 @@ var He = class e extends b {
|
|
|
1414
1415
|
e.remove(this._shadowLightSource);
|
|
1415
1416
|
}
|
|
1416
1417
|
updatePositionAndTarget() {
|
|
1417
|
-
this._updateShadowPositionAndTarget(this.getPosition(), new
|
|
1418
|
+
this._updateShadowPositionAndTarget(this.getPosition(), new n(0, 0, 0));
|
|
1418
1419
|
}
|
|
1419
1420
|
updateBounds(e) {
|
|
1420
|
-
if (this._shadowLightSource instanceof
|
|
1421
|
+
if (this._shadowLightSource instanceof w) {
|
|
1421
1422
|
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);
|
|
1422
1423
|
t.aspect = 1, t.near = r, t.far = i, this._shadowLightSource.angle = s;
|
|
1423
1424
|
} else if (this._shadowLightSource.shadow) {
|
|
@@ -1432,7 +1433,7 @@ var He = class e extends b {
|
|
|
1432
1433
|
this._shadowLightSource.shadow && (this._shadowLightSource.shadow.needsUpdate = !0);
|
|
1433
1434
|
}
|
|
1434
1435
|
_updateShadowPositionAndTarget(e, t) {
|
|
1435
|
-
if (this._shadowLightSource instanceof
|
|
1436
|
+
if (this._shadowLightSource instanceof w) {
|
|
1436
1437
|
let n = t.clone().sub(e), r = n.length();
|
|
1437
1438
|
n.normalize();
|
|
1438
1439
|
let i = t.clone().sub(n.clone().multiplyScalar(r * 4));
|
|
@@ -1457,7 +1458,7 @@ var He = class e extends b {
|
|
|
1457
1458
|
n = new ee(16777215, 1);
|
|
1458
1459
|
break;
|
|
1459
1460
|
case gt.SPOT_LIGHT_SHADOW:
|
|
1460
|
-
n = new
|
|
1461
|
+
n = new w(16777215, 1, 0, Math.PI / 4, 0);
|
|
1461
1462
|
break;
|
|
1462
1463
|
}
|
|
1463
1464
|
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));
|
|
@@ -1529,26 +1530,26 @@ var He = class e extends b {
|
|
|
1529
1530
|
name: "FXAAShader",
|
|
1530
1531
|
uniforms: {
|
|
1531
1532
|
tDiffuse: { value: null },
|
|
1532
|
-
resolution: { value: new
|
|
1533
|
+
resolution: { value: new d(1 / 1024, 1 / 512) }
|
|
1533
1534
|
},
|
|
1534
1535
|
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 }",
|
|
1535
1536
|
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 }"
|
|
1536
1537
|
}, Et = class e extends V {
|
|
1537
1538
|
static {
|
|
1538
|
-
this.BlurDirectionX = new
|
|
1539
|
+
this.BlurDirectionX = new d(1, 0);
|
|
1539
1540
|
}
|
|
1540
1541
|
static {
|
|
1541
|
-
this.BlurDirectionY = new
|
|
1542
|
+
this.BlurDirectionY = new d(0, 1);
|
|
1542
1543
|
}
|
|
1543
1544
|
static {
|
|
1544
1545
|
this.highlightLines = !0;
|
|
1545
1546
|
}
|
|
1546
|
-
constructor(e, t, n,
|
|
1547
|
-
super(e), this.patternTexture = null, this.clearBackground = !1, this.renderScene = n, this.renderCamera =
|
|
1547
|
+
constructor(e, t, n, i, a, o) {
|
|
1548
|
+
super(e), this.patternTexture = null, this.clearBackground = !1, this.renderScene = n, this.renderCamera = i, this.selectedObjects = a === void 0 ? [] : a, this.visibleEdgeColor = new O(1, 1, 1), this.hiddenEdgeColor = new O(.1, .04, .02), this.edgeGlow = 0, this.usePatternTexture = !1, this.edgeThickness = 1, this.edgeStrength = 3, this.downSampleRatio = o?.downSampleRatio || 2, this.pulsePeriod = 0, this.edgeDetectionFxaa = o?.edgeDetectionFxaa || !1, this._visibilityCache = /* @__PURE__ */ new Map(), this.resolution = t === void 0 ? new d(256, 256) : new d(t.x, t.y);
|
|
1548
1549
|
let s = Math.round(this.resolution.x / this.downSampleRatio), c = Math.round(this.resolution.y / this.downSampleRatio);
|
|
1549
|
-
this.renderTargetMaskBuffer = new
|
|
1550
|
+
this.renderTargetMaskBuffer = new r(this.resolution.x, this.resolution.y), this.renderTargetMaskBuffer.texture.name = "OutlinePass.mask", this.renderTargetMaskBuffer.texture.generateMipmaps = !1, this.prepareMaskMaterial = this._getPrepareMaskMaterial(this.gBufferTextures?.isFloatGBufferWithRgbNormalAlphaDepth), this.prepareMaskMaterial.side = 2, this.prepareMaskMaterial.fragmentShader = u(this.prepareMaskMaterial.fragmentShader, this.renderCamera), this.edgeDetectionFxaa && (this.fxaaRenderMaterial = new p(Tt), this.fxaaRenderMaterial.uniforms.tDiffuse.value = this.renderTargetMaskBuffer.texture, this.fxaaRenderMaterial.uniforms.resolution.value.set(1 / this.resolution.x, 1 / this.resolution.y), this.renderTargetFxaaBuffer = new r(this.resolution.x, this.resolution.y), this.renderTargetFxaaBuffer.texture.name = "OutlinePass.fxaa", this.renderTargetFxaaBuffer.texture.generateMipmaps = !1), this.renderTargetMaskDownSampleBuffer = new r(s, c), this.renderTargetMaskDownSampleBuffer.texture.name = "OutlinePass.depthDownSample", this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = !1, this.renderTargetBlurBuffer1 = new r(s, c), this.renderTargetBlurBuffer1.texture.name = "OutlinePass.blur1", this.renderTargetBlurBuffer1.texture.generateMipmaps = !1, this.renderTargetBlurBuffer2 = new r(Math.round(s / 2), Math.round(c / 2)), this.renderTargetBlurBuffer2.texture.name = "OutlinePass.blur2", this.renderTargetBlurBuffer2.texture.generateMipmaps = !1, this.edgeDetectionMaterial = this._getEdgeDetectionMaterial(), this.renderTargetEdgeBuffer1 = new r(s, c), this.renderTargetEdgeBuffer1.texture.name = "OutlinePass.edge1", this.renderTargetEdgeBuffer1.texture.generateMipmaps = !1, this.renderTargetEdgeBuffer2 = new r(Math.round(s / 2), Math.round(c / 2)), this.renderTargetEdgeBuffer2.texture.name = "OutlinePass.edge2", this.renderTargetEdgeBuffer2.texture.generateMipmaps = !1, this.separableBlurMaterial1 = this._getSeperableBlurMaterial(4), this.separableBlurMaterial1.uniforms.texSize.value.set(s, c), this.separableBlurMaterial1.uniforms.kernelRadius.value = 1, this.separableBlurMaterial2 = this._getSeperableBlurMaterial(4), this.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(s / 2), Math.round(c / 2)), this.separableBlurMaterial2.uniforms.kernelRadius.value = 4, this.overlayMaterial = this._getOverlayMaterial();
|
|
1550
1551
|
let l = wt;
|
|
1551
|
-
this.copyUniforms =
|
|
1552
|
+
this.copyUniforms = T.clone(l.uniforms), this.copyUniforms.opacity.value = 1, this.materialCopy = new p({
|
|
1552
1553
|
uniforms: this.copyUniforms,
|
|
1553
1554
|
vertexShader: l.vertexShader,
|
|
1554
1555
|
fragmentShader: l.fragmentShader,
|
|
@@ -1556,7 +1557,7 @@ var He = class e extends b {
|
|
|
1556
1557
|
depthTest: !1,
|
|
1557
1558
|
depthWrite: !1,
|
|
1558
1559
|
transparent: !0
|
|
1559
|
-
}), this.enabled = !0, this.needsSwap = !1, this.oldClearColor = new
|
|
1560
|
+
}), this.enabled = !0, this.needsSwap = !1, this.oldClearColor = new O(), this.oldClearAlpha = 1, this.fsQuad = new Re(void 0), this.tempPulseColor1 = new O(), this.tempPulseColor2 = new O(), this.textureMatrix = new D();
|
|
1560
1561
|
function u(e, t) {
|
|
1561
1562
|
let n = t.isPerspectiveCamera ? "perspective" : "orthographic";
|
|
1562
1563
|
return e.replace(/DEPTH_TO_VIEW_Z/g, n + "DepthToViewZ");
|
|
@@ -1618,7 +1619,7 @@ var He = class e extends b {
|
|
|
1618
1619
|
return new p({
|
|
1619
1620
|
uniforms: {
|
|
1620
1621
|
depthTexture: { value: null },
|
|
1621
|
-
cameraNearFar: { value: new
|
|
1622
|
+
cameraNearFar: { value: new d(.5, .5) },
|
|
1622
1623
|
textureMatrix: { value: null }
|
|
1623
1624
|
},
|
|
1624
1625
|
defines: { FLOAT_ALPHA_DEPTH: e ? 1 : 0 },
|
|
@@ -1630,9 +1631,9 @@ var He = class e extends b {
|
|
|
1630
1631
|
return new p({
|
|
1631
1632
|
uniforms: {
|
|
1632
1633
|
maskTexture: { value: null },
|
|
1633
|
-
texSize: { value: new
|
|
1634
|
-
visibleEdgeColor: { value: new
|
|
1635
|
-
hiddenEdgeColor: { value: new
|
|
1634
|
+
texSize: { value: new d(.5, .5) },
|
|
1635
|
+
visibleEdgeColor: { value: new n(1, 1, 1) },
|
|
1636
|
+
hiddenEdgeColor: { value: new n(1, 1, 1) }
|
|
1636
1637
|
},
|
|
1637
1638
|
vertexShader: "varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
1638
1639
|
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 }"
|
|
@@ -1643,8 +1644,8 @@ var He = class e extends b {
|
|
|
1643
1644
|
defines: { MAX_RADIUS: e },
|
|
1644
1645
|
uniforms: {
|
|
1645
1646
|
colorTexture: { value: null },
|
|
1646
|
-
texSize: { value: new
|
|
1647
|
-
direction: { value: new
|
|
1647
|
+
texSize: { value: new d(.5, .5) },
|
|
1648
|
+
direction: { value: new d(.5, .5) },
|
|
1648
1649
|
kernelRadius: { value: 1 }
|
|
1649
1650
|
},
|
|
1650
1651
|
vertexShader: "varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
@@ -1677,7 +1678,7 @@ var He = class e extends b {
|
|
|
1677
1678
|
}, Ot = class extends p {
|
|
1678
1679
|
constructor(e) {
|
|
1679
1680
|
super({
|
|
1680
|
-
uniforms:
|
|
1681
|
+
uniforms: T.clone(Dt.uniforms),
|
|
1681
1682
|
vertexShader: Dt.vertexShader,
|
|
1682
1683
|
fragmentShader: Dt.fragmentShader,
|
|
1683
1684
|
transparent: !0,
|
|
@@ -1689,18 +1690,18 @@ var He = class e extends b {
|
|
|
1689
1690
|
blendSrcAlpha: 206,
|
|
1690
1691
|
blendDstAlpha: 200,
|
|
1691
1692
|
blendEquationAlpha: 100
|
|
1692
|
-
}), this._intensity = new
|
|
1693
|
+
}), this._intensity = new d(1, 1), this.update(e);
|
|
1693
1694
|
}
|
|
1694
1695
|
update(e) {
|
|
1695
1696
|
return e?.texture !== void 0 && (this.uniforms.tDiffuse.value = e.texture), e?.blending !== void 0 && (this.blending = e.blending), this;
|
|
1696
1697
|
}
|
|
1697
|
-
}, kt = (e) => new
|
|
1698
|
+
}, kt = (e) => new d(Math.atan2(e.y, e.x) / (2 * Math.PI) + .5, Math.asin(e.z) / Math.PI + .5), At = class {
|
|
1698
1699
|
get colorRenderTarget() {
|
|
1699
|
-
return this._colorRenderTarget = this._colorRenderTarget ?? new
|
|
1700
|
+
return this._colorRenderTarget = this._colorRenderTarget ?? new r(), this._colorRenderTarget;
|
|
1700
1701
|
}
|
|
1701
1702
|
environmentMapDecodeTarget(e) {
|
|
1702
|
-
let t = e instanceof
|
|
1703
|
-
return this._environmentMapDecodeTarget = this._environmentMapDecodeTarget ?? new
|
|
1703
|
+
let t = e instanceof ye && e.capabilities.isWebGL2 ? x : C;
|
|
1704
|
+
return this._environmentMapDecodeTarget = this._environmentMapDecodeTarget ?? new r(1, 1, { type: t }), this._environmentMapDecodeTarget;
|
|
1704
1705
|
}
|
|
1705
1706
|
environmentMapDecodeMaterial(e) {
|
|
1706
1707
|
return e ? (this._equirectangularDecodeMaterial = this._equirectangularDecodeMaterial ?? new Q(!0, !1), this._equirectangularDecodeMaterial) : (this._pmremDecodeMaterial = this._pmremDecodeMaterial ?? new Q(!1, !1), this._pmremDecodeMaterial);
|
|
@@ -1709,7 +1710,7 @@ var He = class e extends b {
|
|
|
1709
1710
|
return this._camera = this._camera ?? new a(-1, 1, 1, -1, -1, 1), this._camera;
|
|
1710
1711
|
}
|
|
1711
1712
|
scaleTexture(e, n, r, i) {
|
|
1712
|
-
this.colorRenderTarget.setSize(r, i), this._planeMesh = this._planeMesh ?? new b(new t(2, 2), new
|
|
1713
|
+
this.colorRenderTarget.setSize(r, i), this._planeMesh = this._planeMesh ?? new b(new t(2, 2), new S({ map: n }));
|
|
1713
1714
|
let a = e.getRenderTarget();
|
|
1714
1715
|
e.setRenderTarget(this.colorRenderTarget), e.render(this._planeMesh, this.camera), e.setRenderTarget(a);
|
|
1715
1716
|
let o = this.environmentMapDecodeTarget(e).texture, s = new Uint8Array(r * i * 4);
|
|
@@ -1738,7 +1739,7 @@ var He = class e extends b {
|
|
|
1738
1739
|
}, Q = class extends p {
|
|
1739
1740
|
constructor(e, t) {
|
|
1740
1741
|
super({
|
|
1741
|
-
uniforms:
|
|
1742
|
+
uniforms: T.clone(jt.uniforms),
|
|
1742
1743
|
vertexShader: jt.vertexShader,
|
|
1743
1744
|
fragmentShader: jt.fragmentShader,
|
|
1744
1745
|
defines: {
|
|
@@ -1753,14 +1754,14 @@ var He = class e extends b {
|
|
|
1753
1754
|
}, Mt = class {
|
|
1754
1755
|
constructor(e) {
|
|
1755
1756
|
this.samplePoints = [], this.sampleUVs = [], this.grayscaleTexture = {
|
|
1756
|
-
texture: new
|
|
1757
|
+
texture: new pe(),
|
|
1757
1758
|
pixels: new Uint8Array(),
|
|
1758
1759
|
sRgbaPixels: !1
|
|
1759
|
-
}, this.detectorTexture = new
|
|
1760
|
+
}, this.detectorTexture = new pe(), this.detectorArray = new Float32Array(), this.lightSamples = [], this.lightGraph = new Pt(0), this.lightSources = [], this._grayScale = new n(.2126, .7152, .0722), this._createEquirectangularSamplePoints = (e) => {
|
|
1760
1761
|
let t = [];
|
|
1761
|
-
for (let
|
|
1762
|
-
let
|
|
1763
|
-
t.push(new
|
|
1762
|
+
for (let r = 0; r < e; r++) {
|
|
1763
|
+
let i = r * Math.PI * (3 - Math.sqrt(5)), a = 1 - r / (e - 1) * 2, o = Math.sqrt(1 - a * a), s = Math.cos(i) * o, c = Math.sin(i) * o;
|
|
1764
|
+
t.push(new n(s, c, a));
|
|
1764
1765
|
}
|
|
1765
1766
|
return t;
|
|
1766
1767
|
}, this._numberOfSamples = e?.numberOfSamples ?? 1e3, this._width = e?.width ?? 1024, this._height = e?.height ?? 512, this._sampleThreshold = e?.sampleThreshold ?? .707, this.pointDistance = Math.sqrt(4 * Math.PI) / Math.sqrt(this._numberOfSamples), this.pixelDistance = Math.sqrt(2) * Math.PI * 2 / this._width, this.samplePoints = this._createEquirectangularSamplePoints(this._numberOfSamples), this.sampleUVs = this.samplePoints.map((e) => kt(e));
|
|
@@ -1768,17 +1769,17 @@ var He = class e extends b {
|
|
|
1768
1769
|
detectLightSources(e, t) {
|
|
1769
1770
|
this._textureConverter = this._textureConverter ?? new At(), this.grayscaleTexture = this._textureConverter.newGrayscaleTexture(e, t, this._width, this._height), this.detectorArray = this._redFromRgbaToNormalizedFloatArray(this.grayscaleTexture.pixels, this.grayscaleTexture.sRgbaPixels), this.detectorTexture = this._grayscaleTextureFromFloatArray(this.detectorArray, this._width, this._height), this.lightSamples = this._filterLightSamples(this._sampleThreshold), this.lightGraph = this._findClusterSegments(this.lightSamples, this._sampleThreshold), this.lightGraph.findConnectedComponents(), this.lightSources = this.createLightSourcesFromLightGraph(this.lightSamples, this.lightGraph), this.lightSources.sort((e, t) => t.maxIntensity - e.maxIntensity);
|
|
1770
1771
|
}
|
|
1771
|
-
_redFromRgbaToNormalizedFloatArray(e, t,
|
|
1772
|
-
let
|
|
1772
|
+
_redFromRgbaToNormalizedFloatArray(e, t, r) {
|
|
1773
|
+
let i = new Float32Array(e.length / 4), a = 1, o = 0;
|
|
1773
1774
|
for (let t = 0; t < e.length / 4; ++t) {
|
|
1774
|
-
let
|
|
1775
|
-
e instanceof Float32Array &&
|
|
1776
|
-
let
|
|
1777
|
-
|
|
1775
|
+
let r = new O(...e.slice(t * 4, t * 4 + 3));
|
|
1776
|
+
e instanceof Float32Array && r.convertSRGBToLinear();
|
|
1777
|
+
let s = new n(r.r, r.g, r.b).dot(this._grayScale);
|
|
1778
|
+
a = Math.min(a, s), o = Math.max(o, s), i[t] = s;
|
|
1778
1779
|
}
|
|
1779
|
-
if (
|
|
1780
|
-
else if (!t) for (let e = 0; e <
|
|
1781
|
-
return
|
|
1780
|
+
if (r) for (let e = 0; e < i.length; ++e) i[e] = (t ? i[e] : (i[e] - a) / (o - a)) ** +r;
|
|
1781
|
+
else if (!t) for (let e = 0; e < i.length; ++e) i[e] = (i[e] - a) / (o - a);
|
|
1782
|
+
return i;
|
|
1782
1783
|
}
|
|
1783
1784
|
_grayscaleTextureFromFloatArray(e, t, n) {
|
|
1784
1785
|
let r = t * n, i = new Uint8Array(4 * r);
|
|
@@ -1849,10 +1850,10 @@ var He = class e extends b {
|
|
|
1849
1850
|
}
|
|
1850
1851
|
}, Ft = class {
|
|
1851
1852
|
constructor(e) {
|
|
1852
|
-
this.position = new
|
|
1853
|
+
this.position = new n(), this.uv = new d(), this.averageIntensity = 0, this.maxIntensity = 0, this.size = 0, this.lightSamples = e;
|
|
1853
1854
|
}
|
|
1854
1855
|
calculateLightSourceProperties(e) {
|
|
1855
|
-
this.position = new
|
|
1856
|
+
this.position = new n(), this.averageIntensity = 0, this.maxIntensity = 0;
|
|
1856
1857
|
for (let t of this.lightSamples) {
|
|
1857
1858
|
this.position.add(t.position);
|
|
1858
1859
|
let n = e(t.uv);
|
|
@@ -1871,7 +1872,7 @@ var He = class e extends b {
|
|
|
1871
1872
|
this._depthRenderMaterial?.dispose(), this._copyMaterial?.dispose(), this._srgbToLinearCopyMaterial?.dispose();
|
|
1872
1873
|
}
|
|
1873
1874
|
getCopyMaterial(e) {
|
|
1874
|
-
return this._copyMaterial = this._copyMaterial ?? new
|
|
1875
|
+
return this._copyMaterial = this._copyMaterial ?? new P(), this._copyMaterial.update(e);
|
|
1875
1876
|
}
|
|
1876
1877
|
getBlendAoAndShadowMaterial(e) {
|
|
1877
1878
|
return this._blendAoAndShadowMaterial = this._blendAoAndShadowMaterial ?? new Ue({ blending: 0 }), this._blendAoAndShadowMaterial.update(e);
|
|
@@ -1880,12 +1881,12 @@ var He = class e extends b {
|
|
|
1880
1881
|
return this._blendAoPassDepthMaterial = this._blendAoPassDepthMaterial ?? new Ot({ blending: 0 }), this._blendAoPassDepthMaterial.update(e);
|
|
1881
1882
|
}
|
|
1882
1883
|
getSrgbToLinearCopyMaterial(e) {
|
|
1883
|
-
return this._srgbToLinearCopyMaterial = this._copyMaterial ?? new
|
|
1884
|
+
return this._srgbToLinearCopyMaterial = this._copyMaterial ?? new P({}, Ie.ADDITIVE, !0, !0), this._srgbToLinearCopyMaterial.update(e);
|
|
1884
1885
|
}
|
|
1885
1886
|
_getDepthRenderMaterial(e) {
|
|
1886
|
-
return this._depthRenderMaterial = this._depthRenderMaterial ?? new
|
|
1887
|
+
return this._depthRenderMaterial = this._depthRenderMaterial ?? new Se({
|
|
1887
1888
|
depthTexture: this.gBufferTextures.textureWithDepthValue,
|
|
1888
|
-
depthFilter: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? new
|
|
1889
|
+
depthFilter: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? new k(0, 0, 0, 1) : new k(1, 0, 0, 0)
|
|
1889
1890
|
}), this._depthRenderMaterial.update({ camera: e });
|
|
1890
1891
|
}
|
|
1891
1892
|
renderPass(e) {
|
|
@@ -1898,64 +1899,64 @@ var He = class e extends b {
|
|
|
1898
1899
|
this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1899
1900
|
texture: this.gBufferTextures?.gBufferTexture,
|
|
1900
1901
|
blending: 0,
|
|
1901
|
-
colorTransform: new
|
|
1902
|
-
colorBase: new
|
|
1902
|
+
colorTransform: new D().set(.5, 0, 0, 0, 0, .5, 0, 0, 0, 0, .5, 0, 0, 0, 0, 0),
|
|
1903
|
+
colorBase: new k(.5, .5, .5, 1),
|
|
1903
1904
|
multiplyChannels: 0,
|
|
1904
|
-
uvTransform:
|
|
1905
|
+
uvTransform: N
|
|
1905
1906
|
}), null) : this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1906
1907
|
texture: this.gBufferTextures?.gBufferTexture,
|
|
1907
1908
|
blending: 0,
|
|
1908
|
-
colorTransform:
|
|
1909
|
-
colorBase:
|
|
1909
|
+
colorTransform: be,
|
|
1910
|
+
colorBase: I,
|
|
1910
1911
|
multiplyChannels: 0,
|
|
1911
|
-
uvTransform:
|
|
1912
|
+
uvTransform: N
|
|
1912
1913
|
}), null);
|
|
1913
1914
|
break;
|
|
1914
1915
|
case "g-depth":
|
|
1915
1916
|
this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1916
1917
|
texture: this.gBufferTextures?.gBufferTexture,
|
|
1917
1918
|
blending: 0,
|
|
1918
|
-
colorTransform:
|
|
1919
|
-
colorBase:
|
|
1919
|
+
colorTransform: Ce,
|
|
1920
|
+
colorBase: I,
|
|
1920
1921
|
multiplyChannels: 0,
|
|
1921
|
-
uvTransform:
|
|
1922
|
+
uvTransform: N
|
|
1922
1923
|
}), null) : this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1923
1924
|
texture: this.gBufferTextures?.depthBufferTexture,
|
|
1924
1925
|
blending: 0,
|
|
1925
|
-
colorTransform:
|
|
1926
|
-
colorBase:
|
|
1926
|
+
colorTransform: xe,
|
|
1927
|
+
colorBase: I,
|
|
1927
1928
|
multiplyChannels: 0,
|
|
1928
|
-
uvTransform:
|
|
1929
|
+
uvTransform: N
|
|
1929
1930
|
}), null);
|
|
1930
1931
|
break;
|
|
1931
1932
|
case "ssao":
|
|
1932
1933
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1933
1934
|
texture: this.renderPassManager.shadowAndAoPass.aoAndSoftShadowRenderTarget.texture,
|
|
1934
1935
|
blending: 0,
|
|
1935
|
-
colorTransform:
|
|
1936
|
-
colorBase:
|
|
1936
|
+
colorTransform: z,
|
|
1937
|
+
colorBase: M,
|
|
1937
1938
|
multiplyChannels: 0,
|
|
1938
|
-
uvTransform:
|
|
1939
|
+
uvTransform: N
|
|
1939
1940
|
}), null);
|
|
1940
1941
|
break;
|
|
1941
1942
|
case "ssaodenoise":
|
|
1942
1943
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1943
1944
|
texture: this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,
|
|
1944
1945
|
blending: 0,
|
|
1945
|
-
colorTransform:
|
|
1946
|
-
colorBase:
|
|
1946
|
+
colorTransform: z,
|
|
1947
|
+
colorBase: M,
|
|
1947
1948
|
multiplyChannels: 0,
|
|
1948
|
-
uvTransform:
|
|
1949
|
+
uvTransform: N
|
|
1949
1950
|
}), null);
|
|
1950
1951
|
break;
|
|
1951
1952
|
case "shadowmap":
|
|
1952
1953
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1953
1954
|
texture: this.renderPassManager.screenSpaceShadowMapPass.shadowTexture,
|
|
1954
1955
|
blending: 0,
|
|
1955
|
-
colorTransform:
|
|
1956
|
-
colorBase:
|
|
1956
|
+
colorTransform: z,
|
|
1957
|
+
colorBase: M,
|
|
1957
1958
|
multiplyChannels: 0,
|
|
1958
|
-
uvTransform:
|
|
1959
|
+
uvTransform: N
|
|
1959
1960
|
}), null);
|
|
1960
1961
|
break;
|
|
1961
1962
|
case "shadowsoft":
|
|
@@ -1963,9 +1964,9 @@ var He = class e extends b {
|
|
|
1963
1964
|
texture: this.renderPassManager.shadowAndAoPass.aoAndSoftShadowRenderTarget.texture,
|
|
1964
1965
|
blending: 0,
|
|
1965
1966
|
colorTransform: K.shadowTransform,
|
|
1966
|
-
colorBase:
|
|
1967
|
+
colorBase: M,
|
|
1967
1968
|
multiplyChannels: 0,
|
|
1968
|
-
uvTransform:
|
|
1969
|
+
uvTransform: N
|
|
1969
1970
|
}), null);
|
|
1970
1971
|
break;
|
|
1971
1972
|
case "shadowdenoise":
|
|
@@ -1973,9 +1974,9 @@ var He = class e extends b {
|
|
|
1973
1974
|
texture: this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,
|
|
1974
1975
|
blending: 0,
|
|
1975
1976
|
colorTransform: K.shadowTransform,
|
|
1976
|
-
colorBase:
|
|
1977
|
+
colorBase: M,
|
|
1977
1978
|
multiplyChannels: 0,
|
|
1978
|
-
uvTransform:
|
|
1979
|
+
uvTransform: N
|
|
1979
1980
|
}), null);
|
|
1980
1981
|
break;
|
|
1981
1982
|
case "shadowfadein":
|
|
@@ -1983,9 +1984,9 @@ var He = class e extends b {
|
|
|
1983
1984
|
texture: this.renderPassManager.shadowAndAoPass.fadeRenderTarget.texture,
|
|
1984
1985
|
blending: 0,
|
|
1985
1986
|
colorTransform: K.shadowTransform,
|
|
1986
|
-
colorBase:
|
|
1987
|
+
colorBase: M,
|
|
1987
1988
|
multiplyChannels: 0,
|
|
1988
|
-
uvTransform:
|
|
1989
|
+
uvTransform: N
|
|
1989
1990
|
}), null);
|
|
1990
1991
|
break;
|
|
1991
1992
|
case "shadowandao":
|
|
@@ -2006,40 +2007,40 @@ var He = class e extends b {
|
|
|
2006
2007
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
2007
2008
|
texture: this.renderPassManager.aoPassMapTexture,
|
|
2008
2009
|
blending: 0,
|
|
2009
|
-
colorTransform:
|
|
2010
|
-
colorBase:
|
|
2010
|
+
colorTransform: B,
|
|
2011
|
+
colorBase: M,
|
|
2011
2012
|
multiplyChannels: 0,
|
|
2012
|
-
uvTransform:
|
|
2013
|
+
uvTransform: N
|
|
2013
2014
|
}), null);
|
|
2014
2015
|
break;
|
|
2015
2016
|
case "groundreflection":
|
|
2016
2017
|
this.passRenderer.renderScreenSpace(e, this.getSrgbToLinearCopyMaterial({
|
|
2017
2018
|
texture: this.renderPassManager.groundReflectionPass.reflectionRenderTarget.texture,
|
|
2018
2019
|
blending: 0,
|
|
2019
|
-
colorTransform:
|
|
2020
|
-
colorBase:
|
|
2020
|
+
colorTransform: B,
|
|
2021
|
+
colorBase: M,
|
|
2021
2022
|
multiplyChannels: 0,
|
|
2022
|
-
uvTransform:
|
|
2023
|
+
uvTransform: j
|
|
2023
2024
|
}), null);
|
|
2024
2025
|
break;
|
|
2025
2026
|
case "groundreflectionfinal":
|
|
2026
2027
|
this.passRenderer.renderScreenSpace(e, this.getSrgbToLinearCopyMaterial({
|
|
2027
2028
|
texture: this.renderPassManager.groundReflectionPass.intensityRenderTarget.texture,
|
|
2028
2029
|
blending: 0,
|
|
2029
|
-
colorTransform:
|
|
2030
|
-
colorBase:
|
|
2030
|
+
colorTransform: B,
|
|
2031
|
+
colorBase: M,
|
|
2031
2032
|
multiplyChannels: 0,
|
|
2032
|
-
uvTransform:
|
|
2033
|
+
uvTransform: j
|
|
2033
2034
|
}), null);
|
|
2034
2035
|
break;
|
|
2035
2036
|
case "bakedgroundshadow":
|
|
2036
2037
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
2037
2038
|
texture: this.renderPassManager.bakedGroundContactShadowPass.renderTarget.texture,
|
|
2038
2039
|
blending: 0,
|
|
2039
|
-
colorTransform:
|
|
2040
|
-
colorBase:
|
|
2040
|
+
colorTransform: B,
|
|
2041
|
+
colorBase: M,
|
|
2041
2042
|
multiplyChannels: 0,
|
|
2042
|
-
uvTransform:
|
|
2043
|
+
uvTransform: N
|
|
2043
2044
|
}), null);
|
|
2044
2045
|
break;
|
|
2045
2046
|
case "environmentmap":
|
|
@@ -2048,7 +2049,7 @@ var He = class e extends b {
|
|
|
2048
2049
|
case "lightsourcedetection":
|
|
2049
2050
|
if (this.scene.userData?.environmentDefinition) {
|
|
2050
2051
|
let t = this.renderPassManager.aspect, n = new a(-1, 1, 1 / t, -1 / t, -1, 1), r = this.scene.userData?.environmentDefinition.createDebugScene(e, this.scene, this.renderPassManager.screenSpaceShadowMapPass.parameters.maximumNumberOfLightSources);
|
|
2051
|
-
r.background = new
|
|
2052
|
+
r.background = new O(16777215), e.render(r, n);
|
|
2052
2053
|
}
|
|
2053
2054
|
break;
|
|
2054
2055
|
}
|
|
@@ -2116,15 +2117,15 @@ var He = class e extends b {
|
|
|
2116
2117
|
_initUniforms(e) {
|
|
2117
2118
|
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);
|
|
2118
2119
|
}
|
|
2119
|
-
}, zt = "\n#ifdef USE_AOMAP\n\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n\n#endif\n\n uniform highp sampler2D tAoPassMap;\n uniform float aoPassMapScale;\n uniform float aoPassMapIntensity;\n uniform float shPassMapIntensity;\n uniform sampler2D tReflectionPassMap;\n uniform float reflectionPassMapScale;\n uniform float reflectionPassMapIntensity;\n", Bt = "\n#ifndef AOPASSMAP_SWIZZLE\n #define AOPASSMAP_SWIZZLE rg\n#endif\n\nfloat ambientOcclusion = 1.0;\nfloat shadowValue = 1.0;\n\n#ifdef USE_AOMAP\n\n // reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n ambientOcclusion = texture2D( aoMap, vAoMapUv ).r;\n ambientOcclusion = ( ambientOcclusion - 1.0 ) * aoMapIntensity + 1.0;\n\n#endif\n\n vec4 aoAndShadowMap = texelFetch( tAoPassMap, ivec2( gl_FragCoord.xy * aoPassMapScale ), 0 );\n vec2 aoAndShadow = aoAndShadowMap.rg;\n float depthDelta = abs( dot(aoAndShadowMap.wz, vec2(1.0/1024.0)) - gl_FragCoord.z );\n const ivec2 aoOffsetArray[8] = ivec2[8](\n ivec2(1, 0), ivec2(-1, 0), ivec2(0, 1), ivec2(0, -1), ivec2(1, 1), ivec2(-1, 1), ivec2(1, -1), ivec2(-1, -1));\n for (int aoOffsetI = 0; aoOffsetI < 8; aoOffsetI++) {\n aoAndShadowMap = texelFetch( tAoPassMap, ivec2( gl_FragCoord.xy * aoPassMapScale ) + aoOffsetArray[aoOffsetI], 0 );\n float testDepthDelta = abs( dot(aoAndShadowMap.wz, vec2(1.0/1024.0)) - gl_FragCoord.z );\n if (testDepthDelta < depthDelta) {\n aoAndShadow = aoAndShadowMap.rg;\n depthDelta = testDepthDelta;\n }\n }\n\n float aoPassMapValue = aoPassMapIntensity < 0.0 ? 1.0 : max(0.0, (aoAndShadow.r - 1.0) * aoPassMapIntensity + 1.0);\n shadowValue = shPassMapIntensity < 0.0 ? 1.0 : max(0.0, (aoAndShadow.g - 1.0) * shPassMapIntensity + 1.0);\n\n #ifdef USE_REFLECTION_PASS_MAP\n\n ivec2 reflectionPassMapSize = textureSize( tReflectionPassMap, 0 );\n vec2 reflectionPassMapUv = vec2( gl_FragCoord.x * reflectionPassMapScale, float(reflectionPassMapSize.y) - gl_FragCoord.y * reflectionPassMapScale );\n vec4 reflectionPassMapColor = texture2D( tReflectionPassMap, reflectionPassMapUv / vec2(reflectionPassMapSize) );\n if (reflectionPassMapColor.a > 0.0) reflectionPassMapColor.rgb /= reflectionPassMapColor.a;\n vec3 diffuseReflectionPassMapColor = reflectionPassMapColor.rgb * material.diffuseColor;\n reflectedLight.indirectDiffuse += diffuseReflectionPassMapColor * reflectionPassMapColor.a * reflectionPassMapIntensity;\n //reflectedLight.indirectDiffuse = mix(reflectedLight.indirectDiffuse, diffuseReflectionPassMapColor, reflectionPassMapColor.a * reflectionPassMapIntensity);\n\n #endif\n\n #if defined ( USE_APPLY_AO_AND_SHADOW_TO_ALPHA )\n diffuseColor.a = 1.0 - (1.0 - diffuseColor.a) * aoPassMapValue * shadowValue;\n #else\n ambientOcclusion = min( ambientOcclusion, aoPassMapValue );\n #endif\n\n reflectedLight.indirectDiffuse *= ambientOcclusion * shadowValue;\n\n #if defined( USE_CLEARCOAT )\n clearcoatSpecularIndirect *= ambientOcclusion * shadowValue;\n #endif\n\n #if defined( USE_SHEEN )\n sheenSpecularIndirect *= ambientOcclusion * shadowValue;\n #endif\n\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\n float specularOcclusion = computeSpecularOcclusion( dotNV, ambientOcclusion * shadowValue, material.roughness );\n reflectedLight.indirectSpecular *= specularOcclusion;\n\n #ifdef USE_REFLECTION_PASS_MAP\n reflectedLight.indirectSpecular += material.specularColor * reflectionPassMapColor.rgb * reflectionPassMapColor.a * reflectionPassMapIntensity * specularOcclusion;\n #endif\n\n #endif\n", Vt = class extends
|
|
2120
|
+
}, 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 Le {
|
|
2120
2121
|
constructor(e, t = "tDiffuse") {
|
|
2121
|
-
super(), this.textureID = t, this.uniforms = null, this.material = null, e instanceof p ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms =
|
|
2122
|
+
super(), this.textureID = t, this.uniforms = null, this.material = null, e instanceof p ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms = T.clone(e.uniforms), this.material = new p({
|
|
2122
2123
|
name: e.name === void 0 ? "unspecified" : e.name,
|
|
2123
2124
|
defines: Object.assign({}, e.defines),
|
|
2124
2125
|
uniforms: this.uniforms,
|
|
2125
2126
|
vertexShader: e.vertexShader,
|
|
2126
2127
|
fragmentShader: e.fragmentShader
|
|
2127
|
-
})), this._fsQuad = new
|
|
2128
|
+
})), this._fsQuad = new Re(this.material);
|
|
2128
2129
|
}
|
|
2129
2130
|
render(e, t, n) {
|
|
2130
2131
|
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));
|
|
@@ -2161,7 +2162,7 @@ var He = class e extends b {
|
|
|
2161
2162
|
}
|
|
2162
2163
|
}, Wt = class extends ne {
|
|
2163
2164
|
constructor(e) {
|
|
2164
|
-
super(e), this.type =
|
|
2165
|
+
super(e), this.type = C;
|
|
2165
2166
|
}
|
|
2166
2167
|
setType(e) {
|
|
2167
2168
|
return this.type = e, this;
|
|
@@ -2177,16 +2178,16 @@ var He = class e extends b {
|
|
|
2177
2178
|
}, n, r);
|
|
2178
2179
|
}
|
|
2179
2180
|
parse(e) {
|
|
2180
|
-
let t = /TITLE +"([^"]*)"/,
|
|
2181
|
-
if (
|
|
2182
|
-
let
|
|
2183
|
-
if (
|
|
2181
|
+
let t = /TITLE +"([^"]*)"/, r = /LUT_3D_SIZE +(\d+)/, i = /DOMAIN_MIN +([\d.]+) +([\d.]+) +([\d.]+)/, a = /DOMAIN_MAX +([\d.]+) +([\d.]+) +([\d.]+)/, o = /^([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+) *$/gm, s = t.exec(e), c = s === null ? null : s[1];
|
|
2182
|
+
if (s = r.exec(e), s === null) throw Error("LUTCubeLoader: Missing LUT_3D_SIZE information");
|
|
2183
|
+
let l = Number(s[1]), d = l ** 3 * 4, f = this.type === 1009 ? new Uint8Array(d) : new Float32Array(d), p = new n(0, 0, 0), m = new n(1, 1, 1);
|
|
2184
|
+
if (s = i.exec(e), s !== null && p.set(Number(s[1]), Number(s[2]), Number(s[3])), s = a.exec(e), s !== null && m.set(Number(s[1]), Number(s[2]), Number(s[3])), p.x > m.x || p.y > m.y || p.z > m.z) throw Error("LUTCubeLoader: Invalid input domain");
|
|
2184
2185
|
let h = this.type === 1009 ? 255 : 1, g = 0;
|
|
2185
|
-
for (; (
|
|
2186
|
-
let _ = new
|
|
2187
|
-
return _.image.data = f, _.image.width =
|
|
2188
|
-
title:
|
|
2189
|
-
size:
|
|
2186
|
+
for (; (s = o.exec(e)) !== null;) f[g++] = Number(s[1]) * h, f[g++] = Number(s[2]) * h, f[g++] = Number(s[3]) * h, f[g++] = h;
|
|
2187
|
+
let _ = new A();
|
|
2188
|
+
return _.image.data = f, _.image.width = l, _.image.height = l, _.image.depth = l, _.type = this.type, _.magFilter = E, _.minFilter = E, _.wrapS = u, _.wrapT = u, _.wrapR = u, _.generateMipmaps = !1, _.needsUpdate = !0, {
|
|
2189
|
+
title: c,
|
|
2190
|
+
size: l,
|
|
2190
2191
|
domainMin: p,
|
|
2191
2192
|
domainMax: m,
|
|
2192
2193
|
texture3D: _
|
|
@@ -2197,7 +2198,7 @@ var He = class e extends b {
|
|
|
2197
2198
|
super(e), this.flip = !1;
|
|
2198
2199
|
}
|
|
2199
2200
|
load(e, t, n, r) {
|
|
2200
|
-
let i = new
|
|
2201
|
+
let i = new me(this.manager);
|
|
2201
2202
|
i.setCrossOrigin(this.crossOrigin), i.setPath(this.path), i.load(e, (n) => {
|
|
2202
2203
|
try {
|
|
2203
2204
|
let e;
|
|
@@ -2208,8 +2209,8 @@ var He = class e extends b {
|
|
|
2208
2209
|
}, n, r);
|
|
2209
2210
|
}
|
|
2210
2211
|
parse(e, t) {
|
|
2211
|
-
let n = new Uint8Array(e), r = new
|
|
2212
|
-
return r.image.data = n, r.image.width = t, r.image.height = t, r.image.depth = t, r.format = o, r.type =
|
|
2212
|
+
let n = new Uint8Array(e), r = new A();
|
|
2213
|
+
return r.image.data = n, r.image.width = t, r.image.height = t, r.image.depth = t, r.format = o, r.type = C, r.magFilter = E, r.minFilter = E, r.wrapS = u, r.wrapT = u, r.wrapR = u, r.generateMipmaps = !1, r.needsUpdate = !0, {
|
|
2213
2214
|
size: t,
|
|
2214
2215
|
texture3D: r
|
|
2215
2216
|
};
|
|
@@ -2233,7 +2234,7 @@ var He = class e extends b {
|
|
|
2233
2234
|
}
|
|
2234
2235
|
}, Kt = class extends ne {
|
|
2235
2236
|
constructor(e) {
|
|
2236
|
-
super(e), this.type =
|
|
2237
|
+
super(e), this.type = C;
|
|
2237
2238
|
}
|
|
2238
2239
|
setType(e) {
|
|
2239
2240
|
return this.type = e, this;
|
|
@@ -2265,8 +2266,8 @@ var He = class e extends b {
|
|
|
2265
2266
|
let t = e + 1, n = e + 2, r = e + 3;
|
|
2266
2267
|
m[e] = l[e] / p * h, m[t] = l[t] / p * h, m[n] = l[n] / p * h, m[r] = h;
|
|
2267
2268
|
}
|
|
2268
|
-
let g = new
|
|
2269
|
-
return g.image.data = m, g.image.width = s, g.image.height = s, g.image.depth = s, g.format = o, g.type = this.type, g.magFilter =
|
|
2269
|
+
let g = new A();
|
|
2270
|
+
return g.image.data = m, g.image.width = s, g.image.height = s, g.image.depth = s, g.format = o, g.type = this.type, g.magFilter = E, g.minFilter = E, g.wrapS = u, g.wrapT = u, g.wrapR = u, g.generateMipmaps = !1, g.needsUpdate = !0, {
|
|
2270
2271
|
size: s,
|
|
2271
2272
|
texture3D: g
|
|
2272
2273
|
};
|
|
@@ -2279,17 +2280,17 @@ var He = class e extends b {
|
|
|
2279
2280
|
},
|
|
2280
2281
|
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 }",
|
|
2281
2282
|
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 }"
|
|
2282
|
-
}, qt = class extends
|
|
2283
|
+
}, qt = class extends Le {
|
|
2283
2284
|
constructor() {
|
|
2284
|
-
super(), this.isOutputPass = !0, this.uniforms =
|
|
2285
|
+
super(), this.isOutputPass = !0, this.uniforms = T.clone($.uniforms), this.material = new f({
|
|
2285
2286
|
name: $.name,
|
|
2286
2287
|
uniforms: this.uniforms,
|
|
2287
2288
|
vertexShader: $.vertexShader,
|
|
2288
2289
|
fragmentShader: $.fragmentShader
|
|
2289
|
-
}), this._fsQuad = new
|
|
2290
|
+
}), this._fsQuad = new Re(this.material), this._outputColorSpace = null, this._toneMapping = null;
|
|
2290
2291
|
}
|
|
2291
2292
|
render(e, t, n) {
|
|
2292
|
-
this.uniforms.tDiffuse.value = n.texture, this.uniforms.toneMappingExposure.value = e.toneMappingExposure, (this._outputColorSpace !== e.outputColorSpace || this._toneMapping !== e.toneMapping) && (this._outputColorSpace = e.outputColorSpace, this._toneMapping = e.toneMapping, this.material.defines = {},
|
|
2293
|
+
this.uniforms.tDiffuse.value = n.texture, this.uniforms.toneMappingExposure.value = e.toneMappingExposure, (this._outputColorSpace !== e.outputColorSpace || this._toneMapping !== e.toneMapping) && (this._outputColorSpace = e.outputColorSpace, this._toneMapping = e.toneMapping, this.material.defines = {}, i.getTransfer(this._outputColorSpace) === "srgb" && (this.material.defines.SRGB_TRANSFER = ""), this._toneMapping === 1 ? this.material.defines.LINEAR_TONE_MAPPING = "" : this._toneMapping === 2 ? this.material.defines.REINHARD_TONE_MAPPING = "" : this._toneMapping === 3 ? this.material.defines.CINEON_TONE_MAPPING = "" : this._toneMapping === 4 ? this.material.defines.ACES_FILMIC_TONE_MAPPING = "" : this._toneMapping === 6 ? this.material.defines.AGX_TONE_MAPPING = "" : this._toneMapping === 7 ? this.material.defines.NEUTRAL_TONE_MAPPING = "" : this._toneMapping === 5 && (this.material.defines.CUSTOM_TONE_MAPPING = ""), this.material.needsUpdate = !0), this.renderToScreen === !0 ? (e.setRenderTarget(null), this._fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), this._fsQuad.render(e));
|
|
2293
2294
|
}
|
|
2294
2295
|
dispose() {
|
|
2295
2296
|
this.material.dispose(), this._fsQuad.dispose();
|
|
@@ -2360,7 +2361,7 @@ var He = class e extends b {
|
|
|
2360
2361
|
return this._sceneRenderer.debugOutput;
|
|
2361
2362
|
}
|
|
2362
2363
|
constructor(t, n) {
|
|
2363
|
-
this.materialsNeedUpdate = !0, this._passRenderer = new
|
|
2364
|
+
this.materialsNeedUpdate = !0, this._passRenderer = new je(), this._outlinePass = null, this._debugPass = null, this._cameraUpdate = new F(), this._cameraChanged = !0, this._noUpdateNeededCount = 0, this._noOStaticFrames = 0, this._maxSamples = 1, this._passUpdateStates = {
|
|
2364
2365
|
updateGroundReflection: !1,
|
|
2365
2366
|
updateGBuffer: !1,
|
|
2366
2367
|
updateScreenSpaceShadow: !1,
|
|
@@ -2375,9 +2376,9 @@ var He = class e extends b {
|
|
|
2375
2376
|
width: this._sceneRenderer.width,
|
|
2376
2377
|
height: this._sceneRenderer.height,
|
|
2377
2378
|
samples: i,
|
|
2378
|
-
textureMinificationFilter: r ?
|
|
2379
|
-
textureMagnificationFilter: r ?
|
|
2380
|
-
}), this._groundReflectionPass = new ct(this, this._sceneRenderer.width, this._sceneRenderer.height, this._maxSamples, {}), this._screenSpaceShadowMapPass = new vt(this, new
|
|
2379
|
+
textureMinificationFilter: r ? E : y,
|
|
2380
|
+
textureMagnificationFilter: r ? E : y
|
|
2381
|
+
}), this._groundReflectionPass = new ct(this, this._sceneRenderer.width, this._sceneRenderer.height, this._maxSamples, {}), this._screenSpaceShadowMapPass = new vt(this, new d(this._sceneRenderer.width, this._sceneRenderer.height), {
|
|
2381
2382
|
samples: a,
|
|
2382
2383
|
alwaysUpdate: !1
|
|
2383
2384
|
}), this._shadowAndAoPass = new K(this, this._sceneRenderer.width, this._sceneRenderer.height, i), this._lutPass = new Ut({
|
|
@@ -2409,19 +2410,19 @@ var He = class e extends b {
|
|
|
2409
2410
|
});
|
|
2410
2411
|
}
|
|
2411
2412
|
createOutlinePass() {
|
|
2412
|
-
return this._outlinePass ||= new Et(this, new
|
|
2413
|
+
return this._outlinePass ||= new Et(this, new d(this._sceneRenderer.width, this._sceneRenderer.height), this.scene, this.camera, [], {
|
|
2413
2414
|
downSampleRatio: 2,
|
|
2414
2415
|
edgeDetectionFxaa: !0
|
|
2415
2416
|
}), this._outlinePass;
|
|
2416
2417
|
}
|
|
2417
2418
|
getRenderPassRenderTarget(e) {
|
|
2418
|
-
return this._lutPassParameters.enabled ? (this._passRenderTarget = this._passRenderTarget ?? new
|
|
2419
|
+
return this._lutPassParameters.enabled ? (this._passRenderTarget = this._passRenderTarget ?? new r(this._sceneRenderer.width * e.getPixelRatio(), this._sceneRenderer.height * e.getPixelRatio(), {
|
|
2419
2420
|
type: 1016,
|
|
2420
2421
|
samples: this._maxSamples
|
|
2421
2422
|
}), this._passRenderTarget) : null;
|
|
2422
2423
|
}
|
|
2423
2424
|
getPostPassRenderTarget(e) {
|
|
2424
|
-
return this._lutPassParameters.enabled ? (this._passPassRenderTarget = this._passPassRenderTarget ?? new
|
|
2425
|
+
return this._lutPassParameters.enabled ? (this._passPassRenderTarget = this._passPassRenderTarget ?? new r(this._sceneRenderer.width * e.getPixelRatio(), this._sceneRenderer.height * e.getPixelRatio(), { type: 1016 }), this._passPassRenderTarget) : null;
|
|
2425
2426
|
}
|
|
2426
2427
|
setGroundVisibility(e) {
|
|
2427
2428
|
this._sceneRenderer.shadowAndAoGroundPlane.setVisibility(e);
|
|
@@ -2573,7 +2574,7 @@ var Xt = {
|
|
|
2573
2574
|
return this._shadowAndAoGroundPlane;
|
|
2574
2575
|
}
|
|
2575
2576
|
constructor(e, t, n, r, i) {
|
|
2576
|
-
this.debugOutput = "off", this.outputColorSpace = "", this.toneMapping = "", this.linearAoFilter = !0, this.environmentLights = !1, this.enableObjectSelection = !0, this.groundLevel = 0, this.uiInteractionMode = !1, this.width = 0, this.height = 0, this.boundingVolume = new
|
|
2577
|
+
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 Oe(), this.boundingVolumeSet = !1, this.renderCacheManager = new Ze(), this.selectedObjects = [], this.groundGroup = new fe(), this._shadingType = Pe.DEFAULT, this._qualityLevel = Xt.HIGHEST, this._qualityMap = /* @__PURE__ */ new Map(), this._customShadingParameters = null, this._creator_ = e, this.width = n, this.height = r, this.linearAoFilter = i ?? !0, this.renderer = t, this.renderCacheManager.registerCache("inivisibleGround", new Y((e) => e === this.groundGroup)), this.renderCacheManager.registerCache("groundReflection", new Y((e) => e === this.groundGroup || e.name === "dimensioning" ? !0 : !!(e instanceof b && J(e.material)))), this.renderCacheManager.registerCache("debug", new Y()), this.renderCacheManager.registerCache("floorDepthWrite", new Qe((e) => e.userData?.isFloor)), this._shadowAndAoGroundPlane = new He(null), this.groundGroup.rotateX(-Math.PI / 2), this._renderPassManager = new Yt(e, this), this.outlineRenderer = new Ye(this._renderPassManager, null, {}), this.parameters = {
|
|
2577
2578
|
gBufferRenderTargetParameters: this.gBufferRenderPass.parameters,
|
|
2578
2579
|
bakedGroundContactShadowParameters: this.bakedGroundContactShadowPass.parameters,
|
|
2579
2580
|
screenSpaceShadowMapParameters: this.screenSpaceShadowMapPass.parameters,
|
|
@@ -2629,10 +2630,10 @@ var Xt = {
|
|
|
2629
2630
|
applyCurrentParameters() {
|
|
2630
2631
|
let e = [];
|
|
2631
2632
|
this._qualityMap.has(this._qualityLevel) && e.push(this._qualityMap.get(this._qualityLevel));
|
|
2632
|
-
let t =
|
|
2633
|
+
let t = Me(this._shadingType);
|
|
2633
2634
|
t && e.push(t);
|
|
2634
|
-
let n =
|
|
2635
|
-
if (n && e.push(n), this._customShadingParameters && e.push(
|
|
2635
|
+
let n = ke(this.uiInteractionMode);
|
|
2636
|
+
if (n && e.push(n), this._customShadingParameters && e.push(De(this._customShadingParameters)), this._customOutlineParameters && e.push({ outlineParameters: {
|
|
2636
2637
|
visibleEdgeColor: this._customOutlineParameters.outlineVisibleEdgeColor,
|
|
2637
2638
|
hiddenEdgeColor: this._customOutlineParameters.outlineHiddenEdgeColor
|
|
2638
2639
|
} }), e.length > 0) {
|
|
@@ -2706,4 +2707,4 @@ Ve([Be, ze("design:type", Object)], Zt.prototype, "_initData", void 0);
|
|
|
2706
2707
|
//#endregion
|
|
2707
2708
|
export { ft as a, Mt as i, Zt as n, W as o, Q as r, Xt as t };
|
|
2708
2709
|
|
|
2709
|
-
//# sourceMappingURL=scene-renderer-
|
|
2710
|
+
//# sourceMappingURL=scene-renderer-CAzAJ4pS.mjs.map
|