@roomle/web-sdk 3.6.0 → 3.7.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-DLEagG41.mjs → BufferGeometry-BLeRuMkh.mjs} +1 -1
- package/lib/{BufferGeometry-DLEagG41.mjs.map → BufferGeometry-BLeRuMkh.mjs.map} +1 -1
- package/lib/ConfiguratorKernel.js +54 -73
- package/lib/ConfiguratorKernel.wasm +0 -0
- package/lib/{GLTFExporter-D8qsdwDK.mjs → GLTFExporter-CFXCqoLa.mjs} +141 -141
- package/lib/{GLTFExporter-D8qsdwDK.mjs.map → GLTFExporter-CFXCqoLa.mjs.map} +1 -1
- package/lib/{PointLightHelper-BnjxGaOG.mjs → PointLightHelper-BEJEy6l_.mjs} +2 -2
- package/lib/{PointLightHelper-BnjxGaOG.mjs.map → PointLightHelper-BEJEy6l_.mjs.map} +1 -1
- package/lib/RoomleCore.js +59 -79
- package/lib/RoomleCore.wasm +0 -0
- package/lib/RoomleToolsCore.js +54 -74
- package/lib/RoomleToolsCore.wasm +0 -0
- package/lib/{SpotLightHelper-DqsfqCrs.mjs → SpotLightHelper-aXFW8qaJ.mjs} +2 -2
- package/lib/{SpotLightHelper-DqsfqCrs.mjs.map → SpotLightHelper-aXFW8qaJ.mjs.map} +1 -1
- package/lib/{USDZExporter-DxIqi8St.mjs → USDZExporter-B4hsiwhd.mjs} +2 -2
- package/lib/{USDZExporter-DxIqi8St.mjs.map → USDZExporter-B4hsiwhd.mjs.map} +1 -1
- package/lib/{api-xDJ-Uyom.mjs → api-C2-6Jm5W.mjs} +2 -2
- package/lib/{api-xDJ-Uyom.mjs.map → api-C2-6Jm5W.mjs.map} +1 -1
- package/lib/{banana-for-scale-C_iNmlCT.mjs → banana-for-scale-BV_na-g3.mjs} +4 -4
- package/lib/banana-for-scale-BV_na-g3.mjs.map +1 -0
- package/lib/chunk-C97zSiVS.mjs +20 -0
- package/lib/{common-utils-DMSTohiS.mjs → common-utils-qErzZAiR.mjs} +2 -2
- package/lib/common-utils-qErzZAiR.mjs.map +1 -0
- package/lib/{component-dimensioning-CvRmUja4.mjs → component-dimensioning-DCQTqssC.mjs} +49 -49
- package/lib/{component-dimensioning-CvRmUja4.mjs.map → component-dimensioning-DCQTqssC.mjs.map} +1 -1
- package/lib/{component-raycast-helper-CEp7wy9c.mjs → component-raycast-helper-B3WXp3oq.mjs} +20 -24
- package/lib/component-raycast-helper-B3WXp3oq.mjs.map +1 -0
- package/lib/configurator-CrNkzBp9.mjs +2 -0
- package/lib/configurator-Dx6kcXY_.mjs +45 -0
- package/lib/{configurator-CmuhFgC9.mjs.map → configurator-Dx6kcXY_.mjs.map} +1 -1
- package/lib/{continuous-drawing-helper-v_5UAM9A.mjs → continuous-drawing-helper-DzULJ9d1.mjs} +12 -12
- package/lib/continuous-drawing-helper-DzULJ9d1.mjs.map +1 -0
- package/lib/{decorate-C1QnXPYw.mjs → decorate-BIflHDAa.mjs} +1 -1
- package/lib/{decorate-C1QnXPYw.mjs.map → decorate-BIflHDAa.mjs.map} +1 -1
- package/lib/{dimensioning-helper-Fwpt1HTT.mjs → dimensioning-helper-Cj20VTW0.mjs} +66 -57
- package/lib/{dimensioning-helper-Fwpt1HTT.mjs.map → dimensioning-helper-Cj20VTW0.mjs.map} +1 -1
- package/lib/{glb-viewer-BzNA9-zH.mjs → glb-viewer-BqFcaUlb.mjs} +52 -52
- package/lib/glb-viewer-BqFcaUlb.mjs.map +1 -0
- package/lib/glb-viewer-FYw7R-ya.mjs +2 -0
- package/lib/{homag-intelligence-BwGjJEws.mjs → homag-intelligence-Dkz0AhB4.mjs} +3 -3
- package/lib/{homag-intelligence-BwGjJEws.mjs.map → homag-intelligence-Dkz0AhB4.mjs.map} +1 -1
- package/lib/{imos-ix-poc-export-helper-CQh94HsO.mjs → imos-ix-poc-export-helper-BjIgAfUu.mjs} +4 -3
- package/lib/imos-ix-poc-export-helper-BjIgAfUu.mjs.map +1 -0
- package/lib/kernel-BAQSG9r5.mjs.map +1 -1
- package/lib/{kernel-utils-H74uNY1h.mjs → kernel-utils-CfGzR_WC.mjs} +15 -15
- package/lib/{kernel-utils-H74uNY1h.mjs.map → kernel-utils-CfGzR_WC.mjs.map} +1 -1
- package/lib/{layer-C_JtkhdO.mjs → layer-CFAr2mK_.mjs} +1 -1
- package/lib/{layer-C_JtkhdO.mjs.map → layer-CFAr2mK_.mjs.map} +1 -1
- package/lib/{main-CtVIB52l.mjs → main-DMIVdAcT.mjs} +14471 -14300
- package/lib/main-DMIVdAcT.mjs.map +1 -0
- package/lib/{material-viewer-Bq4smZ6f.mjs → material-viewer-BkwvhHbQ.mjs} +40 -40
- package/lib/material-viewer-BkwvhHbQ.mjs.map +1 -0
- package/lib/planner-BPlxsTRJ.mjs +44 -0
- package/lib/{planner-CVw_xzGh.mjs.map → planner-BPlxsTRJ.mjs.map} +1 -1
- package/lib/planner-oj08ktHE.mjs +2 -0
- package/lib/{plugin-system-D9K46xJk.mjs → plugin-system-XhOJU1MI.mjs} +3 -3
- package/lib/{plugin-system-D9K46xJk.mjs.map → plugin-system-XhOJU1MI.mjs.map} +1 -1
- package/lib/roomle-renderer-BwPvUqSW.mjs +49 -0
- package/lib/roomle-renderer-BwPvUqSW.mjs.map +1 -0
- package/lib/roomle-sdk.d.ts +114 -1116
- package/lib/roomle-sdk.js +6 -6
- package/lib/roomle-webgpu-renderer-CSC5zFdC.mjs +217 -0
- package/lib/roomle-webgpu-renderer-CSC5zFdC.mjs.map +1 -0
- package/lib/{scene-renderer-D8HkTFeZ.mjs → scene-renderer-DWY_zPvU.mjs} +496 -513
- package/lib/scene-renderer-DWY_zPvU.mjs.map +1 -0
- package/lib/{script-loader-D8xCRzTr.mjs → script-loader-CA-XHFKN.mjs} +3 -3
- package/lib/{script-loader-D8xCRzTr.mjs.map → script-loader-CA-XHFKN.mjs.map} +1 -1
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/package.json +1 -1
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/configuratorCoreInterface.d.ts +0 -1
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/plannerCoreInterface.d.ts +3 -3
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/ConfiguratorKernel.js +54 -73
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/ConfiguratorKernel.wasm +0 -0
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleCore.js +59 -79
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleCore.wasm +0 -0
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleToolsCore.js +54 -74
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleToolsCore.wasm +0 -0
- package/lib/{stats-helper-HM0TaIM5.mjs → stats-helper-C954Cfgh.mjs} +4 -3
- package/lib/{stats-helper-HM0TaIM5.mjs.map → stats-helper-C954Cfgh.mjs.map} +1 -1
- package/lib/{three.core-CLIofecG.mjs → three.core-mM-jZdgg.mjs} +926 -926
- package/lib/{three.core-CLIofecG.mjs.map → three.core-mM-jZdgg.mjs.map} +1 -1
- package/lib/{three.module-C4Q1skJQ.mjs → three.module-Bmy3sVQ-.mjs} +1210 -1210
- package/lib/{three.module-C4Q1skJQ.mjs.map → three.module-Bmy3sVQ-.mjs.map} +1 -1
- package/lib/{three.webgpu-dFspy2yF.mjs → three.webgpu-0l2TztLa.mjs} +5355 -2935
- package/lib/{three.webgpu-dFspy2yF.mjs.map → three.webgpu-0l2TztLa.mjs.map} +1 -1
- package/lib/{threejs-utils-jEzvlJF1.mjs → threejs-utils-8zlxt158.mjs} +430 -431
- package/lib/threejs-utils-8zlxt158.mjs.map +1 -0
- package/lib/{tools-core-Bf9WsK5v.mjs → tools-core-BzhFD2Wk.mjs} +3 -3
- package/lib/{tools-core-Bf9WsK5v.mjs.map → tools-core-BzhFD2Wk.mjs.map} +1 -1
- package/package.json +1 -1
- package/lib/banana-for-scale-C_iNmlCT.mjs.map +0 -1
- package/lib/common-utils-DMSTohiS.mjs.map +0 -1
- package/lib/component-raycast-helper-CEp7wy9c.mjs.map +0 -1
- package/lib/configurator-BaUt4_LF.mjs +0 -2
- package/lib/configurator-CmuhFgC9.mjs +0 -45
- package/lib/continuous-drawing-helper-v_5UAM9A.mjs.map +0 -1
- package/lib/dimensioning-helper-DTcW85Oq.mjs +0 -2
- package/lib/glb-viewer-BzNA9-zH.mjs.map +0 -1
- package/lib/glb-viewer-DOxBD5k-.mjs +0 -2
- package/lib/imos-ix-poc-export-helper-CQh94HsO.mjs.map +0 -1
- package/lib/main-CtVIB52l.mjs.map +0 -1
- package/lib/material-viewer-Bq4smZ6f.mjs.map +0 -1
- package/lib/planner-CVw_xzGh.mjs +0 -44
- package/lib/planner-si70gWA2.mjs +0 -2
- package/lib/scene-renderer-D8HkTFeZ.mjs.map +0 -1
- package/lib/threejs-utils-jEzvlJF1.mjs.map +0 -1
|
@@ -1,43 +1,28 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import "./
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
for (var r in e) H(n, r, {
|
|
10
|
-
get: e[r],
|
|
11
|
-
enumerable: !0
|
|
12
|
-
});
|
|
13
|
-
return t || H(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
14
|
-
}, Se = (e, t, n, r) => {
|
|
15
|
-
if (t && typeof t == "object" || typeof t == "function") for (var i = _e(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !ye.call(e, s) && s !== n && H(e, s, {
|
|
16
|
-
get: ((e) => t[e]).bind(null, s),
|
|
17
|
-
enumerable: !(r = ge(t, s)) || r.enumerable
|
|
18
|
-
});
|
|
19
|
-
return e;
|
|
20
|
-
}, Ce = (e, t, n) => (n = e == null ? {} : he(ve(e)), Se(t || !e || !e.__esModule ? H(n, "default", {
|
|
21
|
-
value: e,
|
|
22
|
-
enumerable: !0
|
|
23
|
-
}) : n, e)), we = {
|
|
1
|
+
import { $t as e, B as t, Bt as n, C as r, Dn as i, Hr as a, J as o, Kt as s, Or as c, R as l, Rt as u, Si as d, T as f, Ti as p, Tn as m, Ur as h, Vr as g, Wn as _, X as v, ai as y, an as b, bi as x, cn as S, d as C, di as w, dn as T, fi as E, gn as D, hn as O, it as ee, jr as k, kn as te, ln as ne, m as A, mi as j, mn as M, mt as N, oi as re, on as P, ot as ie, pn as ae, pt as F, q as I, rn as L, sn as R, st as oe, ti as se, v as ce, wr as le, x as z, xi as B, yn as V } from "./three.core-mM-jZdgg.mjs";
|
|
2
|
+
import { r as ue } from "./three.module-Bmy3sVQ-.mjs";
|
|
3
|
+
import { A as de } from "./threejs-utils-8zlxt158.mjs";
|
|
4
|
+
import { h as fe } from "./common-utils-qErzZAiR.mjs";
|
|
5
|
+
import { n as pe, r as me, t as he } from "./decorate-BIflHDAa.mjs";
|
|
6
|
+
import "./dimensioning-helper-Cj20VTW0.mjs";
|
|
7
|
+
//#region packages/common-core/src/webgl/renderer/shader-utility.ts
|
|
8
|
+
var ge = {
|
|
24
9
|
uniforms: {
|
|
25
10
|
tDiffuse: { value: null },
|
|
26
|
-
colorTransform: { value: new
|
|
27
|
-
colorBase: { value: new
|
|
11
|
+
colorTransform: { value: new P() },
|
|
12
|
+
colorBase: { value: new d(0, 0, 0, 0) },
|
|
28
13
|
multiplyChannels: { value: 0 },
|
|
29
|
-
uvTransform: { value: new
|
|
14
|
+
uvTransform: { value: new b() }
|
|
30
15
|
},
|
|
31
16
|
vertexShader: "\n varying vec2 vUv;\n uniform mat3 uvTransform;\n\n void main() {\n vUv = (uvTransform * vec3(uv, 1.0)).xy;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",
|
|
32
17
|
fragmentShader: "\n uniform sampler2D tDiffuse;\n uniform mat4 colorTransform;\n uniform vec4 colorBase;\n uniform float multiplyChannels;\n varying vec2 vUv;\n\n void main() {\n vec4 color = texture2D(tDiffuse, vUv);\n #if PREMULTIPLIED_ALPHA == 1\n if (color.a > 0.0) color.rgb /= color.a;\n #endif\n color = colorTransform * color + colorBase;\n color.rgb = mix(color.rgb, vec3(color.r * color.g * color.b), multiplyChannels);\n #if LINEAR_TO_SRGB == 1\n color.rgb = mix(color.rgb * 12.92, 1.055 * pow(color.rgb, vec3(0.41666)) - 0.055, step(0.0031308, color.rgb));\n #endif\n gl_FragColor = color;\n }"
|
|
33
|
-
},
|
|
34
|
-
new
|
|
35
|
-
var U = new
|
|
18
|
+
}, H = new P(), _e = new P().set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0), ve = new P().set(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0), ye = new P().set(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1);
|
|
19
|
+
new P().set(0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1), new P().set(0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
|
20
|
+
var U = new P().set(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1), W = new d(0, 0, 0, 0), G = new d(0, 0, 0, 1), K = new b(), be = new b().set(1, 0, 0, 0, -1, 1, 0, 0, 1), xe = {
|
|
36
21
|
DEFAULT: "default",
|
|
37
22
|
ADDITIVE: "additive"
|
|
38
|
-
},
|
|
39
|
-
constructor(e, t =
|
|
40
|
-
let i = t ===
|
|
23
|
+
}, Se = class extends a {
|
|
24
|
+
constructor(e, t = xe.ADDITIVE, n = !1, r = !1) {
|
|
25
|
+
let i = t === xe.ADDITIVE ? {
|
|
41
26
|
blendSrc: 208,
|
|
42
27
|
blendDst: 200,
|
|
43
28
|
blendEquation: 100,
|
|
@@ -46,9 +31,9 @@ var U = new v().set(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1), W = new B(0
|
|
|
46
31
|
blendEquationAlpha: 100
|
|
47
32
|
} : {};
|
|
48
33
|
super({
|
|
49
|
-
uniforms:
|
|
50
|
-
vertexShader:
|
|
51
|
-
fragmentShader:
|
|
34
|
+
uniforms: w.clone(ge.uniforms),
|
|
35
|
+
vertexShader: ge.vertexShader,
|
|
36
|
+
fragmentShader: ge.fragmentShader,
|
|
52
37
|
defines: {
|
|
53
38
|
LINEAR_TO_SRGB: n ? 1 : 0,
|
|
54
39
|
PREMULTIPLIED_ALPHA: r ? 1 : 0
|
|
@@ -62,22 +47,22 @@ var U = new v().set(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1), W = new B(0
|
|
|
62
47
|
update(e) {
|
|
63
48
|
return e?.texture !== void 0 && (this.uniforms.tDiffuse.value = e?.texture), e?.colorTransform !== void 0 && (this.uniforms.colorTransform.value = e?.colorTransform), e?.colorBase !== void 0 && (this.uniforms.colorBase.value = e?.colorBase), e?.multiplyChannels !== void 0 && (this.uniforms.multiplyChannels.value = e?.multiplyChannels), e?.uvTransform !== void 0 && (this.uniforms.uvTransform.value = e?.uvTransform), e?.blending !== void 0 && (this.blending = e?.blending), e?.blendSrc !== void 0 && (this.blendSrc = e?.blendSrc), e?.blendDst !== void 0 && (this.blendDst = e?.blendDst), e?.blendEquation !== void 0 && (this.blendEquation = e?.blendEquation), e?.blendSrcAlpha !== void 0 && (this.blendSrcAlpha = e?.blendSrcAlpha), e?.blendDstAlpha !== void 0 && (this.blendDstAlpha = e?.blendDstAlpha), e?.blendEquationAlpha !== void 0 && (this.blendEquationAlpha = e?.blendEquationAlpha), this;
|
|
64
49
|
}
|
|
65
|
-
},
|
|
50
|
+
}, Ce = {
|
|
66
51
|
uniforms: {
|
|
67
52
|
tDiffuse: { value: null },
|
|
68
|
-
rangeMin: { value: new
|
|
69
|
-
rangeMax: { value: new
|
|
53
|
+
rangeMin: { value: new x(1 / 512, 1 / 512) },
|
|
54
|
+
rangeMax: { value: new x(1 / 512, 1 / 512) }
|
|
70
55
|
},
|
|
71
56
|
vertexShader: "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",
|
|
72
57
|
fragmentShader: "\n uniform sampler2D tDiffuse;\n uniform vec2 rangeMin;\n uniform vec2 rangeMax;\n varying vec2 vUv;\n\n void main() {\n vec4 baseColor = texture2D(tDiffuse, vUv);\n vec2 blur = mix(rangeMax, rangeMin, baseColor.a);\n vec4 sum = vec4( 0.0 );\n sum += texture2D(tDiffuse, vUv - 1.0 * blur) * 0.051;\n sum += texture2D(tDiffuse, vUv - 0.75 * blur) * 0.0918;\n sum += texture2D(tDiffuse, vUv - 0.5 * blur) * 0.12245;\n sum += texture2D(tDiffuse, vUv - 0.25 * blur) * 0.1531;\n sum += baseColor * 0.1633;\n sum += texture2D(tDiffuse, vUv + 0.25 * blur) * 0.1531;\n sum += texture2D(tDiffuse, vUv + 0.5 * blur) * 0.12245;\n sum += texture2D(tDiffuse, vUv + 0.75 * blur) * 0.0918;\n sum += texture2D(tDiffuse, vUv + 1.0 * blur) * 0.051;\n gl_FragColor = sum;\n }"
|
|
73
58
|
};
|
|
74
|
-
new
|
|
75
|
-
var
|
|
59
|
+
new x(.1, .9), new x(.1, .9);
|
|
60
|
+
var we = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }", Te = "uniform sampler2D tDepth;\n uniform vec4 depthFilter;\n uniform float cameraNear;\n uniform float cameraFar;\n varying vec2 vUv;\n\n #include <packing>\n\n float getLinearDepth(const in vec2 screenPosition) {\n float fragCoordZ = dot(texture2D(tDepth, screenPosition), depthFilter);\n #if PERSPECTIVE_CAMERA == 1\n float viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\n return viewZToOrthographicDepth(viewZ, cameraNear, cameraFar);\n #else\n return fragCoordZ;\n #endif\n }\n\n void main() {\n float depth = getLinearDepth(vUv);\n gl_FragColor = vec4(vec3(1.0 - depth), 1.0);\n }", Ee = class e extends a {
|
|
76
61
|
static {
|
|
77
62
|
this._linearDepthShader = {
|
|
78
63
|
uniforms: {
|
|
79
64
|
tDepth: { value: null },
|
|
80
|
-
depthFilter: { value: new
|
|
65
|
+
depthFilter: { value: new d(1, 0, 0, 0) },
|
|
81
66
|
cameraNear: { value: .1 },
|
|
82
67
|
cameraFar: { value: 1 }
|
|
83
68
|
},
|
|
@@ -85,14 +70,14 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
85
70
|
PERSPECTIVE_CAMERA: 1,
|
|
86
71
|
ALPHA_DEPTH: 0
|
|
87
72
|
},
|
|
88
|
-
vertexShader:
|
|
89
|
-
fragmentShader:
|
|
73
|
+
vertexShader: we,
|
|
74
|
+
fragmentShader: Te
|
|
90
75
|
};
|
|
91
76
|
}
|
|
92
77
|
constructor(t) {
|
|
93
78
|
super({
|
|
94
79
|
defines: Object.assign({}, e._linearDepthShader.defines),
|
|
95
|
-
uniforms:
|
|
80
|
+
uniforms: w.clone(e._linearDepthShader.uniforms),
|
|
96
81
|
vertexShader: e._linearDepthShader.vertexShader,
|
|
97
82
|
fragmentShader: e._linearDepthShader.fragmentShader,
|
|
98
83
|
blending: 0
|
|
@@ -105,7 +90,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
105
90
|
}
|
|
106
91
|
return e?.depthFilter !== void 0 && (this.uniforms.depthFilter.value = e?.depthFilter), this;
|
|
107
92
|
}
|
|
108
|
-
},
|
|
93
|
+
}, q = class {
|
|
109
94
|
constructor() {
|
|
110
95
|
this.isPass = !0, this.enabled = !0, this.needsSwap = !0, this.clear = !1, this.renderToScreen = !1;
|
|
111
96
|
}
|
|
@@ -114,9 +99,9 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
114
99
|
console.error("THREE.Pass: .render() must be implemented in derived pass.");
|
|
115
100
|
}
|
|
116
101
|
dispose() {}
|
|
117
|
-
},
|
|
102
|
+
}, De = new m(-1, 1, 1, -1, 0, 1), Oe = new class extends A {
|
|
118
103
|
constructor() {
|
|
119
|
-
super(), this.setAttribute("position", new
|
|
104
|
+
super(), this.setAttribute("position", new ie([
|
|
120
105
|
-1,
|
|
121
106
|
3,
|
|
122
107
|
0,
|
|
@@ -126,7 +111,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
126
111
|
3,
|
|
127
112
|
-1,
|
|
128
113
|
0
|
|
129
|
-
], 3)), this.setAttribute("uv", new
|
|
114
|
+
], 3)), this.setAttribute("uv", new ie([
|
|
130
115
|
0,
|
|
131
116
|
2,
|
|
132
117
|
0,
|
|
@@ -135,15 +120,15 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
135
120
|
0
|
|
136
121
|
], 2));
|
|
137
122
|
}
|
|
138
|
-
}(),
|
|
123
|
+
}(), ke = class {
|
|
139
124
|
constructor(e) {
|
|
140
|
-
this._mesh = new
|
|
125
|
+
this._mesh = new R(Oe, e);
|
|
141
126
|
}
|
|
142
127
|
dispose() {
|
|
143
128
|
this._mesh.geometry.dispose();
|
|
144
129
|
}
|
|
145
130
|
render(e) {
|
|
146
|
-
e.render(this._mesh,
|
|
131
|
+
e.render(this._mesh, De);
|
|
147
132
|
}
|
|
148
133
|
get material() {
|
|
149
134
|
return this._mesh.material;
|
|
@@ -151,7 +136,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
151
136
|
set material(e) {
|
|
152
137
|
this._mesh.material = e;
|
|
153
138
|
}
|
|
154
|
-
},
|
|
139
|
+
}, Ae = class {
|
|
155
140
|
constructor(e = Math) {
|
|
156
141
|
this.grad3 = [
|
|
157
142
|
[
|
|
@@ -811,26 +796,26 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
811
796
|
noise3d(e, t, n) {
|
|
812
797
|
let r, i, a, o, s = (e + t + n) * (1 / 3), c = Math.floor(e + s), l = Math.floor(t + s), u = Math.floor(n + s), d = 1 / 6, f = (c + l + u) * d, p = c - f, m = l - f, h = u - f, g = e - p, _ = t - m, v = n - h, y, b, x, S, C, w;
|
|
813
798
|
g >= _ ? _ >= v ? (y = 1, b = 0, x = 0, S = 1, C = 1, w = 0) : g >= v ? (y = 1, b = 0, x = 0, S = 1, C = 0, w = 1) : (y = 0, b = 0, x = 1, S = 1, C = 0, w = 1) : _ < v ? (y = 0, b = 0, x = 1, S = 0, C = 1, w = 1) : g < v ? (y = 0, b = 1, x = 0, S = 0, C = 1, w = 1) : (y = 0, b = 1, x = 0, S = 1, C = 1, w = 0);
|
|
814
|
-
let T = g - y + d, E = _ - b + d, D = v - x + d, O = g - S + 2 * d, ee = _ - C + 2 * d,
|
|
815
|
-
F < 0 ? r = 0 : (F *= F, r = F * F * this._dot3(this.grad3[
|
|
799
|
+
let T = g - y + d, E = _ - b + d, D = v - x + d, O = g - S + 2 * d, ee = _ - C + 2 * d, k = v - w + 2 * d, te = g - 1 + 3 * d, ne = _ - 1 + 3 * d, A = v - 1 + 3 * d, j = c & 255, M = l & 255, N = u & 255, re = this.perm[j + this.perm[M + this.perm[N]]] % 12, P = this.perm[j + y + this.perm[M + b + this.perm[N + x]]] % 12, ie = this.perm[j + S + this.perm[M + C + this.perm[N + w]]] % 12, ae = this.perm[j + 1 + this.perm[M + 1 + this.perm[N + 1]]] % 12, F = .6 - g * g - _ * _ - v * v;
|
|
800
|
+
F < 0 ? r = 0 : (F *= F, r = F * F * this._dot3(this.grad3[re], g, _, v));
|
|
816
801
|
let I = .6 - T * T - E * E - D * D;
|
|
817
|
-
I < 0 ? i = 0 : (I *= I, i = I * I * this._dot3(this.grad3[
|
|
818
|
-
let L = .6 - O * O - ee * ee -
|
|
819
|
-
L < 0 ? a = 0 : (L *= L, a = L * L * this._dot3(this.grad3[
|
|
820
|
-
let R = .6 -
|
|
821
|
-
return R < 0 ? o = 0 : (R *= R, o = R * R * this._dot3(this.grad3[ae],
|
|
802
|
+
I < 0 ? i = 0 : (I *= I, i = I * I * this._dot3(this.grad3[P], T, E, D));
|
|
803
|
+
let L = .6 - O * O - ee * ee - k * k;
|
|
804
|
+
L < 0 ? a = 0 : (L *= L, a = L * L * this._dot3(this.grad3[ie], O, ee, k));
|
|
805
|
+
let R = .6 - te * te - ne * ne - A * A;
|
|
806
|
+
return R < 0 ? o = 0 : (R *= R, o = R * R * this._dot3(this.grad3[ae], te, ne, A)), 32 * (r + i + a + o);
|
|
822
807
|
}
|
|
823
808
|
noise4d(e, t, n, r) {
|
|
824
|
-
let i = this.grad4, a = this.simplex, o = this.perm, s = (Math.sqrt(5) - 1) / 4, c = (5 - Math.sqrt(5)) / 20, l, u, d, f, p, m = (e + t + n + r) * s, h = Math.floor(e + m), g = Math.floor(t + m), _ = Math.floor(n + m), v = Math.floor(r + m), y = (h + g + _ + v) * c, b = h - y, x = g - y, S = _ - y, C = v - y, w = e - b, T = t - x, E = n - S, D = r - C, O = w > T ? 32 : 0, ee = w > E ? 16 : 0,
|
|
825
|
-
|
|
826
|
-
let
|
|
827
|
-
|
|
828
|
-
let
|
|
829
|
-
|
|
830
|
-
let
|
|
831
|
-
|
|
832
|
-
let
|
|
833
|
-
return
|
|
809
|
+
let i = this.grad4, a = this.simplex, o = this.perm, s = (Math.sqrt(5) - 1) / 4, c = (5 - Math.sqrt(5)) / 20, l, u, d, f, p, m = (e + t + n + r) * s, h = Math.floor(e + m), g = Math.floor(t + m), _ = Math.floor(n + m), v = Math.floor(r + m), y = (h + g + _ + v) * c, b = h - y, x = g - y, S = _ - y, C = v - y, w = e - b, T = t - x, E = n - S, D = r - C, O = w > T ? 32 : 0, ee = w > E ? 16 : 0, k = T > E ? 8 : 0, te = w > D ? 4 : 0, ne = T > D ? 2 : 0, A = E > D ? 1 : 0, j = O + ee + k + te + ne + A, M = a[j][0] >= 3 ? 1 : 0, N = a[j][1] >= 3 ? 1 : 0, re = a[j][2] >= 3 ? 1 : 0, P = a[j][3] >= 3 ? 1 : 0, ie = a[j][0] >= 2 ? 1 : 0, ae = a[j][1] >= 2 ? 1 : 0, F = a[j][2] >= 2 ? 1 : 0, I = a[j][3] >= 2 ? 1 : 0, L = a[j][0] >= 1 ? 1 : 0, R = a[j][1] >= 1 ? 1 : 0, oe = a[j][2] >= 1 ? 1 : 0, se = a[j][3] >= 1 ? 1 : 0, ce = w - M + c, le = T - N + c, z = E - re + c, B = D - P + c, V = w - ie + 2 * c, ue = T - ae + 2 * c, de = E - F + 2 * c, fe = D - I + 2 * c, pe = w - L + 3 * c, me = T - R + 3 * c, he = E - oe + 3 * c, ge = D - se + 3 * c, H = w - 1 + 4 * c, _e = T - 1 + 4 * c, ve = E - 1 + 4 * c, ye = D - 1 + 4 * c, U = h & 255, W = g & 255, G = _ & 255, K = v & 255, be = o[U + o[W + o[G + o[K]]]] % 32, xe = o[U + M + o[W + N + o[G + re + o[K + P]]]] % 32, Se = o[U + ie + o[W + ae + o[G + F + o[K + I]]]] % 32, Ce = o[U + L + o[W + R + o[G + oe + o[K + se]]]] % 32, we = o[U + 1 + o[W + 1 + o[G + 1 + o[K + 1]]]] % 32, Te = .6 - w * w - T * T - E * E - D * D;
|
|
810
|
+
Te < 0 ? l = 0 : (Te *= Te, l = Te * Te * this._dot4(i[be], w, T, E, D));
|
|
811
|
+
let Ee = .6 - ce * ce - le * le - z * z - B * B;
|
|
812
|
+
Ee < 0 ? u = 0 : (Ee *= Ee, u = Ee * Ee * this._dot4(i[xe], ce, le, z, B));
|
|
813
|
+
let q = .6 - V * V - ue * ue - de * de - fe * fe;
|
|
814
|
+
q < 0 ? d = 0 : (q *= q, d = q * q * this._dot4(i[Se], V, ue, de, fe));
|
|
815
|
+
let De = .6 - pe * pe - me * me - he * he - ge * ge;
|
|
816
|
+
De < 0 ? f = 0 : (De *= De, f = De * De * this._dot4(i[Ce], pe, me, he, ge));
|
|
817
|
+
let Oe = .6 - H * H - _e * _e - ve * ve - ye * ye;
|
|
818
|
+
return Oe < 0 ? p = 0 : (Oe *= Oe, p = Oe * Oe * this._dot4(i[we], H, _e, ve, ye)), 27 * (l + u + d + f + p);
|
|
834
819
|
}
|
|
835
820
|
_dot(e, t, n) {
|
|
836
821
|
return e[0] * t + e[1] * n;
|
|
@@ -841,35 +826,35 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
841
826
|
_dot4(e, t, n, r, i) {
|
|
842
827
|
return e[0] * t + e[1] * n + e[2] * r + e[3] * i;
|
|
843
828
|
}
|
|
844
|
-
},
|
|
829
|
+
}, je = (e, t) => {
|
|
845
830
|
e.left = t.min.x, e.right = t.max.x, e.bottom = t.min.y, e.top = t.max.y, e.near = Math.min(-t.min.z, -t.max.z), e.far = Math.max(-t.min.z, -t.max.z), e.updateProjectionMatrix();
|
|
846
|
-
},
|
|
847
|
-
let
|
|
848
|
-
if (
|
|
849
|
-
let
|
|
850
|
-
e.aspect =
|
|
851
|
-
},
|
|
831
|
+
}, Me = (e, t) => {
|
|
832
|
+
let n = Math.min(-t.min.z, -t.max.z), r = Math.max(-t.min.z, -t.max.z);
|
|
833
|
+
if (n < .001) return;
|
|
834
|
+
let i = Math.max(Math.abs(t.min.x), Math.abs(t.max.x)), a = Math.max(Math.abs(t.min.y), Math.abs(t.max.y));
|
|
835
|
+
e.aspect = i / a, e.fov = L.radToDeg(Math.atan2(a, n) * 2), e.near = n, e.far = r, e.updateProjectionMatrix();
|
|
836
|
+
}, Ne = class {
|
|
852
837
|
constructor() {
|
|
853
|
-
this.bounds = new
|
|
838
|
+
this.bounds = new C(new B(-1, -1, -1), new B(1, 1, 1)), this.size = new B(2, 2, 2), this.center = new B(0, 0, 0), this.maxSceneDistanceFromCenter = Math.sqrt(3), this.maxSceneDistanceFrom0 = Math.sqrt(3);
|
|
854
839
|
}
|
|
855
840
|
updateFromBox(e) {
|
|
856
|
-
this.bounds !== e && this.bounds.copy(e), this.bounds.getSize(this.size), this.bounds.getCenter(this.center), this.maxSceneDistanceFromCenter = this.size.length() / 2, this.maxSceneDistanceFrom0 = new
|
|
841
|
+
this.bounds !== e && this.bounds.copy(e), this.bounds.getSize(this.size), this.bounds.getCenter(this.center), this.maxSceneDistanceFromCenter = this.size.length() / 2, this.maxSceneDistanceFrom0 = new B(Math.max(Math.abs(this.bounds.min.x), Math.abs(this.bounds.max.x)), Math.max(Math.abs(this.bounds.min.y), Math.abs(this.bounds.max.y)), Math.max(Math.abs(this.bounds.min.z), Math.abs(this.bounds.max.z))).length();
|
|
857
842
|
}
|
|
858
843
|
updateCameraViewVolumeFromBounds(e) {
|
|
859
844
|
e.updateMatrixWorld();
|
|
860
|
-
let
|
|
861
|
-
e instanceof
|
|
845
|
+
let t = this.bounds.clone().applyMatrix4(e.matrixWorldInverse);
|
|
846
|
+
e instanceof m ? je(e, t) : e instanceof i && Me(e, t);
|
|
862
847
|
}
|
|
863
848
|
getNearAndFarForPerspectiveCamera(e, t = 1) {
|
|
864
849
|
let n = e.clone().sub(this.center).length();
|
|
865
850
|
return [Math.max(.01, n - this.maxSceneDistanceFromCenter - .01), n + this.maxSceneDistanceFromCenter * t + .01];
|
|
866
851
|
}
|
|
867
|
-
},
|
|
852
|
+
}, Pe = class {
|
|
868
853
|
changed(e) {
|
|
869
854
|
let t = !this._lastCameraProjection?.equals(e.projectionMatrix) || !this._lastCameraWorld?.equals(e.matrixWorld);
|
|
870
855
|
return this._lastCameraProjection = e.projectionMatrix.clone(), this._lastCameraWorld = e.matrixWorld.clone(), t;
|
|
871
856
|
}
|
|
872
|
-
},
|
|
857
|
+
}, Fe = (e) => {
|
|
873
858
|
let t = Math.floor(e) % 2 == 0 ? Math.floor(e) + 1 : Math.floor(e), n = t * t, r = Array(n).fill(0), i = Math.floor(t / 2), a = t - 1;
|
|
874
859
|
for (let e = 1; e <= n;) {
|
|
875
860
|
if (i === -1 && a === t ? (a = t - 2, i = 0) : (a === t && (a = 0), i < 0 && (i = t - 1)), r[i * t + a] !== 0) {
|
|
@@ -879,17 +864,17 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
879
864
|
a++, i--;
|
|
880
865
|
}
|
|
881
866
|
return r;
|
|
882
|
-
},
|
|
883
|
-
let n = new
|
|
884
|
-
for (let
|
|
885
|
-
let r = i[
|
|
886
|
-
o[
|
|
887
|
-
}
|
|
888
|
-
let
|
|
889
|
-
return
|
|
890
|
-
},
|
|
867
|
+
}, Ie = (e) => {
|
|
868
|
+
let n = new Ae(), r = Math.floor(e) % 2 == 0 ? Math.floor(e) + 1 : Math.floor(e), i = Fe(r), a = i.length, o = new Uint8Array(a * 4);
|
|
869
|
+
for (let t = 0; t < a; ++t) {
|
|
870
|
+
let r = i[t], s = 2 * Math.PI * r / a, c = new B(Math.cos(s), Math.sin(s), 0).normalize();
|
|
871
|
+
o[t * 4] = (c.x * .5 + .5) * 255, o[t * 4 + 1] = (c.y * .5 + .5) * 255, o[t * 4 + 2] = 127, o[t * 4 + 3] = (n.noise(t / e, t % e) * .5 + .5) * 255;
|
|
872
|
+
}
|
|
873
|
+
let s = new t(o, r, r);
|
|
874
|
+
return s.wrapS = k, s.wrapT = k, s.needsUpdate = !0, s;
|
|
875
|
+
}, Le = class {
|
|
891
876
|
constructor() {
|
|
892
|
-
this._originalClearColor = new
|
|
877
|
+
this._originalClearColor = new r(), this._originalClearAlpha = 0, this._originalAutoClear = !1, this._originalRenderTarget = null, this._screenSpaceQuad = new ke(void 0), this._emptyScene = new g(), this._defaultCamera = new i();
|
|
893
878
|
}
|
|
894
879
|
renderWithOverrideMaterial(e, t, n, r, i, a, o) {
|
|
895
880
|
this._backup(e), this._prepareRenderer(e, i, a, o);
|
|
@@ -914,9 +899,9 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
914
899
|
_restore(e) {
|
|
915
900
|
e.setClearColor(this._originalClearColor), e.setClearAlpha(this._originalClearAlpha), e.setRenderTarget(this._originalRenderTarget), e.autoClear = this._originalAutoClear;
|
|
916
901
|
}
|
|
917
|
-
},
|
|
902
|
+
}, Re = class {
|
|
918
903
|
constructor(e, t) {
|
|
919
|
-
this._passRenderer = t?.passRenderer ?? new
|
|
904
|
+
this._passRenderer = t?.passRenderer ?? new Le(), this._blurMaterial = new a(e ?? Ce), this._blurMaterial.depthTest = !1;
|
|
920
905
|
}
|
|
921
906
|
dispose() {
|
|
922
907
|
this._blurMaterial.dispose();
|
|
@@ -924,12 +909,12 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
924
909
|
render(e, t, n, r) {
|
|
925
910
|
this._blurMaterial.uniforms.tDiffuse.value = t[0].texture, this._blurMaterial.uniforms.rangeMin.value.x = n[0], this._blurMaterial.uniforms.rangeMin.value.y = 0, this._blurMaterial.uniforms.rangeMax.value.x = r[0], this._blurMaterial.uniforms.rangeMax.value.y = 0, this._passRenderer.renderScreenSpace(e, this._blurMaterial, t[1]), this._blurMaterial.uniforms.tDiffuse.value = t[1].texture, this._blurMaterial.uniforms.rangeMin.value.x = 0, this._blurMaterial.uniforms.rangeMin.value.y = n[1], this._blurMaterial.uniforms.rangeMax.value.x = 0, this._blurMaterial.uniforms.rangeMax.value.y = r[1], this._passRenderer.renderScreenSpace(e, this._blurMaterial, t[2]);
|
|
926
911
|
}
|
|
927
|
-
},
|
|
912
|
+
}, ze = class e extends R {
|
|
928
913
|
static {
|
|
929
914
|
this.alphaMap = !0;
|
|
930
915
|
}
|
|
931
916
|
constructor(t, n) {
|
|
932
|
-
super(new
|
|
917
|
+
super(new te(1, 1, 10, 10), new O({
|
|
933
918
|
color: e.alphaMap ? 0 : 16777215,
|
|
934
919
|
transparent: !0,
|
|
935
920
|
depthWrite: !1,
|
|
@@ -958,7 +943,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
958
943
|
let t = this.material;
|
|
959
944
|
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;
|
|
960
945
|
}
|
|
961
|
-
}, J = class extends
|
|
946
|
+
}, J = class extends q {
|
|
962
947
|
get renderPassManager() {
|
|
963
948
|
return this._renderPassManager;
|
|
964
949
|
}
|
|
@@ -990,35 +975,35 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
990
975
|
}, X = {
|
|
991
976
|
SEPARATE_BUFFER: "separateBuffer",
|
|
992
977
|
NORMAL_VECTOR_ALPHA: "normalVectorAlpha"
|
|
993
|
-
},
|
|
978
|
+
}, Be = {
|
|
994
979
|
SSAO: 0,
|
|
995
980
|
SAO: 1,
|
|
996
981
|
N8AO: 2,
|
|
997
982
|
HBAO: 3,
|
|
998
983
|
GTAO: 4
|
|
999
|
-
},
|
|
1000
|
-
let n =
|
|
984
|
+
}, Ve = (e, t) => {
|
|
985
|
+
let n = He(e, t), r = "vec4[SAMPLES](";
|
|
1001
986
|
for (let t = 0; t < e; t++) {
|
|
1002
987
|
let i = n[t];
|
|
1003
988
|
r += `vec4(${i.x}, ${i.y}, ${i.z}, ${i.w})${t < e - 1 ? "," : ")"}`;
|
|
1004
989
|
}
|
|
1005
990
|
return r;
|
|
1006
|
-
},
|
|
991
|
+
}, He = (e, t) => {
|
|
1007
992
|
let n = [];
|
|
1008
993
|
for (let r = 0; r < e; r++) {
|
|
1009
994
|
let i = r * Math.PI * (3 - Math.sqrt(5)), a = .01 + r / (e - 1) * .99, o = t ? Math.sqrt(1 - a * a) : 1 - a, s = Math.cos(i) * o, c = Math.sin(i) * o, l = Math.floor(e / 4), u = 1 - (Math.floor(r / 4) + r % 4 * l) / e;
|
|
1010
|
-
u = .1 + .9 * u, n.push(new
|
|
995
|
+
u = .1 + .9 * u, n.push(new d(s, c, a, u));
|
|
1011
996
|
}
|
|
1012
997
|
return n;
|
|
1013
|
-
},
|
|
998
|
+
}, Ue = {
|
|
1014
999
|
name: "AOShader",
|
|
1015
1000
|
defines: {
|
|
1016
1001
|
PERSPECTIVE_CAMERA: 1,
|
|
1017
1002
|
SAMPLES: 16,
|
|
1018
|
-
SAMPLE_VECTORS:
|
|
1003
|
+
SAMPLE_VECTORS: Ve(16, !1),
|
|
1019
1004
|
NORMAL_VECTOR_TYPE: 1,
|
|
1020
1005
|
DEPTH_SWIZZLING: "x",
|
|
1021
|
-
AO_ALGORITHM:
|
|
1006
|
+
AO_ALGORITHM: Be.GTAO,
|
|
1022
1007
|
NV_ALIGNED_SAMPLES: 1,
|
|
1023
1008
|
SCREEN_SPACE_RADIUS: 0,
|
|
1024
1009
|
SCREEN_SPACE_RADIUS_SCALE: 100,
|
|
@@ -1030,26 +1015,26 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1030
1015
|
tNormal: { value: null },
|
|
1031
1016
|
tDepth: { value: null },
|
|
1032
1017
|
tNoise: { value: null },
|
|
1033
|
-
resolution: { value: new
|
|
1018
|
+
resolution: { value: new x() },
|
|
1034
1019
|
cameraNear: { value: null },
|
|
1035
1020
|
cameraFar: { value: null },
|
|
1036
|
-
cameraProjectionMatrix: { value: new
|
|
1037
|
-
cameraProjectionMatrixInverse: { value: new
|
|
1038
|
-
cameraWorldMatrix: { value: new
|
|
1021
|
+
cameraProjectionMatrix: { value: new P() },
|
|
1022
|
+
cameraProjectionMatrixInverse: { value: new P() },
|
|
1023
|
+
cameraWorldMatrix: { value: new P() },
|
|
1039
1024
|
radius: { value: 1 },
|
|
1040
1025
|
distanceExponent: { value: 1 },
|
|
1041
1026
|
thickness: { value: 1 },
|
|
1042
1027
|
distanceFallOff: { value: 1 },
|
|
1043
1028
|
bias: { value: .001 },
|
|
1044
1029
|
scale: { value: 1 },
|
|
1045
|
-
sceneBoxMin: { value: new
|
|
1046
|
-
sceneBoxMax: { value: new
|
|
1030
|
+
sceneBoxMin: { value: new B(-1, -1, -1) },
|
|
1031
|
+
sceneBoxMax: { value: new B(1, 1, 1) }
|
|
1047
1032
|
},
|
|
1048
1033
|
vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
1049
1034
|
fragmentShader: "\n\n varying vec2 vUv;\n uniform highp sampler2D tNormal;\n uniform highp sampler2D tDepth;\n uniform sampler2D tNoise;\n uniform vec2 resolution;\n uniform float cameraNear;\n uniform float cameraFar;\n uniform mat4 cameraProjectionMatrix;\n uniform mat4 cameraProjectionMatrixInverse;\n uniform mat4 cameraWorldMatrix;\n uniform float radius;\n uniform float distanceExponent;\n uniform float thickness;\n uniform float distanceFallOff;\n uniform float bias;\n uniform float scale;\n #if SCENE_CLIP_BOX == 1\n uniform vec3 sceneBoxMin;\n uniform vec3 sceneBoxMax;\n #endif\n\n #include <common>\n #include <packing>\n\n #ifndef FRAGMENT_OUTPUT\n #define FRAGMENT_OUTPUT vec4(vec3(ao), 1.)\n #endif\n\n const vec4 sampleKernel[SAMPLES] = SAMPLE_VECTORS;\n\n vec3 getViewPosition(const in vec2 screenPosition, const in float depth) {\n vec4 clipSpacePosition = vec4(vec3(screenPosition, depth) * 2.0 - 1.0, 1.0);\n vec4 viewSpacePosition = cameraProjectionMatrixInverse * clipSpacePosition;\n return viewSpacePosition.xyz / viewSpacePosition.w;\n }\n\n float getDepth(const vec2 uv) {\n #if DEPTH_BUFFER_ANTIALIAS == 1\n vec2 size = vec2(textureSize(tDepth, 0));\n ivec2 p = ivec2(uv * size);\n float d0 = texelFetch(tDepth, p, 0).DEPTH_SWIZZLING;\n vec2 depth = vec2(d0, 1.0);\n float d1 = texelFetch(tDepth, p + ivec2(1, 0), 0).DEPTH_SWIZZLING;\n depth += vec2(d1, 1.0) * step(abs(d1 - d0), 0.1);\n float d2 = texelFetch(tDepth, p - ivec2(1, 0), 0).DEPTH_SWIZZLING;\n depth += vec2(d2, 1.0) * step(abs(d2 - d0), 0.1);\n float d3 = texelFetch(tDepth, p + ivec2(0, 1), 0).DEPTH_SWIZZLING;\n depth += vec2(d3, 1.0) * step(abs(d3 - d0), 0.1);\n float d4 = texelFetch(tDepth, p - ivec2(0, 1), 0).DEPTH_SWIZZLING;\n depth += vec2(d4, 1.0) * step(abs(d4 - d0), 0.1);\n return depth.x / depth.y;\n #else\n return textureLod(tDepth, uv.xy, 0.0).DEPTH_SWIZZLING;\n #endif\n }\n\n float fetchDepth(const ivec2 uv) {\n return texelFetch(tDepth, uv.xy, 0).DEPTH_SWIZZLING;\n }\n\n float getViewZ(const in float depth) {\n #if PERSPECTIVE_CAMERA == 1\n return perspectiveDepthToViewZ(depth, cameraNear, cameraFar);\n #else\n return orthographicDepthToViewZ(depth, cameraNear, cameraFar);\n #endif\n }\n\n vec3 computeNormalFromDepth(const vec2 uv) {\n vec2 size = vec2(textureSize(tDepth, 0));\n ivec2 p = ivec2(uv * size);\n float c0 = fetchDepth(p);\n float l2 = fetchDepth(p - ivec2(2, 0));\n float l1 = fetchDepth(p - ivec2(1, 0));\n float r1 = fetchDepth(p + ivec2(1, 0));\n float r2 = fetchDepth(p + ivec2(2, 0));\n float b2 = fetchDepth(p - ivec2(0, 2));\n float b1 = fetchDepth(p - ivec2(0, 1));\n float t1 = fetchDepth(p + ivec2(0, 1));\n float t2 = fetchDepth(p + ivec2(0, 2));\n float dl = abs((2.0 * l1 - l2) - c0);\n float dr = abs((2.0 * r1 - r2) - c0);\n float db = abs((2.0 * b1 - b2) - c0);\n float dt = abs((2.0 * t1 - t2) - c0);\n vec3 ce = getViewPosition(uv, c0).xyz;\n vec3 dpdx = (dl < dr) ? ce - getViewPosition((uv - vec2(1.0 / size.x, 0.0)), l1).xyz\n : -ce + getViewPosition((uv + vec2(1.0 / size.x, 0.0)), r1).xyz;\n vec3 dpdy = (db < dt) ? ce - getViewPosition((uv - vec2(0.0, 1.0 / size.y)), b1).xyz\n : -ce + getViewPosition((uv + vec2(0.0, 1.0 / size.y)), t1).xyz;\n return normalize(cross(dpdx, dpdy));\n }\n\n vec3 getViewNormal(const vec2 uv) {\n #if NORMAL_VECTOR_TYPE == 2\n return normalize(textureLod(tNormal, uv, 0.).rgb);\n #elif NORMAL_VECTOR_TYPE == 1\n return unpackRGBToNormal(textureLod(tNormal, uv, 0.).rgb);\n #else\n return computeNormalFromDepth(uv);\n #endif\n }\n\n vec3 getAntiAliasedViewNormal(const in vec2 screenPosition) {\n #if NORMAL_VECTOR_TYPE == 2\n #if NORMAL_VECTOR_ANTIALIAS == 1\n vec2 uv = screenPosition;\n vec2 size = vec2(textureSize(tNormal, 0));\n ivec2 p = ivec2(screenPosition * size);\n float c0 = texelFetch(tNormal, p, 0).a;\n float l2 = texelFetch(tNormal, p - ivec2(2, 0), 0).a;\n float l1 = texelFetch(tNormal, p - ivec2(1, 0), 0).a;\n float r1 = texelFetch(tNormal, p + ivec2(1, 0), 0).a;\n float r2 = texelFetch(tNormal, p + ivec2(2, 0), 0).a;\n float b2 = texelFetch(tNormal, p - ivec2(0, 2), 0).a;\n float b1 = texelFetch(tNormal, p - ivec2(0, 1), 0).a;\n float t1 = texelFetch(tNormal, p + ivec2(0, 1), 0).a;\n float t2 = texelFetch(tNormal, p + ivec2(0, 2), 0).a;\n float dl = abs((2.0 * l1 - l2) - c0);\n float dr = abs((2.0 * r1 - r2) - c0);\n float db = abs((2.0 * b1 - b2) - c0);\n float dt = abs((2.0 * t1 - t2) - c0);\n vec3 ce = getViewPosition(uv, c0).xyz;\n vec3 dpdx = (dl < dr) ? ce - getViewPosition((uv - vec2(1.0 / size.x, 0.0)), l1).xyz\n : -ce + getViewPosition((uv + vec2(1.0 / size.x, 0.0)), r1).xyz;\n vec3 dpdy = (db < dt) ? ce - getViewPosition((uv - vec2(0.0, 1.0 / size.y)), b1).xyz\n : -ce + getViewPosition((uv + vec2(0.0, 1.0 / size.y)), t1).xyz;\n return normalize(cross(dpdx, dpdy));\n #elif NORMAL_VECTOR_ANTIALIAS == 2\n vec2 size = vec2(textureSize(tNormal, 0));\n ivec2 p = ivec2(screenPosition * size);\n vec3 normalVector = texelFetch(tNormal, p, 0).xyz;\n normalVector += texelFetch(tNormal, p + ivec2(1, 0), 0).xyz;\n normalVector += texelFetch(tNormal, p - ivec2(1, 0), 0).xyz;\n normalVector += texelFetch(tNormal, p + ivec2(0, 1), 0).xyz;\n normalVector += texelFetch(tNormal, p - ivec2(0, 1), 0).xyz;\n return normalize(normalVector);\n #else\n return texture2D(tNormal, screenPosition).xyz;\n #endif\n #elif NORMAL_VECTOR_TYPE == 1\n return unpackRGBToNormal(textureLod(tNormal, screenPosition, 0.).rgb);\n #else\n return computeNormalFromDepth(screenPosition);\n #endif\n }\n\n vec3 getSceneUvAndDepth(vec3 sampleViewPos) {\n vec4 sampleClipPos = cameraProjectionMatrix * vec4(sampleViewPos, 1.);\n vec2 sampleUv = sampleClipPos.xy / sampleClipPos.w * 0.5 + 0.5;\n float sampleSceneDepth = getDepth(sampleUv);\n return vec3(sampleUv, sampleSceneDepth);\n }\n\n float sinusToPlane(vec3 pointOnPlane, vec3 planeNormal, vec3 point) {\n vec3 delta = point - pointOnPlane;\n float sinV = dot(planeNormal, normalize(delta));\n return sinV;\n }\n\n float getFallOff(float delta, float falloffDistance) {\n float fallOff = smoothstep(0., 1., 1. - distanceFallOff * abs(delta) / falloffDistance);\n return fallOff;\n }\n\n void main() {\n float depth = getDepth(vUv.xy);\n if (depth >= 1.0) {\n discard;\n return;\n }\n vec3 viewPos = getViewPosition(vUv, depth);\n vec3 viewNormal = getAntiAliasedViewNormal(vUv);\n\n float radiusToUse = radius;\n float distanceFalloffToUse = thickness;\n #if SCREEN_SPACE_RADIUS == 1\n float radiusScale = getViewPosition(vec2(0.5 + float(SCREEN_SPACE_RADIUS_SCALE) / resolution.x, 0.0), depth).x;\n radiusToUse *= radiusScale;\n distanceFalloffToUse *= radiusScale;\n #endif\n\n #if SCENE_CLIP_BOX == 1\n vec3 worldPos = (cameraWorldMatrix * vec4(viewPos, 1.0)).xyz;\n float boxDistance = length(max(vec3(0.0), max(sceneBoxMin - worldPos, worldPos - sceneBoxMax)));\n if (boxDistance > radiusToUse) {\n discard;\n return;\n }\n #endif\n\n vec2 noiseResolution = vec2(textureSize(tNoise, 0));\n vec2 noiseUv = vUv * resolution / noiseResolution;\n vec4 noiseTexel = textureLod(tNoise, noiseUv, 0.0);\n vec3 randomVec = noiseTexel.xyz * 2.0 - 1.0;\n\n #if NV_ALIGNED_SAMPLES == 1\n vec3 tangent = normalize(randomVec - viewNormal * dot(randomVec, viewNormal));\n vec3 bitangent = cross(viewNormal, tangent);\n mat3 kernelMatrix = mat3(tangent, bitangent, viewNormal);\n #else\n vec3 tangent = normalize(vec3(randomVec.xy, 0.));\n vec3 bitangent = vec3(-tangent.y, tangent.x, 0.);\n mat3 kernelMatrix = mat3(tangent, bitangent, vec3(0., 0., 1.));\n #endif\n\n #if AO_ALGORITHM == 4\n const int DIRECTIONS = SAMPLES < 30 ? 3 : 5;\n const int STEPS = (SAMPLES + DIRECTIONS - 1) / DIRECTIONS;\n #elif AO_ALGORITHM == 3\n const int DIRECTIONS = SAMPLES < 16 ? 3 : 5;\n const int STEPS = (SAMPLES + DIRECTIONS - 1) / DIRECTIONS;\n #else\n const int DIRECTIONS = SAMPLES;\n const int STEPS = 1;\n #endif\n\n float ao = 0.0, totalWeight = 0.0;\n for (int i = 0; i < DIRECTIONS; ++i) {\n\n #if AO_ALGORITHM == 4\n float angle = float(i) / float(DIRECTIONS) * PI;\n vec4 sampleDir = vec4(cos(angle), sin(angle), 0., 0.5 + 0.5 * noiseTexel.w);\n #elif AO_ALGORITHM == 3\n float angle = float(i) / float(DIRECTIONS) * 2. * PI;\n vec4 sampleDir = vec4(cos(angle), sin(angle), 0., 0.5 + 0.5 * noiseTexel.w);\n #else\n vec4 sampleDir = sampleKernel[i];\n #endif\n sampleDir.xyz = normalize(kernelMatrix * sampleDir.xyz);\n\n vec3 viewDir = normalize(-viewPos.xyz);\n vec3 sliceBitangent = normalize(cross(sampleDir.xyz, viewDir));\n vec3 sliceTangent = cross(sliceBitangent, viewDir);\n vec3 normalInSlice = normalize(viewNormal - sliceBitangent * dot(viewNormal, sliceBitangent));\n\n #if (AO_ALGORITHM == 3 || AO_ALGORITHM == 4)\n vec3 tangentToNormalInSlice = cross(normalInSlice, sliceBitangent);\n #if AO_ALGORITHM == 4\n vec2 cosHorizons = vec2(dot(viewDir, tangentToNormalInSlice), dot(viewDir, -tangentToNormalInSlice));\n #else\n vec2 cosHorizons = vec2(dot(viewDir, tangentToNormalInSlice));\n #endif\n for (int j = 0; j < STEPS; ++j) {\n vec3 sampleViewOffset = sampleDir.xyz * radiusToUse * sampleDir.w * pow(float(j + 1) / float(STEPS), distanceExponent);\n vec3 sampleViewPos = viewPos + sampleViewOffset;\n #else\n vec3 sampleViewPos = viewPos + sampleDir.xyz * radiusToUse * pow(sampleDir.w, distanceExponent);\n #endif\n\n vec3 sampleSceneUvDepth = getSceneUvAndDepth(sampleViewPos);\n vec3 sampleSceneViewPos = getViewPosition(sampleSceneUvDepth.xy, sampleSceneUvDepth.z);\n float sceneSampleDist = abs(sampleSceneViewPos.z);\n float sampleDist = abs(sampleViewPos.z);\n\n #if (AO_ALGORITHM == 3 || AO_ALGORITHM == 4)\n // HBAO || GTAO\n vec3 viewDelta = sampleSceneViewPos - viewPos;\n if (abs(viewDelta.z) < thickness) {\n vec2 clipRangeCheck = step(0., sampleSceneUvDepth.xy) * step(sampleSceneUvDepth.xy, vec2(1.));\n float sampleCosHorizon = dot(viewDir, normalize(viewDelta));\n cosHorizons.x += max(0., (sampleCosHorizon - cosHorizons.x) * mix(1., 2. / float(j + 2), distanceFallOff) * clipRangeCheck.x * clipRangeCheck.y);\n }\n #if AO_ALGORITHM == 4\n sampleSceneUvDepth = getSceneUvAndDepth(viewPos - sampleViewOffset);\n sampleSceneViewPos = getViewPosition(sampleSceneUvDepth.xy, sampleSceneUvDepth.z);\n viewDelta = sampleSceneViewPos - viewPos;\n if (abs(viewDelta.z) < thickness) {\n vec2 clipRangeCheck = step(0., sampleSceneUvDepth.xy) * step(sampleSceneUvDepth.xy, vec2(1.));\n float sampleCosHorizon = dot(viewDir, normalize(viewDelta));\n cosHorizons.y += max(0., (sampleCosHorizon - cosHorizons.y) * mix(1., 2. / float(j + 2), distanceFallOff) * clipRangeCheck.x * clipRangeCheck.y);\n }\n #endif\n #elif AO_ALGORITHM == 2\n // N8AO\n float weight = dot(viewNormal, sampleDir.xyz);\n float occlusion = weight * step(sceneSampleDist + bias, sampleDist);\n #elif AO_ALGORITHM == 1\n // SAO\n vec3 viewDelta = sampleSceneViewPos - viewPos;\n float minResolution = 0.; // ?\n float scaledViewDist = length( viewDelta ) / scale;\n float weight = 1.;\n float occlusion = max(0., (dot(viewNormal, viewDelta) - minResolution) / scaledViewDist - bias) / (1. + scaledViewDist * scaledViewDist );\n #else\n // SSAO\n float weight = 1.;\n float occlusion = step(sceneSampleDist + bias, sampleDist);\n #endif\n\n #if AO_ALGORITHM == 4\n }\n // GTAO\n vec2 sinHorizons = sqrt(1. - cosHorizons * cosHorizons);\n float nx = dot(normalInSlice, sliceTangent);\n float ny = dot(normalInSlice, viewDir);\n float nxb = 1. / 2. * (acos(cosHorizons.y) - acos(cosHorizons.x) + sinHorizons.x * cosHorizons.x - sinHorizons.y * cosHorizons.y);\n float nyb = 1. / 2. * (2. - cosHorizons.x * cosHorizons.x - cosHorizons.y * cosHorizons.y);\n float occlusion = nx * nxb + ny * nyb;\n ao += occlusion;\n }\n ao = clamp(ao / float(DIRECTIONS), 0., 1.);\n #elif AO_ALGORITHM == 3\n }\n totalWeight += 1.;\n ao += max(0., cosHorizons.x - max(0., cosHorizons.y));\n }\n ao /= totalWeight + 1. - step(0., totalWeight);\n ao = clamp(1. - ao, 0., 1.);\n #else\n\n float fallOff = getFallOff(sceneSampleDist - sampleDist, distanceFalloffToUse);\n occlusion *= fallOff;\n vec2 diff = (vUv - sampleSceneUvDepth.xy) * resolution;\n occlusion *= step(1., dot(diff, diff));\n vec2 clipRangeCheck = step(0., sampleSceneUvDepth.xy) * step(sampleSceneUvDepth.xy, vec2(1.));\n occlusion *= clipRangeCheck.x * clipRangeCheck.y;\n weight *= clipRangeCheck.x * clipRangeCheck.y;\n totalWeight += weight;\n ao += occlusion;\n }\n ao /= totalWeight + 1. - step(0., totalWeight);\n ao = clamp(1. - ao, 0., 1.);\n #endif\n\n #if SCENE_CLIP_BOX == 1\n ao = mix(ao, 1., smoothstep(0., radiusToUse, boxDistance));\n #endif\n #if AO_ALGORITHM != 1\n ao = pow(ao, scale);\n #endif\n gl_FragColor = FRAGMENT_OUTPUT;\n }"
|
|
1050
|
-
},
|
|
1035
|
+
}, We = {
|
|
1051
1036
|
resolutionScale: 1,
|
|
1052
|
-
algorithm:
|
|
1037
|
+
algorithm: Be.SSAO,
|
|
1053
1038
|
samples: 32,
|
|
1054
1039
|
radius: .25,
|
|
1055
1040
|
distanceExponent: 2,
|
|
@@ -1058,21 +1043,21 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1058
1043
|
scale: 1,
|
|
1059
1044
|
bias: .01,
|
|
1060
1045
|
screenSpaceRadius: !1
|
|
1061
|
-
},
|
|
1046
|
+
}, Ge = class {
|
|
1062
1047
|
get texture() {
|
|
1063
1048
|
return this._renderTarget ? this._renderTarget?.texture : null;
|
|
1064
1049
|
}
|
|
1065
1050
|
constructor(e, t, n, r, i) {
|
|
1066
|
-
this.needsUpdate = !0, this.parameters = { ...
|
|
1051
|
+
this.needsUpdate = !0, this.parameters = { ...We }, this._width = 0, this._height = 0, this._samples = 0, this._gBufferAntiAliasing = !1, this._normalVectorSourceType = Y.FLOAT_BUFFER_NORMAL, this._depthValueSourceType = X.NORMAL_VECTOR_ALPHA, this._modulateRedChannel = !1, this.depthTexture = null, this.normalTexture = null, this._noiseTexture = null, this._renderTarget = null, this._passRenderer = new Le(), this._sceneClipBox = new C(new B(-1, -1, -1), new B(1, 1, 1)), this._sceneScale = 1, this._width = e, this._height = t, this._samples = n, this._gBufferAntiAliasing = r, this._normalVectorSourceType = i?.normalVectorSourceType || Y.FLOAT_BUFFER_NORMAL, this._depthValueSourceType = i?.depthValueSourceType || X.NORMAL_VECTOR_ALPHA, this._modulateRedChannel = i?.modulateRedChannel || !1, i?.aoParameters && (this.parameters = i.aoParameters), i && this.updateTextures(i);
|
|
1067
1052
|
}
|
|
1068
|
-
_getNoiseTexture(
|
|
1053
|
+
_getNoiseTexture(e = 64) {
|
|
1069
1054
|
if (!this._noiseTexture) {
|
|
1070
|
-
let n = new
|
|
1071
|
-
for (let
|
|
1072
|
-
let a =
|
|
1073
|
-
r[(
|
|
1055
|
+
let n = new Ae(), r = new Uint8Array(e * e * 4);
|
|
1056
|
+
for (let t = 0; t < e; t++) for (let i = 0; i < e; i++) {
|
|
1057
|
+
let a = t, o = i;
|
|
1058
|
+
r[(t * e + i) * 4] = (n.noise(a, o) + 1) * 127.5, r[(t * e + i) * 4 + 1] = (n.noise(a + e, o) + 1) * 127.5, r[(t * e + i) * 4 + 2] = (n.noise(a, o + e) + 1) * 127.5, r[(t * e + i) * 4 + 3] = (n.noise(a + e, o + e) + 1) * 127.5;
|
|
1074
1059
|
}
|
|
1075
|
-
this._noiseTexture = new
|
|
1060
|
+
this._noiseTexture = new t(r, e, e, _, E), this._noiseTexture.wrapS = k, this._noiseTexture.wrapT = k, this._noiseTexture.needsUpdate = !0;
|
|
1076
1061
|
}
|
|
1077
1062
|
return this._noiseTexture;
|
|
1078
1063
|
}
|
|
@@ -1081,18 +1066,18 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1081
1066
|
return this._aoMaterial || (this._aoMaterial = this._newAoMaterial(), n = !0), n && (this._updateShader(this._aoMaterial, e), this._aoMaterial.needsUpdate = !0), this._updateUniforms(this._aoMaterial, e, n), this._aoMaterial;
|
|
1082
1067
|
}
|
|
1083
1068
|
_newAoMaterial() {
|
|
1084
|
-
let e = new
|
|
1085
|
-
defines: Object.assign({},
|
|
1086
|
-
uniforms:
|
|
1087
|
-
vertexShader:
|
|
1088
|
-
fragmentShader:
|
|
1069
|
+
let e = new a({
|
|
1070
|
+
defines: Object.assign({}, Ue.defines),
|
|
1071
|
+
uniforms: w.clone(Ue.uniforms),
|
|
1072
|
+
vertexShader: Ue.vertexShader,
|
|
1073
|
+
fragmentShader: Ue.fragmentShader,
|
|
1089
1074
|
depthTest: !1,
|
|
1090
1075
|
depthWrite: !1
|
|
1091
1076
|
});
|
|
1092
|
-
return this._modulateRedChannel && (e.blending = 5, e.blendEquation = 103, e.blendEquationAlpha = null, e.blendSrc = 201, e.blendSrcAlpha = null, e.blendDst = 201, e.blendDstAlpha = null), e.defines.FRAGMENT_OUTPUT = this._modulateRedChannel ? "vec4(ao, 1., 1., 1.)" : void 0, e.uniforms.tNoise.value =
|
|
1077
|
+
return this._modulateRedChannel && (e.blending = 5, e.blendEquation = 103, e.blendEquationAlpha = null, e.blendSrc = 201, e.blendSrcAlpha = null, e.blendDst = 201, e.blendDstAlpha = null), e.defines.FRAGMENT_OUTPUT = this._modulateRedChannel ? "vec4(ao, 1., 1., 1.)" : void 0, e.uniforms.tNoise.value = Ie(5), e;
|
|
1093
1078
|
}
|
|
1094
1079
|
_updateShader(e, t) {
|
|
1095
|
-
e.defines.PERSPECTIVE_CAMERA = t.isPerspectiveCamera ? 1 : 0, e.defines.SAMPLES = this.parameters.samples, e.defines.SAMPLE_VECTORS =
|
|
1080
|
+
e.defines.PERSPECTIVE_CAMERA = t.isPerspectiveCamera ? 1 : 0, e.defines.SAMPLES = this.parameters.samples, e.defines.SAMPLE_VECTORS = Ve(this.parameters.samples, this.parameters.algorithm === Be.SSAO), e.defines.NORMAL_VECTOR_TYPE = this._normalVectorSourceType === Y.FLOAT_BUFFER_NORMAL ? 2 : 1, e.defines.DEPTH_SWIZZLING = this._depthValueSourceType === X.NORMAL_VECTOR_ALPHA ? "a" : "x", e.defines.AO_ALGORITHM = this.parameters.algorithm, e.defines.NV_ALIGNED_SAMPLES = this.parameters.algorithm === Be.HBAO || this.parameters.algorithm === Be.GTAO ? 0 : 1, e.defines.SCREEN_SPACE_RADIUS = this.parameters.screenSpaceRadius ? 1 : 0, e.defines.SCENE_CLIP_BOX = 1, e.defines.NORMAL_VECTOR_ANTIALIAS = this._gBufferAntiAliasing ? 2 : 0, e.defines.DEPTH_BUFFER_ANTIALIAS = this._gBufferAntiAliasing ? 1 : 0;
|
|
1096
1081
|
}
|
|
1097
1082
|
_updateUniforms(e, t, n) {
|
|
1098
1083
|
let r = this.parameters.screenSpaceRadius ? 1 : this._sceneScale, i = this._depthValueSourceType === X.NORMAL_VECTOR_ALPHA ? this.normalTexture : this.depthTexture;
|
|
@@ -1101,10 +1086,10 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1101
1086
|
e.uniforms.cameraNear.value = a.near, e.uniforms.cameraFar.value = a.far, n && (e.uniforms.radius.value = this.parameters.radius * r, e.uniforms.distanceExponent.value = this.parameters.distanceExponent, e.uniforms.thickness.value = this.parameters.thickness * r, e.uniforms.distanceFallOff.value = this.parameters.distanceFallOff, e.uniforms.scale.value = this.parameters.scale, this._sceneClipBox && (e.uniforms.sceneBoxMin.value.copy(this._sceneClipBox.min), e.uniforms.sceneBoxMax.value.copy(this._sceneClipBox.max)));
|
|
1102
1087
|
}
|
|
1103
1088
|
_getRenderTargets() {
|
|
1104
|
-
return this._renderTarget ||= new
|
|
1089
|
+
return this._renderTarget ||= new p(this._width, this._height, {
|
|
1105
1090
|
samples: this._samples,
|
|
1106
|
-
magFilter: this._samples > 1 ?
|
|
1107
|
-
minFilter: this._samples > 1 ?
|
|
1091
|
+
magFilter: this._samples > 1 ? s : V,
|
|
1092
|
+
minFilter: this._samples > 1 ? s : V
|
|
1108
1093
|
}), this._renderTarget;
|
|
1109
1094
|
}
|
|
1110
1095
|
dispose() {
|
|
@@ -1114,7 +1099,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1114
1099
|
this._width = e, this._height = t, this._renderTarget?.setSize(e, t), this.needsUpdate = !0;
|
|
1115
1100
|
}
|
|
1116
1101
|
updateBounds(e, t) {
|
|
1117
|
-
this._sceneClipBox = new
|
|
1102
|
+
this._sceneClipBox = new C().copy(e), this._sceneScale = t ?? 1, this.needsUpdate = !0;
|
|
1118
1103
|
}
|
|
1119
1104
|
updateParameters(e) {
|
|
1120
1105
|
for (let t in e) this.parameters.hasOwnProperty(t) && (this.parameters[t] = e[t], this.needsUpdate = !0);
|
|
@@ -1129,19 +1114,19 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1129
1114
|
let i = this._getMaterial(t, this.needsUpdate);
|
|
1130
1115
|
this.needsUpdate = !1, this._passRenderer.renderScreenSpace(e, i, r || this._getRenderTargets());
|
|
1131
1116
|
}
|
|
1132
|
-
},
|
|
1117
|
+
}, Ke = {
|
|
1133
1118
|
uniforms: {
|
|
1134
1119
|
tDiffuse: { value: null },
|
|
1135
|
-
intensity: { value: new
|
|
1120
|
+
intensity: { value: new x(1, 1) }
|
|
1136
1121
|
},
|
|
1137
1122
|
vertexShader: "\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",
|
|
1138
1123
|
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 }"
|
|
1139
|
-
},
|
|
1124
|
+
}, qe = class extends a {
|
|
1140
1125
|
constructor(e) {
|
|
1141
1126
|
super({
|
|
1142
|
-
uniforms:
|
|
1143
|
-
vertexShader:
|
|
1144
|
-
fragmentShader:
|
|
1127
|
+
uniforms: w.clone(Ke.uniforms),
|
|
1128
|
+
vertexShader: Ke.vertexShader,
|
|
1129
|
+
fragmentShader: Ke.fragmentShader,
|
|
1145
1130
|
transparent: !0,
|
|
1146
1131
|
depthTest: !1,
|
|
1147
1132
|
depthWrite: !1,
|
|
@@ -1151,30 +1136,30 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1151
1136
|
blendSrcAlpha: 206,
|
|
1152
1137
|
blendDstAlpha: 200,
|
|
1153
1138
|
blendEquationAlpha: 100
|
|
1154
|
-
}), this._intensity = new
|
|
1139
|
+
}), this._intensity = new x(1, 1), this.uniforms.intensity.value = this._intensity, this.update(e);
|
|
1155
1140
|
}
|
|
1156
1141
|
update(e) {
|
|
1157
1142
|
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;
|
|
1158
1143
|
}
|
|
1159
|
-
},
|
|
1160
|
-
let i =
|
|
1144
|
+
}, Je = (e, t, n, r) => {
|
|
1145
|
+
let i = Ye(e, t, n, r), a = "vec3[SAMPLES](";
|
|
1161
1146
|
for (let t = 0; t < e; t++) {
|
|
1162
1147
|
let n = i[t];
|
|
1163
1148
|
a += `vec3(${n.x}, ${n.y}, ${n.z})${t < e - 1 ? "," : ")"}`;
|
|
1164
1149
|
}
|
|
1165
1150
|
return a;
|
|
1166
|
-
},
|
|
1151
|
+
}, Ye = (e, t, n, r) => {
|
|
1167
1152
|
let i = [];
|
|
1168
1153
|
for (let a = 0; a < e; a++) {
|
|
1169
1154
|
let o = 2 * Math.PI * t * a / e, s = (1 + (n - 1) * (a / (e - 1)) ** r) / n;
|
|
1170
|
-
i.push(new
|
|
1155
|
+
i.push(new B(Math.cos(o), Math.sin(o), s));
|
|
1171
1156
|
}
|
|
1172
1157
|
return i;
|
|
1173
|
-
},
|
|
1158
|
+
}, Xe = {
|
|
1174
1159
|
name: "PoissonDenoiseShader",
|
|
1175
1160
|
defines: {
|
|
1176
1161
|
SAMPLES: 16,
|
|
1177
|
-
SAMPLE_VECTORS:
|
|
1162
|
+
SAMPLE_VECTORS: Je(16, 2.89, 4, 1.3),
|
|
1178
1163
|
NV_ALIGNED_SAMPLES: 0,
|
|
1179
1164
|
SAMPLE_DISTRIBUTION: 0,
|
|
1180
1165
|
DEPTH_VALUE_SOURCE: 0,
|
|
@@ -1189,10 +1174,10 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1189
1174
|
tNormal: { value: null },
|
|
1190
1175
|
tDepth: { value: null },
|
|
1191
1176
|
tNoise: { value: null },
|
|
1192
|
-
resolution: { value: new
|
|
1193
|
-
cameraProjectionMatrix: { value: new
|
|
1194
|
-
cameraProjectionMatrixInverse: { value: new
|
|
1195
|
-
cameraWorldMatrix: { value: new
|
|
1177
|
+
resolution: { value: new x() },
|
|
1178
|
+
cameraProjectionMatrix: { value: new P() },
|
|
1179
|
+
cameraProjectionMatrixInverse: { value: new P() },
|
|
1180
|
+
cameraWorldMatrix: { value: new P() },
|
|
1196
1181
|
lumaPhi: { value: 5 },
|
|
1197
1182
|
depthPhi: { value: 1 },
|
|
1198
1183
|
normalPhi: { value: 1 },
|
|
@@ -1200,12 +1185,12 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1200
1185
|
radiusExponent: { value: 1.3 },
|
|
1201
1186
|
iteration: { value: 0 },
|
|
1202
1187
|
noOfIterations: { value: 2 },
|
|
1203
|
-
sceneBoxMin: { value: new
|
|
1204
|
-
sceneBoxMax: { value: new
|
|
1188
|
+
sceneBoxMin: { value: new B(-1, -1, -1) },
|
|
1189
|
+
sceneBoxMax: { value: new B(1, 1, 1) }
|
|
1205
1190
|
},
|
|
1206
1191
|
vertexShader: "\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
1207
1192
|
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}"
|
|
1208
|
-
},
|
|
1193
|
+
}, Ze = {
|
|
1209
1194
|
iterations: 2,
|
|
1210
1195
|
samples: 16,
|
|
1211
1196
|
rings: 2.89,
|
|
@@ -1215,7 +1200,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1215
1200
|
depthPhi: 2.5,
|
|
1216
1201
|
normalPhi: .5,
|
|
1217
1202
|
nvOrientatedSamples: !1
|
|
1218
|
-
},
|
|
1203
|
+
}, Qe = class {
|
|
1219
1204
|
get texture() {
|
|
1220
1205
|
return this.parameters.iterations > 0 && this._renderTargets.length > 0 ? this._renderTargets[this._outputRenderTargetIndex].texture : this._inputTexture;
|
|
1221
1206
|
}
|
|
@@ -1223,50 +1208,50 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1223
1208
|
this._inputTexture = e;
|
|
1224
1209
|
}
|
|
1225
1210
|
constructor(e, t, n, r) {
|
|
1226
|
-
this.needsUpdate = !0, this.parameters = { ...
|
|
1211
|
+
this.needsUpdate = !0, this.parameters = { ...Ze }, this._width = 0, this._height = 0, this._samples = 0, this._normalVectorSourceType = Y.FLOAT_BUFFER_NORMAL, this._depthValueSourceType = X.NORMAL_VECTOR_ALPHA, this._inputTexture = null, this.depthTexture = null, this.normalTexture = null, this._noiseTexture = null, this._renderTargets = [], this._outputRenderTargetIndex = 0, this._passRenderer = new Le(), this._rgInputTexture = !1, this._luminanceWeighted = !0, this._width = e, this._height = t, this._samples = n, this._normalVectorSourceType = r?.normalVectorSourceType || Y.FLOAT_BUFFER_NORMAL, this._depthValueSourceType = r?.depthValueSourceType || X.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);
|
|
1227
1212
|
}
|
|
1228
|
-
_getNoiseTexture(
|
|
1213
|
+
_getNoiseTexture(e = 64) {
|
|
1229
1214
|
if (!this._noiseTexture) {
|
|
1230
|
-
let n = new
|
|
1231
|
-
for (let
|
|
1232
|
-
let a =
|
|
1233
|
-
r[(
|
|
1215
|
+
let n = new Ae(), r = new Uint8Array(e * e * 4);
|
|
1216
|
+
for (let t = 0; t < e; t++) for (let i = 0; i < e; i++) {
|
|
1217
|
+
let a = t, o = i;
|
|
1218
|
+
r[(t * e + i) * 4] = (n.noise(a, o) + 1) * 127.5, r[(t * e + i) * 4 + 1] = (n.noise(a + e, o) + 1) * 127.5, r[(t * e + i) * 4 + 2] = (n.noise(a, o + e) + 1) * 127.5, r[(t * e + i) * 4 + 3] = (n.noise(a + e, o + e) + 1) * 127.5;
|
|
1234
1219
|
}
|
|
1235
|
-
this._noiseTexture = new
|
|
1220
|
+
this._noiseTexture = new t(r, e, e, _, E), this._noiseTexture.wrapS = k, this._noiseTexture.wrapT = k, this._noiseTexture.needsUpdate = !0;
|
|
1236
1221
|
}
|
|
1237
1222
|
return this._noiseTexture;
|
|
1238
1223
|
}
|
|
1239
1224
|
_getMaterial(e, t) {
|
|
1240
1225
|
let n = t;
|
|
1241
|
-
return this._pdMaterial || (this._pdMaterial = new
|
|
1242
|
-
defines: Object.assign({},
|
|
1243
|
-
uniforms:
|
|
1244
|
-
vertexShader:
|
|
1245
|
-
fragmentShader:
|
|
1226
|
+
return this._pdMaterial || (this._pdMaterial = new a({
|
|
1227
|
+
defines: Object.assign({}, Xe.defines),
|
|
1228
|
+
uniforms: w.clone(Xe.uniforms),
|
|
1229
|
+
vertexShader: Xe.vertexShader,
|
|
1230
|
+
fragmentShader: Xe.fragmentShader,
|
|
1246
1231
|
depthTest: !1,
|
|
1247
1232
|
depthWrite: !1
|
|
1248
1233
|
}), this._pdMaterial.uniforms.tNoise.value = this._getNoiseTexture(), n = !0), n && this._updateShader(this._pdMaterial), this._updateUniforms(this._pdMaterial, e, n), this._pdMaterial;
|
|
1249
1234
|
}
|
|
1250
1235
|
_updateShader(e) {
|
|
1251
|
-
e.defines.SAMPLES = this.parameters.samples, e.defines.SAMPLE_VECTORS =
|
|
1236
|
+
e.defines.SAMPLES = this.parameters.samples, e.defines.SAMPLE_VECTORS = Je(this.parameters.samples, this.parameters.rings, this.parameters.radius, this.parameters.radiusExponent), e.defines.SAMPLE_DISTRIBUTION = this.parameters.nvOrientatedSamples ? 1 : 0, e.defines.NORMAL_VECTOR_TYPE = this._normalVectorSourceType === Y.FLOAT_BUFFER_NORMAL ? 2 : 1, e.defines.DEPTH_VALUE_SOURCE = this._depthValueSourceType === X.NORMAL_VECTOR_ALPHA ? 1 : 0, e.needsUpdate = !0, e.defines.LUMINANCE_WEIGHTED = this._luminanceWeighted ? 1 : 0, e.defines.LUMINANCE_TYPE = this._luminanceType, e.defines.SAMPLE_LUMINANCE = this._sampleLuminance, e.defines.FRAGMENT_OUTPUT = this._fragmentOutput, e.defines.SCENE_CLIP_BOX = this._sceneClipBox ? 1 : 0, e.needsUpdate = !0;
|
|
1252
1237
|
}
|
|
1253
1238
|
_updateUniforms(e, t, n) {
|
|
1254
1239
|
let r = this._depthValueSourceType === X.NORMAL_VECTOR_ALPHA ? this.normalTexture : this.depthTexture;
|
|
1255
1240
|
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), e.uniforms.cameraProjectionMatrix.value.copy(t.projectionMatrix), e.uniforms.cameraProjectionMatrixInverse.value.copy(t.projectionMatrixInverse), 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)));
|
|
1256
1241
|
}
|
|
1257
1242
|
_getRenderTargets() {
|
|
1258
|
-
return this._renderTargets.length < 2 && (this._renderTargets = [new
|
|
1243
|
+
return this._renderTargets.length < 2 && (this._renderTargets = [new p(this._width, this._height, {
|
|
1259
1244
|
samples: this._samples,
|
|
1260
|
-
format:
|
|
1261
|
-
type:
|
|
1262
|
-
magFilter:
|
|
1263
|
-
minFilter:
|
|
1264
|
-
}), new
|
|
1245
|
+
format: _,
|
|
1246
|
+
type: N,
|
|
1247
|
+
magFilter: V,
|
|
1248
|
+
minFilter: V
|
|
1249
|
+
}), new p(this._width, this._height, {
|
|
1265
1250
|
samples: this._samples,
|
|
1266
|
-
format:
|
|
1267
|
-
type:
|
|
1268
|
-
magFilter:
|
|
1269
|
-
minFilter:
|
|
1251
|
+
format: _,
|
|
1252
|
+
type: N,
|
|
1253
|
+
magFilter: V,
|
|
1254
|
+
minFilter: V
|
|
1270
1255
|
})]), this._renderTargets;
|
|
1271
1256
|
}
|
|
1272
1257
|
dispose() {
|
|
@@ -1276,7 +1261,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1276
1261
|
this._width = e, this._height = t, this._renderTargets.forEach((n) => n.setSize(e, t)), this.needsUpdate = !0;
|
|
1277
1262
|
}
|
|
1278
1263
|
updateBounds(e) {
|
|
1279
|
-
this._sceneClipBox = new
|
|
1264
|
+
this._sceneClipBox = new C().copy(e), this.needsUpdate = !0;
|
|
1280
1265
|
}
|
|
1281
1266
|
updateParameters(e) {
|
|
1282
1267
|
for (let t in e) this.parameters.hasOwnProperty(t) && (this.parameters[t] = e[t], this.needsUpdate = !0);
|
|
@@ -1305,7 +1290,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1305
1290
|
HARD: "hard",
|
|
1306
1291
|
POISSON: "poisson",
|
|
1307
1292
|
FULL: "full"
|
|
1308
|
-
},
|
|
1293
|
+
}, $e = { shadowRadius: .05 }, Q = {
|
|
1309
1294
|
enabled: !0,
|
|
1310
1295
|
applyToMaterial: !0,
|
|
1311
1296
|
aoIntensity: .5,
|
|
@@ -1314,12 +1299,12 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1314
1299
|
shadowOnGround: !1,
|
|
1315
1300
|
alwaysUpdate: !1,
|
|
1316
1301
|
progressiveDenoiseIterations: 0
|
|
1317
|
-
},
|
|
1302
|
+
}, et = class extends J {
|
|
1318
1303
|
static {
|
|
1319
|
-
this.shadowTransform = new
|
|
1304
|
+
this.shadowTransform = new P().set(0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1);
|
|
1320
1305
|
}
|
|
1321
1306
|
get aoAndSoftShadowRenderTarget() {
|
|
1322
|
-
return this._aoAndSoftShadowRenderTarget = this._aoAndSoftShadowRenderTarget ?? new
|
|
1307
|
+
return this._aoAndSoftShadowRenderTarget = this._aoAndSoftShadowRenderTarget ?? new p(this._width, this._height, {
|
|
1323
1308
|
samples: this._samples,
|
|
1324
1309
|
format: 1030,
|
|
1325
1310
|
magFilter: this._samples > 1 ? 1006 : 1003,
|
|
@@ -1327,7 +1312,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1327
1312
|
}), this._aoAndSoftShadowRenderTarget;
|
|
1328
1313
|
}
|
|
1329
1314
|
get aoRenderPass() {
|
|
1330
|
-
return this._aoPass ||= new
|
|
1315
|
+
return this._aoPass ||= new Ge(this._width, this._height, this._samples, !this.parameters.applyToMaterial, {
|
|
1331
1316
|
normalVectorSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? Y.FLOAT_BUFFER_NORMAL : Y.INPUT_RGB_NORMAL,
|
|
1332
1317
|
depthValueSourceType: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? X.NORMAL_VECTOR_ALPHA : X.SEPARATE_BUFFER,
|
|
1333
1318
|
modulateRedChannel: !0,
|
|
@@ -1335,7 +1320,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1335
1320
|
}), this._aoPass;
|
|
1336
1321
|
}
|
|
1337
1322
|
get softShadowPass() {
|
|
1338
|
-
if (!this._softShadowPass) this._softShadowPass = new
|
|
1323
|
+
if (!this._softShadowPass) this._softShadowPass = new Qe(this._width, this._height, this._samples, {
|
|
1339
1324
|
inputTexture: void 0,
|
|
1340
1325
|
depthTexture: this.gBufferTextures.depthBufferTexture,
|
|
1341
1326
|
normalTexture: this.gBufferTextures.gBufferTexture,
|
|
@@ -1363,7 +1348,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1363
1348
|
return this._softShadowPass;
|
|
1364
1349
|
}
|
|
1365
1350
|
get fadeRenderTarget() {
|
|
1366
|
-
return this._fadeRenderTarget = this._fadeRenderTarget ?? new
|
|
1351
|
+
return this._fadeRenderTarget = this._fadeRenderTarget ?? new p(this._width, this._height, {
|
|
1367
1352
|
samples: this._samples,
|
|
1368
1353
|
format: 1030,
|
|
1369
1354
|
magFilter: this._samples > 1 ? 1006 : 1003,
|
|
@@ -1371,7 +1356,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1371
1356
|
}), this._fadeRenderTarget;
|
|
1372
1357
|
}
|
|
1373
1358
|
get denoisePass() {
|
|
1374
|
-
if (!this._poissonDenoisePass) this._poissonDenoisePass = new
|
|
1359
|
+
if (!this._poissonDenoisePass) this._poissonDenoisePass = new Qe(this._width, this._height, this._samples, {
|
|
1375
1360
|
inputTexture: this.aoAndSoftShadowRenderTarget.texture,
|
|
1376
1361
|
depthTexture: this.gBufferTextures.depthBufferTexture,
|
|
1377
1362
|
normalTexture: this.gBufferTextures.gBufferTexture,
|
|
@@ -1401,7 +1386,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1401
1386
|
shadowFadeInBlurType: Z.FULL,
|
|
1402
1387
|
shadowFadeInMix: 0,
|
|
1403
1388
|
noOStaticFrames: 0
|
|
1404
|
-
}, this._cameraUpdate = new
|
|
1389
|
+
}, this._cameraUpdate = new Pe(), this._finalTexture = null, this._onlyHardShadow = !1, this._width = t, this._height = n, this._samples = r, this.parameters = {
|
|
1405
1390
|
enabled: i?.enabled ?? Q.enabled,
|
|
1406
1391
|
applyToMaterial: i?.applyToMaterial ?? Q.applyToMaterial,
|
|
1407
1392
|
aoIntensity: i?.aoIntensity ?? Q.aoIntensity,
|
|
@@ -1410,10 +1395,10 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1410
1395
|
shadowOnGround: i?.shadowOnGround ?? Q.shadowOnGround,
|
|
1411
1396
|
alwaysUpdate: i?.alwaysUpdate ?? Q.alwaysUpdate,
|
|
1412
1397
|
progressiveDenoiseIterations: i?.progressiveDenoiseIterations ?? Q.progressiveDenoiseIterations,
|
|
1413
|
-
shadow: {
|
|
1414
|
-
ao: { ...
|
|
1415
|
-
poissonDenoise: { ...
|
|
1416
|
-
}, this._copyMaterial = new
|
|
1398
|
+
shadow: { ...$e },
|
|
1399
|
+
ao: { ...We },
|
|
1400
|
+
poissonDenoise: { ...Ze }
|
|
1401
|
+
}, this._copyMaterial = new Se(), this._blendMaterial = new Se({}, xe.DEFAULT), this._blendAoAndShadowMaterial = new qe();
|
|
1417
1402
|
}
|
|
1418
1403
|
dispose() {
|
|
1419
1404
|
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();
|
|
@@ -1482,13 +1467,13 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1482
1467
|
return i && (this._copyMaterial.update({
|
|
1483
1468
|
texture: t,
|
|
1484
1469
|
blending: 0,
|
|
1485
|
-
colorTransform:
|
|
1470
|
+
colorTransform: H,
|
|
1486
1471
|
colorBase: W,
|
|
1487
1472
|
multiplyChannels: 0
|
|
1488
1473
|
}), this.passRenderer.renderScreenSpace(e, this._copyMaterial, this.fadeRenderTarget)), r > .001 && (this._blendMaterial.update({
|
|
1489
1474
|
texture: n,
|
|
1490
1475
|
blending: i ? 5 : 0,
|
|
1491
|
-
colorTransform: new
|
|
1476
|
+
colorTransform: new P().set(0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, i ? r : 1),
|
|
1492
1477
|
multiplyChannels: 0
|
|
1493
1478
|
}), this.passRenderer.renderScreenSpace(e, this._blendMaterial, this.fadeRenderTarget)), this.fadeRenderTarget.texture;
|
|
1494
1479
|
}
|
|
@@ -1505,7 +1490,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1505
1490
|
shadowIntensity: n
|
|
1506
1491
|
}), e.getRenderTarget());
|
|
1507
1492
|
}
|
|
1508
|
-
},
|
|
1493
|
+
}, tt = class {
|
|
1509
1494
|
get isOutlinePassActivated() {
|
|
1510
1495
|
return this.outlinePassActivated;
|
|
1511
1496
|
}
|
|
@@ -1545,16 +1530,16 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1545
1530
|
updateOutline(e, t, n) {
|
|
1546
1531
|
n.length > 0 ? (this.activateOutline(e, t), this.outlinePass && (this.outlinePass.selectedObjects = n)) : this.deactivateOutline();
|
|
1547
1532
|
}
|
|
1548
|
-
},
|
|
1533
|
+
}, nt = {
|
|
1549
1534
|
DEFAULT: "default",
|
|
1550
1535
|
BRIGHT: "bright"
|
|
1551
|
-
},
|
|
1536
|
+
}, rt = {
|
|
1552
1537
|
shadowType: "PCFShadowMap",
|
|
1553
1538
|
shAndAoPassParameters: {
|
|
1554
1539
|
aoIntensity: .3,
|
|
1555
1540
|
shadow: { shadowRadius: .1 },
|
|
1556
1541
|
ao: {
|
|
1557
|
-
algorithm:
|
|
1542
|
+
algorithm: Be.SSAO,
|
|
1558
1543
|
samples: 32,
|
|
1559
1544
|
radius: .02,
|
|
1560
1545
|
distanceExponent: 2,
|
|
@@ -1573,13 +1558,13 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1573
1558
|
}
|
|
1574
1559
|
},
|
|
1575
1560
|
groundReflectionParameters: { brightness: .5 }
|
|
1576
|
-
},
|
|
1561
|
+
}, it = (...e) => {
|
|
1577
1562
|
if (e.length === 0) return null;
|
|
1578
1563
|
if (e.length === 1) return e[0];
|
|
1579
1564
|
let t = e[0];
|
|
1580
|
-
for (let n = 1; n < e.length; n++) t =
|
|
1565
|
+
for (let n = 1; n < e.length; n++) t = fe(t, e[n]);
|
|
1581
1566
|
return t;
|
|
1582
|
-
},
|
|
1567
|
+
}, at = (e) => e ? { groundReflectionParameters: { enabled: !1 } } : null, ot = (e) => !e || e === nt.DEFAULT ? null : e === nt.BRIGHT ? rt : null, $ = (e) => Math.max(0, Math.min(1, e)), st = (e) => {
|
|
1583
1568
|
let t = {
|
|
1584
1569
|
shAndAoPassParameters: {
|
|
1585
1570
|
ao: {},
|
|
@@ -1588,14 +1573,14 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1588
1573
|
groundReflectionParameters: {},
|
|
1589
1574
|
bakedGroundContactShadowParameters: {}
|
|
1590
1575
|
};
|
|
1591
|
-
return
|
|
1592
|
-
},
|
|
1576
|
+
return ct(t, e), lt(t, e), ut(t, e), t;
|
|
1577
|
+
}, ct = (e, t) => {
|
|
1593
1578
|
t.aoIntensity !== void 0 && (e.shAndAoPassParameters.aoIntensity = $(t.aoIntensity)), t.aoExtent !== void 0 && (e.shAndAoPassParameters.ao.radius = $(t.aoExtent) * .3, e.shAndAoPassParameters.ao.thickness = .1 + $(t.aoExtent) * .2);
|
|
1594
|
-
},
|
|
1579
|
+
}, lt = (e, t) => {
|
|
1595
1580
|
t.shBakedOnGround ? (e.bakedGroundContactShadowParameters.enabled = !0, e.shAndAoPassParameters.shadowIntensity = 0, t.shadowIntensity !== void 0 && (e.bakedGroundContactShadowParameters.opacity = $(t.shadowIntensity)), t.shadowIntensity !== void 0 && (e.bakedGroundContactShadowParameters.blurMax = $(t.shadowIntensity) * .1, e.bakedGroundContactShadowParameters.blurMin = e.bakedGroundContactShadowParameters.blurMax * .01)) : (t.shBakedOnGround !== void 0 && (e.bakedGroundContactShadowParameters.enabled = !1), t.shadowIntensity !== void 0 && (e.shAndAoPassParameters.shadowIntensity = $(t.shadowIntensity)), t.shadowSoftening !== void 0 && (e.shAndAoPassParameters.shadow.shadowRadius = .001 + $(t.shadowSoftening) * .2));
|
|
1596
|
-
},
|
|
1581
|
+
}, ut = (e, t) => {
|
|
1597
1582
|
t.grReflectIntensity !== void 0 && (e.groundReflectionParameters.enabled = t.grReflectIntensity > 0, e.groundReflectionParameters.intensity = $(t.grReflectIntensity)), t.grReflectFadeOut !== void 0 && (e.groundReflectionParameters.fadeOutDistance = (1 - $(t.grReflectFadeOut)) * 4);
|
|
1598
|
-
},
|
|
1583
|
+
}, dt = (e, t) => Array.isArray(e) ? e.some((e) => dt(e, t)) : e.transparent && e.opacity < t || e.alphaTest > 0, ft = (e) => Array.isArray(e) ? e.some((e) => ft(e)) : e instanceof O && e.transmission > 0, pt = class {
|
|
1599
1584
|
constructor(e) {
|
|
1600
1585
|
this.needsUpdate = !0, this._cache = null, this._cache = e;
|
|
1601
1586
|
}
|
|
@@ -1616,7 +1601,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1616
1601
|
onAfterRender() {
|
|
1617
1602
|
this._cache?.onAfterRender();
|
|
1618
1603
|
}
|
|
1619
|
-
},
|
|
1604
|
+
}, mt = class {
|
|
1620
1605
|
constructor() {
|
|
1621
1606
|
this._cacheMap = /* @__PURE__ */ new Map();
|
|
1622
1607
|
}
|
|
@@ -1626,7 +1611,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1626
1611
|
});
|
|
1627
1612
|
}
|
|
1628
1613
|
registerCache(e, t) {
|
|
1629
|
-
this._cacheMap.set(e, new
|
|
1614
|
+
this._cacheMap.set(e, new pt(t));
|
|
1630
1615
|
}
|
|
1631
1616
|
clearCache() {
|
|
1632
1617
|
this._cacheMap.forEach((e) => {
|
|
@@ -1649,7 +1634,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1649
1634
|
let r = this._cacheMap.get(e);
|
|
1650
1635
|
r && (r.update(t), r.onBeforeRender()), n(), r && r.onAfterRender();
|
|
1651
1636
|
}
|
|
1652
|
-
},
|
|
1637
|
+
}, ht = class {
|
|
1653
1638
|
constructor(e) {
|
|
1654
1639
|
this._visibilityCache = /* @__PURE__ */ new Map(), this._isObjectInvisible = e;
|
|
1655
1640
|
}
|
|
@@ -1678,7 +1663,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1678
1663
|
t.visible = e;
|
|
1679
1664
|
});
|
|
1680
1665
|
}
|
|
1681
|
-
},
|
|
1666
|
+
}, gt = class {
|
|
1682
1667
|
constructor(e) {
|
|
1683
1668
|
this._depthWriteCache = /* @__PURE__ */ new Set(), this._doNotWriteDepth = e;
|
|
1684
1669
|
}
|
|
@@ -1691,7 +1676,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1691
1676
|
addLineOrPoint(e) {}
|
|
1692
1677
|
addObject(e) {}
|
|
1693
1678
|
addMesh(e) {
|
|
1694
|
-
this._doNotWriteDepth && this._doNotWriteDepth(e) && e.material instanceof
|
|
1679
|
+
this._doNotWriteDepth && this._doNotWriteDepth(e) && e.material instanceof D && e.material.depthWrite && this._depthWriteCache.add(e.material);
|
|
1695
1680
|
}
|
|
1696
1681
|
onBeforeRender() {
|
|
1697
1682
|
this._depthWriteCache.forEach((e) => {
|
|
@@ -1703,7 +1688,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1703
1688
|
e.depthWrite = !0;
|
|
1704
1689
|
});
|
|
1705
1690
|
}
|
|
1706
|
-
},
|
|
1691
|
+
}, _t = class {
|
|
1707
1692
|
constructor() {
|
|
1708
1693
|
this._objectCache = /* @__PURE__ */ new Map();
|
|
1709
1694
|
}
|
|
@@ -1712,7 +1697,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1712
1697
|
}
|
|
1713
1698
|
onBeforeRender() {
|
|
1714
1699
|
this._objectCache.forEach((e, t) => {
|
|
1715
|
-
t instanceof
|
|
1700
|
+
t instanceof R && (t.material !== e.originalObjectData.material && t.material !== e.updateObjectData.material && (e.originalObjectData.material = t.material), t.receiveShadow !== e.originalObjectData.receiveShadow && (e.originalObjectData.receiveShadow = t.receiveShadow), t.castShadow !== e.originalObjectData.castShadow && (e.originalObjectData.castShadow = t.castShadow), t.visible !== e.originalObjectData.visible && (e.originalObjectData.visible = t.visible)), this._updateObject(t, e.updateObjectData);
|
|
1716
1701
|
});
|
|
1717
1702
|
}
|
|
1718
1703
|
onAfterRender() {
|
|
@@ -1725,35 +1710,35 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1725
1710
|
originalObjectData: {
|
|
1726
1711
|
visible: e.visible,
|
|
1727
1712
|
castShadow: e.castShadow,
|
|
1728
|
-
receiveShadow: e instanceof
|
|
1729
|
-
material: e instanceof
|
|
1713
|
+
receiveShadow: e instanceof R ? e.receiveShadow : void 0,
|
|
1714
|
+
material: e instanceof R ? e.material : void 0
|
|
1730
1715
|
},
|
|
1731
1716
|
updateObjectData: t
|
|
1732
1717
|
});
|
|
1733
1718
|
}
|
|
1734
1719
|
_updateObject(e, t) {
|
|
1735
|
-
t.visible !== void 0 && (e.visible = t.visible), t.castShadow !== void 0 && (e.castShadow = t.castShadow), e instanceof
|
|
1720
|
+
t.visible !== void 0 && (e.visible = t.visible), t.castShadow !== void 0 && (e.castShadow = t.castShadow), e instanceof R && t.receiveShadow !== void 0 && (e.receiveShadow = t.receiveShadow), e instanceof R && t.material !== void 0 && (e.material = t.material);
|
|
1736
1721
|
}
|
|
1737
|
-
},
|
|
1722
|
+
}, vt = (e) => {
|
|
1738
1723
|
if (!e.isMesh || !e.castShadow && !e.userData?.meshId) return !1;
|
|
1739
1724
|
let t = e.material;
|
|
1740
1725
|
return !t.transparent || t.opacity > .5;
|
|
1741
|
-
},
|
|
1726
|
+
}, yt = class extends J {
|
|
1742
1727
|
static {
|
|
1743
1728
|
this.addTestMesh = !1;
|
|
1744
1729
|
}
|
|
1745
1730
|
get shadowGroundPlane() {
|
|
1746
1731
|
let e = this._sharedShadowGroundPlane;
|
|
1747
|
-
return e ||= (this._shadowGroundPlane ??= new
|
|
1732
|
+
return e ||= (this._shadowGroundPlane ??= new ze(this.renderTarget.texture, this.parameters), this._shadowGroundPlane), e.parent !== this._groundGroup && this._groundGroup.add(e), e;
|
|
1748
1733
|
}
|
|
1749
1734
|
constructor(e, t, n, r) {
|
|
1750
|
-
super(e), this.limitPlaneSize = !0, this.needsUpdate = !0, this.noNeedOfUpdateCount = 0, this._blurScale = 1, this._shadowScale = 1, this._groundGroup = n, this.shadowMapSize = r.shadowMapSize ?? 2048, this.parameters = this._getDefaultParameters(r), this._groundShadowFar = this.parameters.cameraFar, this._renderer = t, this.renderCacheManager?.registerCache(this, new
|
|
1735
|
+
super(e), this.limitPlaneSize = !0, this.needsUpdate = !0, this.noNeedOfUpdateCount = 0, this._blurScale = 1, this._shadowScale = 1, this._groundGroup = n, this.shadowMapSize = r.shadowMapSize ?? 2048, this.parameters = this._getDefaultParameters(r), this._groundShadowFar = this.parameters.cameraFar, this._renderer = t, this.renderCacheManager?.registerCache(this, new ht((e) => e.isMesh && !vt(e) || e.name !== void 0 && ["Ground", "Floor"].includes(e.name))), this.renderTarget = new p(this.shadowMapSize, this.shadowMapSize), this.renderTarget.texture.generateMipmaps = !1, this._renderTargetBlur = new p(this.shadowMapSize, this.shadowMapSize), this._renderTargetBlur.texture.generateMipmaps = !1, this._sharedShadowGroundPlane = r?.sharedShadowGroundPlane, this.shadowGroundPlane.setShadowMap(this.renderTarget.texture), this.shadowGroundPlane.updateMaterial(this.parameters), this._groundContactCamera = new bt(), this._groundGroup.add(this._groundContactCamera), this._depthMaterial = new ne(), this._depthMaterial.userData.fadeoutBias = { value: this.parameters.fadeoutBias }, this._depthMaterial.userData.fadeoutFalloff = { value: this.parameters.fadeoutFalloff }, this._depthMaterial.onBeforeCompile = (e) => {
|
|
1751
1736
|
e.uniforms.fadeoutBias = this._depthMaterial.userData.fadeoutBias, e.uniforms.fadeoutFalloff = this._depthMaterial.userData.fadeoutFalloff, e.fragmentShader = `
|
|
1752
1737
|
uniform float fadeoutBias;
|
|
1753
1738
|
uniform float fadeoutFalloff;
|
|
1754
|
-
${e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );",
|
|
1739
|
+
${e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );", ze.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));")}
|
|
1755
1740
|
`;
|
|
1756
|
-
}, this._depthMaterial.side = 2, this._depthMaterial.depthTest = !0, this._depthMaterial.depthWrite = !0, this._blurPass = new
|
|
1741
|
+
}, this._depthMaterial.side = 2, this._depthMaterial.depthTest = !0, this._depthMaterial.depthWrite = !0, this._blurPass = new Re(Ce, {
|
|
1757
1742
|
...r,
|
|
1758
1743
|
passRenderer: this.renderPassManager.passRenderer
|
|
1759
1744
|
}), this.updatePlaneAndShadowCamera();
|
|
@@ -1843,7 +1828,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1843
1828
|
this.renderTarget
|
|
1844
1829
|
], [e, e], [t, t]);
|
|
1845
1830
|
}
|
|
1846
|
-
},
|
|
1831
|
+
}, bt = class extends m {
|
|
1847
1832
|
constructor() {
|
|
1848
1833
|
super(-1, 1, -1, 1, -1, 1), this.rotation.x = Math.PI;
|
|
1849
1834
|
}
|
|
@@ -1854,12 +1839,12 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1854
1839
|
this.far = e, this.updateProjectionMatrix(), this.cameraHelper?.update();
|
|
1855
1840
|
}
|
|
1856
1841
|
updateCameraHelper(e, t) {
|
|
1857
|
-
e ? (this.cameraHelper = this.cameraHelper ?? new
|
|
1842
|
+
e ? (this.cameraHelper = this.cameraHelper ?? new ce(this), this.cameraHelper.visible = !0, t?.add(this.cameraHelper)) : this.cameraHelper?.parent && this.cameraHelper?.removeFromParent();
|
|
1858
1843
|
}
|
|
1859
1844
|
setCameraHelperVisibility(e) {
|
|
1860
1845
|
this.cameraHelper && (this.cameraHelper.visible = e);
|
|
1861
1846
|
}
|
|
1862
|
-
},
|
|
1847
|
+
}, xt = "varying vec3 vNormal;\n#if LINEAR_DEPTH == 1\n varying float vZ; \n#endif\n\n void main() {\n vNormal = normalMatrix * normal;\n vec4 viewPosition = modelViewMatrix * vec4(position, 1.0);\n #if LINEAR_DEPTH == 1\n vZ = viewPosition.z; \n #endif\n gl_Position = projectionMatrix * viewPosition;\n }", St = "varying vec3 vNormal;\n#if LINEAR_DEPTH == 1\n varying float vZ; \n uniform float cameraNear;\n uniform float cameraFar;\n#endif\n\n void main() {\n #if FLOAT_BUFFER == 1\n vec3 normal = normalize(vNormal);\n #else\n vec3 normal = normalize(vNormal) * 0.5 + 0.5;\n #endif\n #if LINEAR_DEPTH == 1\n float depth = (-vZ - cameraNear) / (cameraFar - cameraNear);\n #else\n float depth = gl_FragCoord.z;\n #endif\n gl_FragColor = vec4(normal, depth);\n }", Ct = class e extends a {
|
|
1863
1848
|
static {
|
|
1864
1849
|
this._normalAndDepthShader = {
|
|
1865
1850
|
uniforms: {
|
|
@@ -1870,8 +1855,8 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1870
1855
|
FLOAT_BUFFER: 0,
|
|
1871
1856
|
LINEAR_DEPTH: 0
|
|
1872
1857
|
},
|
|
1873
|
-
vertexShader:
|
|
1874
|
-
fragmentShader:
|
|
1858
|
+
vertexShader: xt,
|
|
1859
|
+
fragmentShader: St
|
|
1875
1860
|
};
|
|
1876
1861
|
}
|
|
1877
1862
|
constructor(t) {
|
|
@@ -1881,7 +1866,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1881
1866
|
FLOAT_BUFFER: t?.floatBufferType ? 1 : 0,
|
|
1882
1867
|
LINEAR_DEPTH: t?.linearDepth ? 1 : 0
|
|
1883
1868
|
}),
|
|
1884
|
-
uniforms:
|
|
1869
|
+
uniforms: w.clone(e._normalAndDepthShader.uniforms),
|
|
1885
1870
|
vertexShader: e._normalAndDepthShader.vertexShader,
|
|
1886
1871
|
fragmentShader: e._normalAndDepthShader.fragmentShader,
|
|
1887
1872
|
blending: t?.blending ?? 0
|
|
@@ -1894,7 +1879,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1894
1879
|
}
|
|
1895
1880
|
return this;
|
|
1896
1881
|
}
|
|
1897
|
-
},
|
|
1882
|
+
}, wt = class extends J {
|
|
1898
1883
|
set groundDepthWrite(e) {
|
|
1899
1884
|
this._gBufferMaterialCache && (this._gBufferMaterialCache.groundDepthWrite = e);
|
|
1900
1885
|
}
|
|
@@ -1911,22 +1896,22 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1911
1896
|
return this.floatRgbNormalAlphaDepth ? this.depthNormalRenderTarget.texture : this.depthNormalRenderTarget.depthTexture;
|
|
1912
1897
|
}
|
|
1913
1898
|
updateGBufferRenderMaterial(e) {
|
|
1914
|
-
return this._gBufferRenderMaterial = this._gBufferRenderMaterial ?? (this.floatRgbNormalAlphaDepth ? new
|
|
1899
|
+
return this._gBufferRenderMaterial = this._gBufferRenderMaterial ?? (this.floatRgbNormalAlphaDepth ? new Ct({
|
|
1915
1900
|
blending: 0,
|
|
1916
1901
|
floatBufferType: !0,
|
|
1917
1902
|
linearDepth: !1
|
|
1918
|
-
}) : new
|
|
1903
|
+
}) : new ae({ blending: 0 })), this._gBufferRenderMaterial instanceof Ct && this._gBufferRenderMaterial.update({ camera: e }), this._gBufferRenderMaterial;
|
|
1919
1904
|
}
|
|
1920
1905
|
get depthNormalRenderTarget() {
|
|
1921
|
-
if (!this._depthNormalRenderTarget) if (this.floatRgbNormalAlphaDepth) this._depthNormalRenderTarget = new
|
|
1906
|
+
if (!this._depthNormalRenderTarget) if (this.floatRgbNormalAlphaDepth) this._depthNormalRenderTarget = new p(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale, {
|
|
1922
1907
|
minFilter: this._targetMinificationTextureFilter,
|
|
1923
1908
|
magFilter: this._targetMagnificationTextureFilter,
|
|
1924
|
-
type:
|
|
1909
|
+
type: oe,
|
|
1925
1910
|
samples: this._samples
|
|
1926
1911
|
});
|
|
1927
1912
|
else {
|
|
1928
|
-
let e = new
|
|
1929
|
-
e.format =
|
|
1913
|
+
let e = new o(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale);
|
|
1914
|
+
e.format = I, e.type = j, this._depthNormalRenderTarget = new p(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale, {
|
|
1930
1915
|
minFilter: this._targetMinificationTextureFilter,
|
|
1931
1916
|
magFilter: this._targetMagnificationTextureFilter,
|
|
1932
1917
|
depthTexture: e
|
|
@@ -1935,15 +1920,15 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1935
1920
|
return this._depthNormalRenderTarget;
|
|
1936
1921
|
}
|
|
1937
1922
|
get separateDeptRenderTarget() {
|
|
1938
|
-
return this._separateDeptRenderTarget ||= new
|
|
1923
|
+
return this._separateDeptRenderTarget ||= new p(this._width * this.parameters.depthNormalScale, this._height * this.parameters.depthNormalScale, {
|
|
1939
1924
|
minFilter: this._targetMinificationTextureFilter,
|
|
1940
1925
|
magFilter: this._targetMagnificationTextureFilter,
|
|
1941
|
-
type:
|
|
1926
|
+
type: oe,
|
|
1942
1927
|
samples: 0
|
|
1943
1928
|
}), this._separateDeptRenderTarget;
|
|
1944
1929
|
}
|
|
1945
1930
|
constructor(e, t) {
|
|
1946
|
-
super(e), this.floatRgbNormalAlphaDepth = !1, this.linearDepth = !1, this.copyToSeparateDepthBuffer = !1, this.needsUpdate = !0, this.drawGround = !0, this.floatRgbNormalAlphaDepth = t?.capabilities?.isWebGL2 ?? !1, this.renderCacheManager && (this._gBufferMaterialCache = new
|
|
1931
|
+
super(e), this.floatRgbNormalAlphaDepth = !1, this.linearDepth = !1, this.copyToSeparateDepthBuffer = !1, this.needsUpdate = !0, this.drawGround = !0, this.floatRgbNormalAlphaDepth = t?.capabilities?.isWebGL2 ?? !1, this.renderCacheManager && (this._gBufferMaterialCache = new Tt(), this.renderCacheManager.registerCache(this, this._gBufferMaterialCache)), this.parameters = { depthNormalScale: t?.depthNormalScale ?? 1 }, this._targetMinificationTextureFilter = t?.textureMinificationFilter ?? 1003, this._targetMagnificationTextureFilter = t?.textureMagnificationFilter ?? 1003, this._width = t?.width ?? 1024, this._height = t?.height ?? 1024, this._samples = t?.samples ?? 0, this._shared = t?.shared ?? !1;
|
|
1947
1932
|
}
|
|
1948
1933
|
dispose() {
|
|
1949
1934
|
super.dispose(), this._gBufferRenderMaterial?.dispose(), this._depthNormalRenderTarget?.dispose();
|
|
@@ -1960,19 +1945,19 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1960
1945
|
this.passRenderer.renderWithOverrideMaterial(e, t, n, this.updateGBufferRenderMaterial(n), this.depthNormalRenderTarget, 7829503, 1);
|
|
1961
1946
|
}
|
|
1962
1947
|
getCopyMaterial(e) {
|
|
1963
|
-
return this._copyMaterial ??= new
|
|
1948
|
+
return this._copyMaterial ??= new Se(), this._copyMaterial.update(e);
|
|
1964
1949
|
}
|
|
1965
1950
|
_copyDepthToSeparateDepthTexture(e, t) {
|
|
1966
1951
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
1967
1952
|
texture: t.texture,
|
|
1968
1953
|
blending: 0,
|
|
1969
|
-
colorTransform:
|
|
1954
|
+
colorTransform: ve,
|
|
1970
1955
|
colorBase: G,
|
|
1971
1956
|
multiplyChannels: 0,
|
|
1972
1957
|
uvTransform: K
|
|
1973
1958
|
}), this.separateDeptRenderTarget);
|
|
1974
1959
|
}
|
|
1975
|
-
},
|
|
1960
|
+
}, Tt = class extends _t {
|
|
1976
1961
|
set groundDepthWrite(e) {
|
|
1977
1962
|
this._groundDepthWrite = e;
|
|
1978
1963
|
}
|
|
@@ -1984,12 +1969,12 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
1984
1969
|
this.addToCache(e, { visible: !1 });
|
|
1985
1970
|
}
|
|
1986
1971
|
addMesh(e) {
|
|
1987
|
-
e.userData.isFloor ? this.addToCache(e, { visible: this._groundDepthWrite }) : e.visible && (
|
|
1972
|
+
e.userData.isFloor ? this.addToCache(e, { visible: this._groundDepthWrite }) : e.visible && (dt(e.material, .7) || ft(e.material)) && this.addToCache(e, { visible: !1 });
|
|
1988
1973
|
}
|
|
1989
1974
|
addObject(e) {
|
|
1990
1975
|
e.name === "dimensioning" && this.addToCache(e, { visible: !1 });
|
|
1991
1976
|
}
|
|
1992
|
-
},
|
|
1977
|
+
}, Et = class extends J {
|
|
1993
1978
|
get reflectionRenderTarget() {
|
|
1994
1979
|
return this._reflectionRenderTarget = this._reflectionRenderTarget ?? this._newRenderTarget(!0), this._reflectionRenderTarget;
|
|
1995
1980
|
}
|
|
@@ -2013,18 +1998,18 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2013
1998
|
groundReflectionScale: 1,
|
|
2014
1999
|
renderTargetDownScale: 4,
|
|
2015
2000
|
...i
|
|
2016
|
-
}, this._copyMaterial = new
|
|
2001
|
+
}, this._copyMaterial = new Se({}, xe.ADDITIVE, !0, !0), this._updateCopyMaterial(null), this._reflectionIntensityMaterial = new kt({
|
|
2017
2002
|
width: this._width / this.parameters.renderTargetDownScale,
|
|
2018
2003
|
height: this._height / this.parameters.renderTargetDownScale
|
|
2019
|
-
}), this._blurPass = new
|
|
2004
|
+
}), this._blurPass = new Re(Ce, {
|
|
2020
2005
|
...i,
|
|
2021
2006
|
passRenderer: this.renderPassManager.passRenderer
|
|
2022
2007
|
});
|
|
2023
2008
|
}
|
|
2024
2009
|
_newRenderTarget(e) {
|
|
2025
2010
|
let t = this._width / this.parameters.renderTargetDownScale, n = this._height / this.parameters.renderTargetDownScale, r = {};
|
|
2026
|
-
return e ? (r.depthTexture = new
|
|
2027
|
-
format:
|
|
2011
|
+
return e ? (r.depthTexture = new o(t, n), r.samples = this._samples) : r.samples = 1, new p(t, n, {
|
|
2012
|
+
format: _,
|
|
2028
2013
|
...r
|
|
2029
2014
|
});
|
|
2030
2015
|
}
|
|
@@ -2047,17 +2032,17 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2047
2032
|
let n = this.parameters.intensity * t, r = this.parameters.brightness;
|
|
2048
2033
|
this._copyMaterial.update({
|
|
2049
2034
|
texture: e?.texture ?? void 0,
|
|
2050
|
-
colorTransform: new
|
|
2035
|
+
colorTransform: new P().set(r, 0, 0, 0, 0, r, 0, 0, 0, 0, r, 0, 0, 0, 0, n),
|
|
2051
2036
|
multiplyChannels: 0,
|
|
2052
|
-
uvTransform:
|
|
2037
|
+
uvTransform: be
|
|
2053
2038
|
}), this._copyMaterial.depthTest = !0, this._copyMaterial.depthWrite = !1;
|
|
2054
2039
|
}
|
|
2055
2040
|
renderPass(e) {
|
|
2056
|
-
if (!this.parameters.enabled || !(this.camera instanceof
|
|
2057
|
-
let
|
|
2041
|
+
if (!this.parameters.enabled || !(this.camera instanceof i)) return;
|
|
2042
|
+
let t = this._createGroundReflectionCamera(this.camera);
|
|
2058
2043
|
this.renderCacheManager.render("groundReflection", this.scene, () => {
|
|
2059
|
-
this._renderGroundReflection(e, this.scene,
|
|
2060
|
-
}), this._renderGroundReflectionIntensity(e,
|
|
2044
|
+
this._renderGroundReflection(e, this.scene, t, this.reflectionRenderTarget);
|
|
2045
|
+
}), this._renderGroundReflectionIntensity(e, t, this.intensityRenderTarget), (this.parameters.blurHorizontal > 0 || this.parameters.blurVertical > 0) && this.blurReflection(e, this.camera, [
|
|
2061
2046
|
this.intensityRenderTarget,
|
|
2062
2047
|
this.blurRenderTarget,
|
|
2063
2048
|
this.intensityRenderTarget
|
|
@@ -2079,7 +2064,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2079
2064
|
}), e.getRenderTarget()), e.setRenderTarget(r);
|
|
2080
2065
|
}
|
|
2081
2066
|
blurReflection(e, t, n) {
|
|
2082
|
-
let r = new
|
|
2067
|
+
let r = new B(t.matrixWorld.elements[4], t.matrixWorld.elements[5], t.matrixWorld.elements[6]), i = this.parameters.blurHorizontal / this._width, a = this.parameters.blurVertical / this._height * Math.abs(r.dot(new B(0, 0, 1)));
|
|
2083
2068
|
this._blurPass.render(e, n, [i * 4, a * 4], [i * 4 * (1 + this.parameters.blurAscent), a * 4 * (1 + this.parameters.blurAscent)]);
|
|
2084
2069
|
}
|
|
2085
2070
|
_createGroundReflectionCamera(e) {
|
|
@@ -2091,18 +2076,18 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2091
2076
|
bottom: 1 - n._offset.top
|
|
2092
2077
|
}, t.position.set(e.position.x, -e.position.y + 2 * this.parameters.groundLevel, e.position.z), t.rotation.set(-e.rotation.x, e.rotation.y, -e.rotation.z), t.updateMatrixWorld(), t.updateProjectionMatrix(), t;
|
|
2093
2078
|
}
|
|
2094
|
-
},
|
|
2079
|
+
}, Dt = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }", Ot = "\n uniform sampler2D tDiffuse;\n uniform sampler2D tDepth;\n uniform vec2 resolution;\n uniform float cameraNear;\n uniform float cameraFar;\n uniform mat4 cameraProjectionMatrix;\n uniform mat4 cameraInverseProjectionMatrix;\n uniform mat4 inverseViewMatrix;\n uniform float groundLevel;\n uniform float fadeOutDistance;\n uniform float fadeOutExponent;\n varying vec2 vUv;\n\n #include <packing>\n\n float getDepth(const in vec2 screenPosition) {\n return texture2D(tDepth, screenPosition).x;\n }\n\n float getLinearDepth(const in vec2 screenPosition) {\n #if PERSPECTIVE_CAMERA == 1\n float fragCoordZ = texture2D(tDepth, screenPosition).x;\n float viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\n return viewZToOrthographicDepth(viewZ, cameraNear, cameraFar);\n #else\n return texture2D(tDepth, screenPosition).x;\n #endif\n }\n\n float getViewZ(const in float depth) {\n #if PERSPECTIVE_CAMERA == 1\n return perspectiveDepthToViewZ(depth, cameraNear, cameraFar);\n #else\n return 0.0;//orthographicDepthToViewZ(depth, cameraNear, cameraFar);\n #endif\n }\n\n vec3 getViewPosition(const in vec2 screenPosition, const in float depth, const in float viewZ ) {\n float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];\n vec4 clipPosition = vec4((vec3(screenPosition, depth) - 0.5) * 2.0, 1.0);\n clipPosition *= clipW;\n return (cameraInverseProjectionMatrix * clipPosition).xyz;\n }\n\n void main() {\n float verticalBias = 1.5 / resolution.y;\n vec2 uv = vUv.xy + vec2(0.0, verticalBias);\n float depth = getDepth(uv);\n float viewZ = getViewZ(depth);\n vec4 worldPosition = inverseViewMatrix * vec4(getViewPosition(uv, depth, viewZ), 1.0);\n float distance = worldPosition.y - groundLevel;\n vec2 diffuseTextureSize = vec2(textureSize(tDiffuse, 0 ));\n vec4 fragColor = texelFetch(tDiffuse, ivec2(uv * diffuseTextureSize), 0).rgba;\n #if LINEAR_TO_SRGB == 1\n fragColor.rgb = mix(fragColor.rgb * 12.92, 1.055 * pow(fragColor.rgb, vec3(0.41666)) - 0.055, step(0.0031308, fragColor.rgb));\n #endif\n float fadeOutAlpha = pow(clamp(1.0 - distance / fadeOutDistance, 0.0, 1.0), fadeOutExponent);\n fragColor.a *= fadeOutAlpha * step(depth, 0.9999);\n #if PREMULTIPLIED_ALPHA == 1\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n #else\n gl_FragColor = fragColor;\n #endif\n }", kt = class e extends a {
|
|
2095
2080
|
static {
|
|
2096
2081
|
this.shader = {
|
|
2097
2082
|
uniforms: {
|
|
2098
2083
|
tDiffuse: { value: null },
|
|
2099
2084
|
tDepth: { value: null },
|
|
2100
|
-
resolution: { value: new
|
|
2085
|
+
resolution: { value: new x() },
|
|
2101
2086
|
cameraNear: { value: .1 },
|
|
2102
2087
|
cameraFar: { value: 1 },
|
|
2103
|
-
cameraProjectionMatrix: { value: new
|
|
2104
|
-
cameraInverseProjectionMatrix: { value: new
|
|
2105
|
-
inverseViewMatrix: { value: new
|
|
2088
|
+
cameraProjectionMatrix: { value: new P() },
|
|
2089
|
+
cameraInverseProjectionMatrix: { value: new P() },
|
|
2090
|
+
inverseViewMatrix: { value: new P() },
|
|
2106
2091
|
groundLevel: { value: 0 },
|
|
2107
2092
|
fadeOutDistance: { value: 1 },
|
|
2108
2093
|
fadeOutExponent: { value: 1 }
|
|
@@ -2112,14 +2097,14 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2112
2097
|
LINEAR_TO_SRGB: 0,
|
|
2113
2098
|
PREMULTIPLIED_ALPHA: 1
|
|
2114
2099
|
},
|
|
2115
|
-
vertexShader:
|
|
2116
|
-
fragmentShader:
|
|
2100
|
+
vertexShader: Dt,
|
|
2101
|
+
fragmentShader: Ot
|
|
2117
2102
|
};
|
|
2118
2103
|
}
|
|
2119
2104
|
constructor(t) {
|
|
2120
2105
|
super({
|
|
2121
2106
|
defines: Object.assign({}, e.shader.defines),
|
|
2122
|
-
uniforms:
|
|
2107
|
+
uniforms: w.clone(e.shader.uniforms),
|
|
2123
2108
|
vertexShader: e.shader.vertexShader,
|
|
2124
2109
|
fragmentShader: e.shader.fragmentShader,
|
|
2125
2110
|
blending: 0
|
|
@@ -2136,9 +2121,9 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2136
2121
|
}
|
|
2137
2122
|
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;
|
|
2138
2123
|
}
|
|
2139
|
-
},
|
|
2124
|
+
}, At = class extends u {
|
|
2140
2125
|
constructor(e, t) {
|
|
2141
|
-
let
|
|
2126
|
+
let r = [
|
|
2142
2127
|
1,
|
|
2143
2128
|
1,
|
|
2144
2129
|
0,
|
|
@@ -2154,11 +2139,11 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2154
2139
|
1,
|
|
2155
2140
|
1,
|
|
2156
2141
|
0
|
|
2157
|
-
],
|
|
2158
|
-
|
|
2159
|
-
let
|
|
2160
|
-
super(
|
|
2161
|
-
let
|
|
2142
|
+
], i = new A();
|
|
2143
|
+
i.setAttribute("position", new ie(r, 3)), i.computeBoundingSphere();
|
|
2144
|
+
let a = new n({ fog: !1 });
|
|
2145
|
+
super(i, a), this.light = e, this.color = t, this.type = "RectAreaLightHelper";
|
|
2146
|
+
let o = [
|
|
2162
2147
|
1,
|
|
2163
2148
|
1,
|
|
2164
2149
|
0,
|
|
@@ -2177,8 +2162,8 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2177
2162
|
1,
|
|
2178
2163
|
-1,
|
|
2179
2164
|
0
|
|
2180
|
-
],
|
|
2181
|
-
|
|
2165
|
+
], s = new A();
|
|
2166
|
+
s.setAttribute("position", new ie(o, 3)), s.computeBoundingSphere(), this.add(new R(s, new S({
|
|
2182
2167
|
side: 1,
|
|
2183
2168
|
fog: !1
|
|
2184
2169
|
})));
|
|
@@ -2195,21 +2180,21 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2195
2180
|
dispose() {
|
|
2196
2181
|
this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
|
|
2197
2182
|
}
|
|
2198
|
-
},
|
|
2183
|
+
}, jt = class e extends T {
|
|
2199
2184
|
static {
|
|
2200
2185
|
this._enableGroundBoundary = !1;
|
|
2201
2186
|
}
|
|
2202
2187
|
static {
|
|
2203
|
-
this._shadowFadeOut = new
|
|
2188
|
+
this._shadowFadeOut = new x(.1, 20);
|
|
2204
2189
|
}
|
|
2205
2190
|
static {
|
|
2206
|
-
this._sceneBoxMin = new
|
|
2191
|
+
this._sceneBoxMin = new B(-1, -1, -1);
|
|
2207
2192
|
}
|
|
2208
2193
|
static {
|
|
2209
|
-
this._sceneBoxMax = new
|
|
2194
|
+
this._sceneBoxMax = new B(1, 1, 1);
|
|
2210
2195
|
}
|
|
2211
2196
|
static {
|
|
2212
|
-
this._distributionProperties = new
|
|
2197
|
+
this._distributionProperties = new d(1, 1, 1, 1);
|
|
2213
2198
|
}
|
|
2214
2199
|
constructor(e) {
|
|
2215
2200
|
super(e), this.customProgramCacheKey = this._customProgramCacheKey, this.onBeforeCompile = this._onBeforeCompile;
|
|
@@ -2224,7 +2209,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2224
2209
|
return e._enableGroundBoundary ? "GROUND_BOUNDARY" : "NO_GROUND_BOUNDARY";
|
|
2225
2210
|
}
|
|
2226
2211
|
_onBeforeCompile(t, n) {
|
|
2227
|
-
t.vertexShader =
|
|
2212
|
+
t.vertexShader = Mt, t.fragmentShader = Nt, t.defines = Object.assign({
|
|
2228
2213
|
...t.defines,
|
|
2229
2214
|
DYNAMIC_SHADOW_RADIUS: "",
|
|
2230
2215
|
GROUND_BOUNDARY: e._enableGroundBoundary ? 1 : 0
|
|
@@ -2232,22 +2217,22 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2232
2217
|
let r = t.uniforms;
|
|
2233
2218
|
r && (r.distributionProperties = { value: e._distributionProperties }, r.shadowFadeOut = { value: e._shadowFadeOut }, r.sceneBoxMin = { value: e._sceneBoxMin }, r.sceneBoxMax = { value: e._sceneBoxMax });
|
|
2234
2219
|
}
|
|
2235
|
-
},
|
|
2220
|
+
}, Mt = "\n#define LAMBERT\n\nvarying vec3 vViewPosition;\nvarying vec3 vWorldPosition;\n\n#include <common>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n\n vViewPosition = - mvPosition.xyz;\n\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n\n#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vWorldPosition = worldPosition.xyz;\n#else\n vWorldPosition = (modelMatrix * vec4(transformed, 1.)).xyz;\n#endif\n}\n", Nt = "\n#define LAMBERT\n\nuniform vec3 diffuse;\nuniform float opacity;\n\nvarying vec3 vViewPosition;\nvarying vec3 vWorldPosition;\n\n#ifdef DYNAMIC_SHADOW_RADIUS\n uniform vec2 shadowFadeOut;\n #define fadeOutDistance shadowFadeOut.x\n #define fadeOutBlur shadowFadeOut.y\n uniform vec3 sceneBoxMin;\n uniform vec3 sceneBoxMax;\n#endif\nuniform vec4 distributionProperties;\n#define directionalDependency distributionProperties.x\n#define directionalExponent distributionProperties.y\n#define groundBoundary distributionProperties.z\n#define groundMapScale distributionProperties.w\n\n#include <common>\n#include <packing>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvec2 getShadowDynamicScale() {\n vec2 dynamicScale = vec2(0.0, 1.0);\n#ifdef DYNAMIC_SHADOW_RADIUS\n if (fadeOutDistance > 0.0) {\n vec3 boxDistanceVec = max(vec3(0.0), max(sceneBoxMin - vWorldPosition, vWorldPosition - sceneBoxMax));\n float boxDistance = length(boxDistanceVec);\n float shadowBase = clamp(boxDistance / fadeOutDistance, 0.0, 1.0);\n dynamicScale = vec2(shadowBase, 1.0 - shadowBase);\n }\n#endif\n return dynamicScale;\n}\n\n\n#if defined( SHADOWMAP_TYPE_PCF )\nfloat getShadowDynamicRadius(sampler2DShadow shadowMap, float shadowBias, float shadowRadius, vec4 shadowCoord, vec2 shadowScale) {\n#else\nfloat getShadowDynamicRadius(sampler2D shadowMap, float shadowBias, float shadowRadius, vec4 shadowCoord, vec2 shadowScale) {\n#endif\n float dynamicRadius = shadowRadius;\n#ifdef DYNAMIC_SHADOW_RADIUS\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if (frustumTest && fadeOutDistance > 0.0) {\n dynamicRadius = shadowRadius + fadeOutBlur * max(0.0, shadowScale.x);\n }\n#endif\n return dynamicRadius;\n}\n\nvoid main() {\n\n #include <clipping_planes_fragment>\n\n vec4 diffuseColor = vec4( diffuse, opacity );\n\n #include <logdepthbuf_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n\n // accumulation\n\n vec3 geometryPosition = - vViewPosition;\n vec3 geometryNormal = normal;\n vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n vec3 accumulatedShadowLight = vec3(0.0);\n vec3 directionDependentShadowLight = vec3(1.0);\n float groundDistance = clamp((vWorldPosition.y - sceneBoxMin.y) * 100.0, 0.0, 1.0);\n vec2 dynamicScale = getShadowDynamicScale();\n\n #if ( NUM_DIR_LIGHTS > 0 )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n\n IncidentLight directLight;\n vec3 incidentLightSum = vec3(0.0);\n vec3 incidentShadowLight = vec3(0.0);\n float groundShadowFactor = 1.;\n float shadowFactor;\n float dynamicRadius;\n float dotNL;\n\n #pragma unroll_loop_start\n for ( int i = 0 ; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n\n #if defined( USE_SHADOWMAP ) && ( GROUND_BOUNDARY == 1 && UNROLLED_LOOP_INDEX == 0 )\n\n directionalLightShadow = directionalLightShadows[ i ];\n dynamicRadius = fadeOutDistance * groundMapScale;\n groundShadowFactor = groundDistance < 0.5 ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, dynamicRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n #elif defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\n directionalLightShadow = directionalLightShadows[ i ];\n dynamicRadius = getShadowDynamicRadius(directionalShadowMap[i], directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[i], dynamicScale);\n shadowFactor = ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, dynamicRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n accumulatedShadowLight += directLight.color * shadowFactor * saturate(min(dotNL * 10.0 + 0.9, 1.0));\n dotNL = dot(dot(geometryNormal, geometryPosition) >= 0.0 ? -geometryNormal : geometryNormal, directLight.direction);\n incidentLightSum += directLight.color;\n incidentShadowLight += directLight.color * mix(1.0, shadowFactor, pow(clamp(dotNL, 0.0, 1.0), directionalExponent));\n\n #endif\n }\n #pragma unroll_loop_end\n\n directionDependentShadowLight = incidentShadowLight / ( incidentLightSum + 1. - step(0., incidentLightSum) );\n #else\n accumulatedShadowLight = vec3(1.0);\n #endif\n\n // modulation\n\n vec3 outgoingLight = mix(accumulatedShadowLight, directionDependentShadowLight, max(directionalDependency, 1.0 - groundDistance));\n #if GROUND_BOUNDARY == 1\n float groundWeight = 1. - groundShadowFactor + groundDistance - (1. - groundShadowFactor) * groundDistance;\n outgoingLight = mix(vec3(1.), outgoingLight, mix(dynamicScale.y, groundWeight, groundBoundary));\n #else\n outgoingLight = mix(vec3(1.), outgoingLight, dynamicScale.y);\n #endif\n\n #include <opaque_fragment>\n #include <premultiplied_alpha_fragment>\n}\n", Pt = {
|
|
2236
2221
|
DIRECTION_LIGHT_SHADOW: "DirectionalLightShadow",
|
|
2237
2222
|
SPOT_LIGHT_SHADOW: "SpotLightShadow"
|
|
2238
|
-
},
|
|
2223
|
+
}, Ft = {
|
|
2239
2224
|
alwaysUpdate: !1,
|
|
2240
2225
|
enableShadowMap: !0,
|
|
2241
2226
|
enableGroundBoundary: !0,
|
|
2242
2227
|
layers: null,
|
|
2243
|
-
shadowLightSourceType:
|
|
2228
|
+
shadowLightSourceType: Pt.DIRECTION_LIGHT_SHADOW,
|
|
2244
2229
|
maximumNumberOfLightSources: -1,
|
|
2245
2230
|
directionalDependency: 1,
|
|
2246
2231
|
directionalExponent: 1,
|
|
2247
2232
|
groundBoundary: 1,
|
|
2248
2233
|
fadeOutDistance: .1,
|
|
2249
2234
|
fadeOutBlur: 5
|
|
2250
|
-
},
|
|
2235
|
+
}, It = class extends J {
|
|
2251
2236
|
get shadowTexture() {
|
|
2252
2237
|
return this._shadowRenderTarget.texture;
|
|
2253
2238
|
}
|
|
@@ -2255,18 +2240,18 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2255
2240
|
this._shadowMapPassOverrideMaterialCache.shadowOnGround = e;
|
|
2256
2241
|
}
|
|
2257
2242
|
constructor(e, t, n) {
|
|
2258
|
-
super(e), this.needsUpdate = !1, this.drawGround = !0, this.shadowTypeNeedsUpdate = !0, this.shadowConfiguration = new
|
|
2243
|
+
super(e), this.needsUpdate = !1, this.drawGround = !0, this.shadowTypeNeedsUpdate = !0, this.shadowConfiguration = new zt(), this._shadowLightSources = [], this._shadowScale = 1, this._groundMapScale = 1, this._cameraUpdate = new Pe(), this._viewportSize = new x(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 Rt(), this.renderCacheManager?.registerCache(this, this._shadowMapPassOverrideMaterialCache);
|
|
2259
2244
|
let r = this._samples;
|
|
2260
|
-
this._shadowRenderTarget = new
|
|
2245
|
+
this._shadowRenderTarget = new p(this._viewportSize.x, this._viewportSize.y, {
|
|
2261
2246
|
samples: r,
|
|
2262
|
-
format:
|
|
2263
|
-
magFilter: this._samples > 0 ?
|
|
2264
|
-
minFilter: this._samples > 0 ?
|
|
2247
|
+
format: c,
|
|
2248
|
+
magFilter: this._samples > 0 ? s : V,
|
|
2249
|
+
minFilter: this._samples > 0 ? s : V
|
|
2265
2250
|
});
|
|
2266
2251
|
}
|
|
2267
2252
|
_getScreenSpaceShadowMapParameters(e) {
|
|
2268
2253
|
return {
|
|
2269
|
-
...
|
|
2254
|
+
...Ft,
|
|
2270
2255
|
...e
|
|
2271
2256
|
};
|
|
2272
2257
|
}
|
|
@@ -2280,7 +2265,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2280
2265
|
let n = this._shadowScale;
|
|
2281
2266
|
if (this._shadowScale = t, Math.abs(n - this._shadowScale) > 1e-5 && (this.shadowTypeNeedsUpdate = !0), this._shadowLightSources.forEach((t) => t.updateBounds(e)), this._shadowLightSources.length > 0) {
|
|
2282
2267
|
let e = this._shadowLightSources[0].getShadowLight().shadow?.camera;
|
|
2283
|
-
e instanceof
|
|
2268
|
+
e instanceof m && (this._groundMapScale = 2 * this._shadowMapSize / (Math.abs(e.right - e.left) + Math.abs(e.top - e.bottom)));
|
|
2284
2269
|
} else this._groundMapScale = 1;
|
|
2285
2270
|
this._shadowMapPassOverrideMaterialCache.setBoundingBox(e.bounds);
|
|
2286
2271
|
}
|
|
@@ -2294,7 +2279,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2294
2279
|
return this._shadowLightSources.find((t) => t.getOriginalLight() === e)?.getShadowLight();
|
|
2295
2280
|
}
|
|
2296
2281
|
addRectAreaLight(e, t) {
|
|
2297
|
-
let n = new
|
|
2282
|
+
let n = new Vt(e, {
|
|
2298
2283
|
shadowMapSize: this._shadowMapSize,
|
|
2299
2284
|
shadowLightSourceType: this.parameters.shadowLightSourceType
|
|
2300
2285
|
});
|
|
@@ -2304,14 +2289,14 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2304
2289
|
let n = this._shadowLightSources;
|
|
2305
2290
|
this._shadowLightSources = this._createShadowLightSourceArray(!1);
|
|
2306
2291
|
for (let r of n) {
|
|
2307
|
-
if (r instanceof
|
|
2292
|
+
if (r instanceof Vt) {
|
|
2308
2293
|
let t = r.getRectAreaLight();
|
|
2309
2294
|
e.includes(t) && (r.updatePositionAndTarget(), this._shadowLightSources.push(r));
|
|
2310
2295
|
}
|
|
2311
2296
|
r.removeFrom(t), r.dispose();
|
|
2312
2297
|
}
|
|
2313
2298
|
e.forEach((e) => {
|
|
2314
|
-
this._shadowLightSources.find((t) => t instanceof
|
|
2299
|
+
this._shadowLightSources.find((t) => t instanceof Vt && t.getRectAreaLight() === e) || this.addRectAreaLight(e, t);
|
|
2315
2300
|
}), this.needsUpdate = !0, this.shadowTypeNeedsUpdate = !0;
|
|
2316
2301
|
}
|
|
2317
2302
|
createShadowFromLightSources(e, t) {
|
|
@@ -2326,7 +2311,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2326
2311
|
e.forEach((e) => {
|
|
2327
2312
|
let n = e.maxIntensity * t;
|
|
2328
2313
|
if (n >= .1 && e.position.z >= 0) {
|
|
2329
|
-
let t = new
|
|
2314
|
+
let t = new Ht(new B(e.position.x, e.position.z, e.position.y).multiplyScalar(7), n, {
|
|
2330
2315
|
shadowMapSize: this._shadowMapSize,
|
|
2331
2316
|
shadowLightSourceType: this.parameters.shadowLightSourceType
|
|
2332
2317
|
});
|
|
@@ -2337,13 +2322,13 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2337
2322
|
_createShadowLightSourceArray(e) {
|
|
2338
2323
|
let t = [];
|
|
2339
2324
|
if (e) {
|
|
2340
|
-
let e = new
|
|
2325
|
+
let e = new Ut(new B(0, 7, 0), { shadowMapSize: this._shadowMapSize });
|
|
2341
2326
|
t.push(e);
|
|
2342
2327
|
}
|
|
2343
2328
|
return this.parameters.enableGroundBoundary = e, t;
|
|
2344
2329
|
}
|
|
2345
2330
|
setSize(e, t) {
|
|
2346
|
-
this._viewportSize = new
|
|
2331
|
+
this._viewportSize = new x(e, t), this._shadowRenderTarget.setSize(this._viewportSize.x, this._viewportSize.y);
|
|
2347
2332
|
}
|
|
2348
2333
|
updatePositionAndTarget() {
|
|
2349
2334
|
this._shadowLightSources.forEach((e) => e.updatePositionAndTarget());
|
|
@@ -2381,12 +2366,12 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2381
2366
|
switchType(e) {
|
|
2382
2367
|
return this.shadowConfiguration.switchType(e) ? (this.needsUpdate = !0, this.shadowTypeNeedsUpdate = !0, !0) : !1;
|
|
2383
2368
|
}
|
|
2384
|
-
},
|
|
2369
|
+
}, Lt = {
|
|
2385
2370
|
DEFAULT: "default",
|
|
2386
2371
|
UNLIT: "unlit",
|
|
2387
2372
|
EMISSIVE: "emissive",
|
|
2388
2373
|
SHADOW: "shadow"
|
|
2389
|
-
},
|
|
2374
|
+
}, Rt = class e extends _t {
|
|
2390
2375
|
static {
|
|
2391
2376
|
this.useModifiedMaterial = !0;
|
|
2392
2377
|
}
|
|
@@ -2394,23 +2379,23 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2394
2379
|
this._shadowOnGround = e;
|
|
2395
2380
|
}
|
|
2396
2381
|
constructor() {
|
|
2397
|
-
super(), this._boundingBoxSet = !1, this._shadowOnGround = !0, this._shadowObjectMaterial = this._createShadowMaterial(
|
|
2382
|
+
super(), this._boundingBoxSet = !1, this._shadowOnGround = !0, this._shadowObjectMaterial = this._createShadowMaterial(Lt.DEFAULT), this._unlitMaterial = this._createShadowMaterial(Lt.UNLIT), this._emissiveMaterial = this._createShadowMaterial(Lt.EMISSIVE), this._receiveShadowMaterial = this._createShadowMaterial(Lt.SHADOW);
|
|
2398
2383
|
}
|
|
2399
2384
|
dispose() {
|
|
2400
2385
|
this._shadowObjectMaterial.dispose(), this._unlitMaterial.dispose(), this._emissiveMaterial.dispose(), this._receiveShadowMaterial.dispose();
|
|
2401
2386
|
}
|
|
2402
2387
|
setShadowParameters(e, t, n, r, i, a, o) {
|
|
2403
|
-
|
|
2388
|
+
jt.setShadowParameters(e, t, n, r, i, a, o);
|
|
2404
2389
|
}
|
|
2405
2390
|
setBoundingBox(e) {
|
|
2406
|
-
this._boundingBoxSet = !0,
|
|
2391
|
+
this._boundingBoxSet = !0, jt.setBoundingBox(e);
|
|
2407
2392
|
}
|
|
2408
2393
|
_createShadowMaterial(t) {
|
|
2409
2394
|
let n;
|
|
2410
|
-
return n = t ===
|
|
2395
|
+
return n = t === Lt.EMISSIVE || t === Lt.UNLIT ? new S({
|
|
2411
2396
|
color: 16777215,
|
|
2412
2397
|
side: 2
|
|
2413
|
-
}) : t ===
|
|
2398
|
+
}) : t === Lt.SHADOW ? new h({ side: 2 }) : e.useModifiedMaterial ? this._createCustomerShadowMaterial() : new M({
|
|
2414
2399
|
color: 16777215,
|
|
2415
2400
|
shininess: 0,
|
|
2416
2401
|
polygonOffsetFactor: 0,
|
|
@@ -2419,7 +2404,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2419
2404
|
}), n;
|
|
2420
2405
|
}
|
|
2421
2406
|
_createCustomerShadowMaterial() {
|
|
2422
|
-
return new
|
|
2407
|
+
return new jt({ side: 2 });
|
|
2423
2408
|
}
|
|
2424
2409
|
addLineOrPoint(e) {
|
|
2425
2410
|
this.addToCache(e, { visible: !1 });
|
|
@@ -2431,14 +2416,14 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2431
2416
|
e.isLight && !e.userData.shadowLightSource && this.addToCache(e, { visible: !1 });
|
|
2432
2417
|
}
|
|
2433
2418
|
_setMeshMaterialAndVisibility(e) {
|
|
2434
|
-
e.userData.isFloor ? this._setMeshShadowFloorMaterial(e) : e.material && e.receiveShadow && !Array.isArray(e.material) && !(e.material.transparent === !0 && e.material.opacity < .9) ? this._setShadowMaterialForOpaqueObject(e) :
|
|
2419
|
+
e.userData.isFloor ? this._setMeshShadowFloorMaterial(e) : e.material && e.receiveShadow && !Array.isArray(e.material) && !(e.material.transparent === !0 && e.material.opacity < .9) ? this._setShadowMaterialForOpaqueObject(e) : dt(e.material, .9) ? this.addToCache(e, { visible: !1 }) : e.receiveShadow ? this.addToCache(e, {
|
|
2435
2420
|
castShadow: !1,
|
|
2436
2421
|
material: this._receiveShadowMaterial
|
|
2437
2422
|
}) : this.addToCache(e, { visible: !1 });
|
|
2438
2423
|
}
|
|
2439
2424
|
_setShadowMaterialForOpaqueObject(e) {
|
|
2440
2425
|
let t = e.material;
|
|
2441
|
-
t instanceof
|
|
2426
|
+
t instanceof n || t instanceof S ? this.addToCache(e, { material: this._unlitMaterial }) : t instanceof D ? this._setMeshShadowStandardMaterial(e, t) : this.addToCache(e, { material: e.receiveShadow ? this._shadowObjectMaterial : this._unlitMaterial });
|
|
2442
2427
|
}
|
|
2443
2428
|
_setMeshShadowStandardMaterial(e, t) {
|
|
2444
2429
|
let n = t.emissiveIntensity > 0 && (t.emissive.r > 0 || t.emissive.g > 0 || t.emissive.b > 0);
|
|
@@ -2455,7 +2440,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2455
2440
|
material: this._shadowObjectMaterial
|
|
2456
2441
|
}) : this.addToCache(e, { visible: !1 });
|
|
2457
2442
|
}
|
|
2458
|
-
},
|
|
2443
|
+
}, zt = class e {
|
|
2459
2444
|
constructor() {
|
|
2460
2445
|
this.types = new Map([
|
|
2461
2446
|
["off", e._noShadow],
|
|
@@ -2506,9 +2491,9 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2506
2491
|
switchType(t) {
|
|
2507
2492
|
return this.types.has(t) ? (this.currentConfiguration = this.types.get(t) ?? e._defaultType, !0) : !1;
|
|
2508
2493
|
}
|
|
2509
|
-
},
|
|
2494
|
+
}, Bt = class {
|
|
2510
2495
|
constructor(e, t) {
|
|
2511
|
-
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
|
|
2496
|
+
this._isVisibleBackup = !0, this._castShadowBackup = !0, this._shadowMapSize = t?.shadowMapSize ?? 1024, this._blurSamples = t?.blurSamples ?? 8, this._shadowLightSource = e, this._shadowLightSource.visible = !1, this._shadowLightSource.castShadow = !0, this._shadowLightSource.shadow && (this._shadowLightSource.shadow.mapSize = new x(this._shadowMapSize, this._shadowMapSize), this._shadowLightSource.shadow.blurSamples = this._blurSamples, this._shadowLightSource.shadow.autoUpdate = !1), this._shadowLightSource.userData.shadowLightSource = this;
|
|
2512
2497
|
}
|
|
2513
2498
|
getPosition() {
|
|
2514
2499
|
return this._shadowLightSource.position;
|
|
@@ -2529,10 +2514,10 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2529
2514
|
e.remove(this._shadowLightSource);
|
|
2530
2515
|
}
|
|
2531
2516
|
updatePositionAndTarget() {
|
|
2532
|
-
this._updateShadowPositionAndTarget(this.getPosition(), new
|
|
2517
|
+
this._updateShadowPositionAndTarget(this.getPosition(), new B(0, 0, 0));
|
|
2533
2518
|
}
|
|
2534
2519
|
updateBounds(e) {
|
|
2535
|
-
if (this._shadowLightSource instanceof
|
|
2520
|
+
if (this._shadowLightSource instanceof se) {
|
|
2536
2521
|
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);
|
|
2537
2522
|
t.aspect = 1, t.near = r, t.far = i, this._shadowLightSource.angle = s;
|
|
2538
2523
|
} else if (this._shadowLightSource.shadow) {
|
|
@@ -2547,7 +2532,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2547
2532
|
this._shadowLightSource.shadow && (this._shadowLightSource.shadow.needsUpdate = !0);
|
|
2548
2533
|
}
|
|
2549
2534
|
_updateShadowPositionAndTarget(e, t) {
|
|
2550
|
-
if (this._shadowLightSource instanceof
|
|
2535
|
+
if (this._shadowLightSource instanceof se) {
|
|
2551
2536
|
let n = t.clone().sub(e), r = n.length();
|
|
2552
2537
|
n.normalize();
|
|
2553
2538
|
let i = t.clone().sub(n.clone().multiplyScalar(r * 4));
|
|
@@ -2563,19 +2548,19 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2563
2548
|
return [];
|
|
2564
2549
|
}
|
|
2565
2550
|
finishRenderShadow() {}
|
|
2566
|
-
},
|
|
2551
|
+
}, Vt = class extends Bt {
|
|
2567
2552
|
constructor(e, t) {
|
|
2568
2553
|
let n;
|
|
2569
2554
|
switch (t?.shadowLightSourceType) {
|
|
2570
2555
|
default:
|
|
2571
|
-
case
|
|
2572
|
-
n = new
|
|
2556
|
+
case Pt.DIRECTION_LIGHT_SHADOW:
|
|
2557
|
+
n = new v(16777215, 1);
|
|
2573
2558
|
break;
|
|
2574
|
-
case
|
|
2575
|
-
n = new
|
|
2559
|
+
case Pt.SPOT_LIGHT_SHADOW:
|
|
2560
|
+
n = new se(16777215, 1, 0, Math.PI / 4, 0);
|
|
2576
2561
|
break;
|
|
2577
2562
|
}
|
|
2578
|
-
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
|
|
2563
|
+
n.position.copy(e.position), n.lookAt(0, 0, 0), super(n, t), this._rectAreaLight = e, this._rectAreaLight.userData.shadowLightSource = this, t?.addHelper && (this._rectLightHelper = new At(this._rectAreaLight), this._rectLightHelper.material.depthWrite = !1, this._rectAreaLight.add(this._rectLightHelper));
|
|
2579
2564
|
}
|
|
2580
2565
|
getPosition() {
|
|
2581
2566
|
return this._rectAreaLight.position;
|
|
@@ -2596,9 +2581,9 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2596
2581
|
finishRenderShadow() {
|
|
2597
2582
|
this._shadowLightSource.visible = !1, this._shadowLightSource.castShadow = this._castShadowBackup, this._rectAreaLight.visible = this._isVisibleBackup;
|
|
2598
2583
|
}
|
|
2599
|
-
},
|
|
2584
|
+
}, Ht = class extends Bt {
|
|
2600
2585
|
constructor(e, t, n) {
|
|
2601
|
-
let r = new
|
|
2586
|
+
let r = new v(16777215, t);
|
|
2602
2587
|
r.position.copy(e), r.lookAt(0, 0, 0), r.updateMatrix(), r.castShadow = !0, super(r, n), this._position = e.clone(), this._intensity = t;
|
|
2603
2588
|
}
|
|
2604
2589
|
getPosition() {
|
|
@@ -2614,9 +2599,9 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2614
2599
|
finishRenderShadow() {
|
|
2615
2600
|
this._shadowLightSource.castShadow = this._castShadowBackup, this._shadowLightSource.visible = !1;
|
|
2616
2601
|
}
|
|
2617
|
-
},
|
|
2602
|
+
}, Ut = class extends Bt {
|
|
2618
2603
|
constructor(e, t) {
|
|
2619
|
-
let n = new
|
|
2604
|
+
let n = new v(16777215, 1);
|
|
2620
2605
|
n.position.copy(e), n.lookAt(0, 0, 0), n.updateMatrix(), n.castShadow = !0, super(n, t), this._position = e.clone();
|
|
2621
2606
|
}
|
|
2622
2607
|
getPosition() {
|
|
@@ -2632,7 +2617,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2632
2617
|
finishRenderShadow() {
|
|
2633
2618
|
this._shadowLightSource.castShadow = this._castShadowBackup, this._shadowLightSource.visible = !1;
|
|
2634
2619
|
}
|
|
2635
|
-
},
|
|
2620
|
+
}, Wt = {
|
|
2636
2621
|
name: "CopyShader",
|
|
2637
2622
|
uniforms: {
|
|
2638
2623
|
tDiffuse: { value: null },
|
|
@@ -2640,39 +2625,39 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2640
2625
|
},
|
|
2641
2626
|
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 }",
|
|
2642
2627
|
fragmentShader: "\n\n uniform float opacity;\n\n uniform sampler2D tDiffuse;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 texel = texture2D( tDiffuse, vUv );\n gl_FragColor = opacity * texel;\n\n\n }"
|
|
2643
|
-
},
|
|
2628
|
+
}, Gt = {
|
|
2644
2629
|
name: "FXAAShader",
|
|
2645
2630
|
uniforms: {
|
|
2646
2631
|
tDiffuse: { value: null },
|
|
2647
|
-
resolution: { value: new
|
|
2632
|
+
resolution: { value: new x(1 / 1024, 1 / 512) }
|
|
2648
2633
|
},
|
|
2649
2634
|
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 }",
|
|
2650
2635
|
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 }"
|
|
2651
|
-
},
|
|
2636
|
+
}, Kt = class e extends J {
|
|
2652
2637
|
static {
|
|
2653
|
-
this.BlurDirectionX = new
|
|
2638
|
+
this.BlurDirectionX = new x(1, 0);
|
|
2654
2639
|
}
|
|
2655
2640
|
static {
|
|
2656
|
-
this.BlurDirectionY = new
|
|
2641
|
+
this.BlurDirectionY = new x(0, 1);
|
|
2657
2642
|
}
|
|
2658
2643
|
static {
|
|
2659
2644
|
this.highlightLines = !0;
|
|
2660
2645
|
}
|
|
2661
|
-
constructor(e, t, n,
|
|
2662
|
-
super(e), this.patternTexture = null, this.clearBackground = !1, this.renderScene = n, this.renderCamera =
|
|
2663
|
-
let
|
|
2664
|
-
this.renderTargetMaskBuffer = new
|
|
2665
|
-
let
|
|
2666
|
-
this.copyUniforms =
|
|
2646
|
+
constructor(e, t, n, i, o, s) {
|
|
2647
|
+
super(e), this.patternTexture = null, this.clearBackground = !1, this.renderScene = n, this.renderCamera = i, this.selectedObjects = o === void 0 ? [] : o, this.visibleEdgeColor = new r(1, 1, 1), this.hiddenEdgeColor = new r(.1, .04, .02), this.edgeGlow = 0, this.usePatternTexture = !1, this.edgeThickness = 1, this.edgeStrength = 3, this.downSampleRatio = s?.downSampleRatio || 2, this.pulsePeriod = 0, this.edgeDetectionFxaa = s?.edgeDetectionFxaa || !1, this._visibilityCache = /* @__PURE__ */ new Map(), this.resolution = t === void 0 ? new x(256, 256) : new x(t.x, t.y);
|
|
2648
|
+
let c = Math.round(this.resolution.x / this.downSampleRatio), l = Math.round(this.resolution.y / this.downSampleRatio);
|
|
2649
|
+
this.renderTargetMaskBuffer = new p(this.resolution.x, this.resolution.y), this.renderTargetMaskBuffer.texture.name = "OutlinePass.mask", this.renderTargetMaskBuffer.texture.generateMipmaps = !1, this.prepareMaskMaterial = this._getPrepareMaskMaterial(this.gBufferTextures?.isFloatGBufferWithRgbNormalAlphaDepth), this.prepareMaskMaterial.side = 2, this.prepareMaskMaterial.fragmentShader = d(this.prepareMaskMaterial.fragmentShader, this.renderCamera), this.edgeDetectionFxaa && (this.fxaaRenderMaterial = new a(Gt), 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 p(this.resolution.x, this.resolution.y), this.renderTargetFxaaBuffer.texture.name = "OutlinePass.fxaa", this.renderTargetFxaaBuffer.texture.generateMipmaps = !1), this.renderTargetMaskDownSampleBuffer = new p(c, l), this.renderTargetMaskDownSampleBuffer.texture.name = "OutlinePass.depthDownSample", this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = !1, this.renderTargetBlurBuffer1 = new p(c, l), this.renderTargetBlurBuffer1.texture.name = "OutlinePass.blur1", this.renderTargetBlurBuffer1.texture.generateMipmaps = !1, this.renderTargetBlurBuffer2 = new p(Math.round(c / 2), Math.round(l / 2)), this.renderTargetBlurBuffer2.texture.name = "OutlinePass.blur2", this.renderTargetBlurBuffer2.texture.generateMipmaps = !1, this.edgeDetectionMaterial = this._getEdgeDetectionMaterial(), this.renderTargetEdgeBuffer1 = new p(c, l), this.renderTargetEdgeBuffer1.texture.name = "OutlinePass.edge1", this.renderTargetEdgeBuffer1.texture.generateMipmaps = !1, this.renderTargetEdgeBuffer2 = new p(Math.round(c / 2), Math.round(l / 2)), this.renderTargetEdgeBuffer2.texture.name = "OutlinePass.edge2", this.renderTargetEdgeBuffer2.texture.generateMipmaps = !1, this.separableBlurMaterial1 = this._getSeperableBlurMaterial(4), this.separableBlurMaterial1.uniforms.texSize.value.set(c, l), this.separableBlurMaterial1.uniforms.kernelRadius.value = 1, this.separableBlurMaterial2 = this._getSeperableBlurMaterial(4), this.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(c / 2), Math.round(l / 2)), this.separableBlurMaterial2.uniforms.kernelRadius.value = 4, this.overlayMaterial = this._getOverlayMaterial();
|
|
2650
|
+
let u = Wt;
|
|
2651
|
+
this.copyUniforms = w.clone(u.uniforms), this.copyUniforms.opacity.value = 1, this.materialCopy = new a({
|
|
2667
2652
|
uniforms: this.copyUniforms,
|
|
2668
|
-
vertexShader:
|
|
2669
|
-
fragmentShader:
|
|
2653
|
+
vertexShader: u.vertexShader,
|
|
2654
|
+
fragmentShader: u.fragmentShader,
|
|
2670
2655
|
blending: 0,
|
|
2671
2656
|
depthTest: !1,
|
|
2672
2657
|
depthWrite: !1,
|
|
2673
2658
|
transparent: !0
|
|
2674
|
-
}), this.enabled = !0, this.needsSwap = !1, this.oldClearColor = new
|
|
2675
|
-
function
|
|
2659
|
+
}), this.enabled = !0, this.needsSwap = !1, this.oldClearColor = new r(), this.oldClearAlpha = 1, this.fsQuad = new ke(void 0), this.tempPulseColor1 = new r(), this.tempPulseColor2 = new r(), this.textureMatrix = new P();
|
|
2660
|
+
function d(e, t) {
|
|
2676
2661
|
let n = t.isPerspectiveCamera ? "perspective" : "orthographic";
|
|
2677
2662
|
return e.replace(/DEPTH_TO_VIEW_Z/g, n + "DepthToViewZ");
|
|
2678
2663
|
}
|
|
@@ -2730,36 +2715,36 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2730
2715
|
this.render(e, null, null, 0, !1);
|
|
2731
2716
|
}
|
|
2732
2717
|
_getPrepareMaskMaterial(e) {
|
|
2733
|
-
return new
|
|
2718
|
+
return new a({
|
|
2734
2719
|
uniforms: {
|
|
2735
2720
|
depthTexture: { value: null },
|
|
2736
|
-
cameraNearFar: { value: new
|
|
2721
|
+
cameraNearFar: { value: new x(.5, .5) },
|
|
2737
2722
|
textureMatrix: { value: null }
|
|
2738
2723
|
},
|
|
2739
2724
|
defines: { FLOAT_ALPHA_DEPTH: e ? 1 : 0 },
|
|
2740
|
-
vertexShader: "#include <morphtarget_pars_vertex>\n #include <skinning_pars_vertex>\n\n varying vec4 projTexCoord;\n varying vec4 vPosition;\n uniform mat4 textureMatrix;\n\n void main() {\n\n #include <skinbase_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n\n vPosition = mvPosition;\n\n vec4 worldPosition = vec4( transformed, 1.0 );\n\n #ifdef USE_INSTANCING\n\n worldPosition = instanceMatrix * worldPosition;\n\n #endif\n
|
|
2725
|
+
vertexShader: "#include <morphtarget_pars_vertex>\n #include <skinning_pars_vertex>\n\n varying vec4 projTexCoord;\n varying vec4 vPosition;\n uniform mat4 textureMatrix;\n\n void main() {\n\n #include <skinbase_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n\n vPosition = mvPosition;\n\n vec4 worldPosition = vec4( transformed, 1.0 );\n\n #ifdef USE_INSTANCING\n\n worldPosition = instanceMatrix * worldPosition;\n\n #endif\n\n worldPosition = modelMatrix * worldPosition;\n\n projTexCoord = textureMatrix * worldPosition;\n\n }",
|
|
2741
2726
|
fragmentShader: "#include <packing>\n varying vec4 vPosition;\n varying vec4 projTexCoord;\n uniform sampler2D depthTexture;\n uniform vec2 cameraNearFar;\n\n void main() {\n\n #if FLOAT_ALPHA_DEPTH == 1\n float depth = texture2DProj( depthTexture, projTexCoord ).w;\n #else\n float depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n #endif\n float viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );\n float depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\n gl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\n\n }"
|
|
2742
2727
|
});
|
|
2743
2728
|
}
|
|
2744
2729
|
_getEdgeDetectionMaterial() {
|
|
2745
|
-
return new
|
|
2730
|
+
return new a({
|
|
2746
2731
|
uniforms: {
|
|
2747
2732
|
maskTexture: { value: null },
|
|
2748
|
-
texSize: { value: new
|
|
2749
|
-
visibleEdgeColor: { value: new
|
|
2750
|
-
hiddenEdgeColor: { value: new
|
|
2733
|
+
texSize: { value: new x(.5, .5) },
|
|
2734
|
+
visibleEdgeColor: { value: new B(1, 1, 1) },
|
|
2735
|
+
hiddenEdgeColor: { value: new B(1, 1, 1) }
|
|
2751
2736
|
},
|
|
2752
2737
|
vertexShader: "varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
2753
2738
|
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 }"
|
|
2754
2739
|
});
|
|
2755
2740
|
}
|
|
2756
2741
|
_getSeperableBlurMaterial(e) {
|
|
2757
|
-
return new
|
|
2742
|
+
return new a({
|
|
2758
2743
|
defines: { MAX_RADIUS: e },
|
|
2759
2744
|
uniforms: {
|
|
2760
2745
|
colorTexture: { value: null },
|
|
2761
|
-
texSize: { value: new
|
|
2762
|
-
direction: { value: new
|
|
2746
|
+
texSize: { value: new x(.5, .5) },
|
|
2747
|
+
direction: { value: new x(.5, .5) },
|
|
2763
2748
|
kernelRadius: { value: 1 }
|
|
2764
2749
|
},
|
|
2765
2750
|
vertexShader: "varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
@@ -2767,7 +2752,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2767
2752
|
});
|
|
2768
2753
|
}
|
|
2769
2754
|
_getOverlayMaterial() {
|
|
2770
|
-
return new
|
|
2755
|
+
return new a({
|
|
2771
2756
|
uniforms: {
|
|
2772
2757
|
maskTexture: { value: null },
|
|
2773
2758
|
edgeTexture1: { value: null },
|
|
@@ -2785,16 +2770,16 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2785
2770
|
transparent: !0
|
|
2786
2771
|
});
|
|
2787
2772
|
}
|
|
2788
|
-
},
|
|
2773
|
+
}, qt = {
|
|
2789
2774
|
uniforms: { tDiffuse: { value: null } },
|
|
2790
2775
|
vertexShader: "\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",
|
|
2791
2776
|
fragmentShader: "\n uniform highp sampler2D tDiffuse;\n varying vec2 vUv;\n\n void main() {\n vec4 textureColor = texture2D(tDiffuse, vUv);\n float aoPassDepth = dot(textureColor.wz, vec2(1.0/1024.0));\n gl_FragColor = vec4(vec3(aoPassDepth * aoPassDepth), 1.0);\n }"
|
|
2792
|
-
},
|
|
2777
|
+
}, Jt = class extends a {
|
|
2793
2778
|
constructor(e) {
|
|
2794
2779
|
super({
|
|
2795
|
-
uniforms:
|
|
2796
|
-
vertexShader:
|
|
2797
|
-
fragmentShader:
|
|
2780
|
+
uniforms: w.clone(qt.uniforms),
|
|
2781
|
+
vertexShader: qt.vertexShader,
|
|
2782
|
+
fragmentShader: qt.fragmentShader,
|
|
2798
2783
|
transparent: !0,
|
|
2799
2784
|
depthTest: !1,
|
|
2800
2785
|
depthWrite: !1,
|
|
@@ -2804,27 +2789,27 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2804
2789
|
blendSrcAlpha: 206,
|
|
2805
2790
|
blendDstAlpha: 200,
|
|
2806
2791
|
blendEquationAlpha: 100
|
|
2807
|
-
}), this._intensity = new
|
|
2792
|
+
}), this._intensity = new x(1, 1), this.update(e);
|
|
2808
2793
|
}
|
|
2809
2794
|
update(e) {
|
|
2810
2795
|
return e?.texture !== void 0 && (this.uniforms.tDiffuse.value = e.texture), e?.blending !== void 0 && (this.blending = e.blending), this;
|
|
2811
2796
|
}
|
|
2812
|
-
},
|
|
2797
|
+
}, Yt = (e) => new x(Math.atan2(e.y, e.x) / (2 * Math.PI) + .5, Math.asin(e.z) / Math.PI + .5), Xt = class {
|
|
2813
2798
|
get colorRenderTarget() {
|
|
2814
|
-
return this._colorRenderTarget = this._colorRenderTarget ?? new
|
|
2799
|
+
return this._colorRenderTarget = this._colorRenderTarget ?? new p(), this._colorRenderTarget;
|
|
2815
2800
|
}
|
|
2816
2801
|
environmentMapDecodeTarget(e) {
|
|
2817
|
-
let t =
|
|
2818
|
-
return this._environmentMapDecodeTarget = this._environmentMapDecodeTarget ?? new
|
|
2802
|
+
let t = e instanceof ue && e.capabilities.isWebGL2 ? oe : E;
|
|
2803
|
+
return this._environmentMapDecodeTarget = this._environmentMapDecodeTarget ?? new p(1, 1, { type: t }), this._environmentMapDecodeTarget;
|
|
2819
2804
|
}
|
|
2820
2805
|
environmentMapDecodeMaterial(e) {
|
|
2821
|
-
return e ? (this._equirectangularDecodeMaterial = this._equirectangularDecodeMaterial ?? new
|
|
2806
|
+
return e ? (this._equirectangularDecodeMaterial = this._equirectangularDecodeMaterial ?? new Qt(!0, !1), this._equirectangularDecodeMaterial) : (this._pmremDecodeMaterial = this._pmremDecodeMaterial ?? new Qt(!1, !1), this._pmremDecodeMaterial);
|
|
2822
2807
|
}
|
|
2823
2808
|
get camera() {
|
|
2824
|
-
return this._camera = this._camera ?? new
|
|
2809
|
+
return this._camera = this._camera ?? new m(-1, 1, 1, -1, -1, 1), this._camera;
|
|
2825
2810
|
}
|
|
2826
2811
|
scaleTexture(e, t, n, r) {
|
|
2827
|
-
this.colorRenderTarget.setSize(n, r), this._planeMesh = this._planeMesh ?? new
|
|
2812
|
+
this.colorRenderTarget.setSize(n, r), this._planeMesh = this._planeMesh ?? new R(new te(2, 2), new S({ map: t }));
|
|
2828
2813
|
let i = e.getRenderTarget();
|
|
2829
2814
|
e.setRenderTarget(this.colorRenderTarget), e.render(this._planeMesh, this.camera), e.setRenderTarget(i);
|
|
2830
2815
|
let a = this.environmentMapDecodeTarget(e).texture, o = new Uint8Array(n * r * 4);
|
|
@@ -2836,26 +2821,26 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2836
2821
|
}
|
|
2837
2822
|
newGrayscaleTexture(e, t, n, r) {
|
|
2838
2823
|
let i = this.environmentMapDecodeMaterial(t.name === "PMREM.cubeUv"), a = this.environmentMapDecodeTarget(e);
|
|
2839
|
-
a.setSize(n, r), i.setSourceTexture(t), this._planeMesh = this._planeMesh ?? new
|
|
2824
|
+
a.setSize(n, r), i.setSourceTexture(t), this._planeMesh = this._planeMesh ?? new R(new te(2, 2), i);
|
|
2840
2825
|
let o = e.getRenderTarget();
|
|
2841
2826
|
e.setRenderTarget(a), e.render(this._planeMesh, this.camera), e.setRenderTarget(o);
|
|
2842
|
-
let s = a.texture, c = a.texture.type ===
|
|
2827
|
+
let s = a.texture, c = a.texture.type === oe, l = c ? new Float32Array(n * r * 4) : new Uint8Array(n * r * 4);
|
|
2843
2828
|
return e.readRenderTargetPixels(a, 0, 0, n, r, l), {
|
|
2844
2829
|
texture: s,
|
|
2845
2830
|
pixels: l,
|
|
2846
2831
|
sRgbaPixels: c
|
|
2847
2832
|
};
|
|
2848
2833
|
}
|
|
2849
|
-
},
|
|
2834
|
+
}, Zt = {
|
|
2850
2835
|
uniforms: { tDiffuse: { value: null } },
|
|
2851
2836
|
vertexShader: "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",
|
|
2852
|
-
fragmentShader: "\n uniform sampler2D tDiffuse;\n varying vec2 vUv;\n
|
|
2853
|
-
},
|
|
2837
|
+
fragmentShader: "\n uniform sampler2D tDiffuse;\n varying vec2 vUv;\n\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x ); // pos x\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z\n }\n return 0.5 * ( uv + 1.0 );\n }\n\n void main() {\n #if PMREM_DECODE == 1\n float altitude = (vUv.y - 0.5) * 3.141593;\n float azimuth = vUv.x * 2.0 * 3.141593;\n vec3 direction = vec3(\n cos(altitude) * cos(azimuth) * -1.0,\n sin(altitude),\n cos(altitude) * sin(azimuth) * -1.0\n );\n float face = getFace(direction);\n vec2 uv = getUV(direction, face) / vec2(3.0, 4.0);\n if (face > 2.5) {\n uv.y += 0.25;\n face -= 3.0;\n }\n uv.x += face / 3.0;\n vec4 color = texture2D(tDiffuse, uv);\n #else\n vec4 color = texture2D(tDiffuse, vUv);\n #endif\n #if GRAYSCALE_CONVERT == 1\n float grayscale = dot(color.rgb, vec3(0.2126, 0.7152, 0.0722));\n //float grayscale = dot(color.rgb, vec3(1.0/3.0));\n gl_FragColor = vec4(vec3(grayscale), 1.0);\n #else\n gl_FragColor = vec4(color.rgb, 1.0);\n #endif\n }"
|
|
2838
|
+
}, Qt = class extends a {
|
|
2854
2839
|
constructor(e, t) {
|
|
2855
2840
|
super({
|
|
2856
|
-
uniforms:
|
|
2857
|
-
vertexShader:
|
|
2858
|
-
fragmentShader:
|
|
2841
|
+
uniforms: w.clone(Zt.uniforms),
|
|
2842
|
+
vertexShader: Zt.vertexShader,
|
|
2843
|
+
fragmentShader: Zt.fragmentShader,
|
|
2859
2844
|
defines: {
|
|
2860
2845
|
PMREM_DECODE: e ? 1 : 0,
|
|
2861
2846
|
GRAYSCALE_CONVERT: t ? 1 : 0
|
|
@@ -2865,50 +2850,50 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2865
2850
|
setSourceTexture(e) {
|
|
2866
2851
|
this.uniforms.tDiffuse.value = e;
|
|
2867
2852
|
}
|
|
2868
|
-
},
|
|
2853
|
+
}, $t = class {
|
|
2869
2854
|
constructor(e) {
|
|
2870
2855
|
this.samplePoints = [], this.sampleUVs = [], this.grayscaleTexture = {
|
|
2871
|
-
texture: new
|
|
2856
|
+
texture: new y(),
|
|
2872
2857
|
pixels: new Uint8Array(),
|
|
2873
2858
|
sRgbaPixels: !1
|
|
2874
|
-
}, this.detectorTexture = new
|
|
2859
|
+
}, this.detectorTexture = new y(), this.detectorArray = new Float32Array(), this.lightSamples = [], this.lightGraph = new tn(0), this.lightSources = [], this._grayScale = new B(.2126, .7152, .0722), this._createEquirectangularSamplePoints = (e) => {
|
|
2875
2860
|
let t = [];
|
|
2876
2861
|
for (let n = 0; n < e; n++) {
|
|
2877
2862
|
let r = n * Math.PI * (3 - Math.sqrt(5)), i = 1 - n / (e - 1) * 2, a = Math.sqrt(1 - i * i), o = Math.cos(r) * a, s = Math.sin(r) * a;
|
|
2878
|
-
t.push(new
|
|
2863
|
+
t.push(new B(o, s, i));
|
|
2879
2864
|
}
|
|
2880
2865
|
return t;
|
|
2881
|
-
}, 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) =>
|
|
2866
|
+
}, this._numberOfSamples = e?.numberOfSamples ?? 1e3, this._width = e?.width ?? 1024, this._height = e?.height ?? 512, this._sampleThreshold = e?.sampleThreshold ?? .707, this.pointDistance = Math.sqrt(4 * Math.PI) / Math.sqrt(this._numberOfSamples), this.pixelDistance = Math.sqrt(2) * Math.PI * 2 / this._width, this.samplePoints = this._createEquirectangularSamplePoints(this._numberOfSamples), this.sampleUVs = this.samplePoints.map((e) => Yt(e));
|
|
2882
2867
|
}
|
|
2883
2868
|
detectLightSources(e, t, n) {
|
|
2884
|
-
this.textureData = n, this._textureConverter = this._textureConverter ?? new
|
|
2869
|
+
this.textureData = n, this._textureConverter = this._textureConverter ?? new Xt(), 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);
|
|
2885
2870
|
}
|
|
2886
2871
|
_redFromRgbaToNormalizedFloatArray(e, t, n) {
|
|
2887
|
-
let
|
|
2872
|
+
let i = new Float32Array(e.length / 4), a = 1, o = 0;
|
|
2888
2873
|
for (let t = 0; t < e.length / 4; ++t) {
|
|
2889
|
-
let n = new
|
|
2874
|
+
let n = new r(...e.slice(t * 4, t * 4 + 3));
|
|
2890
2875
|
e instanceof Float32Array && n.convertSRGBToLinear();
|
|
2891
|
-
let
|
|
2892
|
-
|
|
2876
|
+
let s = new B(n.r, n.g, n.b).dot(this._grayScale);
|
|
2877
|
+
a = Math.min(a, s), o = Math.max(o, s), i[t] = s;
|
|
2893
2878
|
}
|
|
2894
|
-
if (n) for (let e = 0; e <
|
|
2895
|
-
else if (!t) for (let e = 0; e <
|
|
2896
|
-
return
|
|
2879
|
+
if (n) for (let e = 0; e < i.length; ++e) i[e] = (t ? i[e] : (i[e] - a) / (o - a)) ** +n;
|
|
2880
|
+
else if (!t) for (let e = 0; e < i.length; ++e) i[e] = (i[e] - a) / (o - a);
|
|
2881
|
+
return i;
|
|
2897
2882
|
}
|
|
2898
|
-
_grayscaleTextureFromFloatArray(e,
|
|
2899
|
-
let
|
|
2900
|
-
for (let t = 0; t <
|
|
2883
|
+
_grayscaleTextureFromFloatArray(e, n, r) {
|
|
2884
|
+
let i = n * r, a = new Uint8Array(4 * i);
|
|
2885
|
+
for (let t = 0; t < i; t++) {
|
|
2901
2886
|
let n = e[t] * 255;
|
|
2902
|
-
|
|
2887
|
+
a[t * 4 + 0] = n, a[t * 4 + 1] = n, a[t * 4 + 2] = n, a[t * 4 + 3] = 255;
|
|
2903
2888
|
}
|
|
2904
|
-
let
|
|
2905
|
-
return
|
|
2889
|
+
let o = new t(a, n, r);
|
|
2890
|
+
return o.needsUpdate = !0, o;
|
|
2906
2891
|
}
|
|
2907
2892
|
_filterLightSamples(e) {
|
|
2908
2893
|
let t = [];
|
|
2909
2894
|
for (let n = 0; n < this.sampleUVs.length; n++) {
|
|
2910
2895
|
let r = this.sampleUVs[n];
|
|
2911
|
-
this._detectorTextureLuminanceValueFromUV(r) > e && t.push(new
|
|
2896
|
+
this._detectorTextureLuminanceValueFromUV(r) > e && t.push(new en(this.samplePoints[n], r));
|
|
2912
2897
|
}
|
|
2913
2898
|
return t;
|
|
2914
2899
|
}
|
|
@@ -2926,11 +2911,11 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2926
2911
|
return r;
|
|
2927
2912
|
}
|
|
2928
2913
|
_findClusterSegments(e, t) {
|
|
2929
|
-
let n = this.pixelDistance * 2, r = this.pointDistance * 1.5, i = new
|
|
2914
|
+
let n = this.pixelDistance * 2, r = this.pointDistance * 1.5, i = new tn(e.length);
|
|
2930
2915
|
for (let a = 0; a < e.length; a++) for (let o = a + 1; o < e.length; o++) if (e[a].position.angleTo(e[o].position) < r) {
|
|
2931
2916
|
let r = e[o].position.clone().sub(e[a].position), s = Math.floor(r.length() / n), c = !0, l = 0;
|
|
2932
2917
|
for (let n = 1; n < s; n++) {
|
|
2933
|
-
let i = r.clone().multiplyScalar(n / s), o =
|
|
2918
|
+
let i = r.clone().multiplyScalar(n / s), o = Yt(e[a].position.clone().add(i).normalize());
|
|
2934
2919
|
if (this._detectorTextureLuminanceValueFromUV(o) < t) {
|
|
2935
2920
|
if (l++, l > 1) {
|
|
2936
2921
|
c = !1;
|
|
@@ -2943,14 +2928,14 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2943
2928
|
return i;
|
|
2944
2929
|
}
|
|
2945
2930
|
createLightSourcesFromLightGraph(e, t) {
|
|
2946
|
-
let n = t.components.filter((e) => e.length > 1).map((t) => new
|
|
2931
|
+
let n = t.components.filter((e) => e.length > 1).map((t) => new nn(t.map((t) => e[t])));
|
|
2947
2932
|
return n.forEach((e) => e.calculateLightSourceProperties((e) => this._originalLuminanceValueFromUV(e))), n;
|
|
2948
2933
|
}
|
|
2949
|
-
},
|
|
2934
|
+
}, en = class {
|
|
2950
2935
|
constructor(e, t) {
|
|
2951
2936
|
this.position = e, this.uv = t;
|
|
2952
2937
|
}
|
|
2953
|
-
},
|
|
2938
|
+
}, tn = class {
|
|
2954
2939
|
constructor(e) {
|
|
2955
2940
|
this.edges = [], this.adjacent = [], this.components = [], this.noOfNodes = e;
|
|
2956
2941
|
for (let t = 0; t < e; t++) this.adjacent.push([]);
|
|
@@ -2968,45 +2953,45 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
2968
2953
|
t[e] = !0, n.push(e);
|
|
2969
2954
|
for (let r of this.adjacent[e]) t[r] || this._dfs(r, t, n);
|
|
2970
2955
|
}
|
|
2971
|
-
},
|
|
2956
|
+
}, nn = class {
|
|
2972
2957
|
constructor(e) {
|
|
2973
|
-
this.position = new
|
|
2958
|
+
this.position = new B(), this.uv = new x(), this.averageIntensity = 0, this.maxIntensity = 0, this.size = 0, this.lightSamples = e;
|
|
2974
2959
|
}
|
|
2975
2960
|
calculateLightSourceProperties(e) {
|
|
2976
|
-
this.position = new
|
|
2961
|
+
this.position = new B(), this.averageIntensity = 0, this.maxIntensity = 0;
|
|
2977
2962
|
for (let t of this.lightSamples) {
|
|
2978
2963
|
this.position.add(t.position);
|
|
2979
2964
|
let n = e(t.uv);
|
|
2980
2965
|
this.averageIntensity += n, this.maxIntensity = Math.max(this.maxIntensity, n);
|
|
2981
2966
|
}
|
|
2982
|
-
this.averageIntensity /= this.lightSamples.length, this.position.normalize(), this.uv =
|
|
2967
|
+
this.averageIntensity /= this.lightSamples.length, this.position.normalize(), this.uv = Yt(this.position);
|
|
2983
2968
|
let t = 0;
|
|
2984
2969
|
for (let e of this.lightSamples) t += e.position.distanceTo(this.position);
|
|
2985
2970
|
t /= this.lightSamples.length, this.size = t / Math.PI;
|
|
2986
2971
|
}
|
|
2987
|
-
},
|
|
2972
|
+
}, rn = class extends J {
|
|
2988
2973
|
constructor(e) {
|
|
2989
|
-
super(e), this.debugOutput = "", this._environmentMapDecodeMaterial = new
|
|
2974
|
+
super(e), this.debugOutput = "", this._environmentMapDecodeMaterial = new Qt(!0, !1), this._environmentMapDecodeMaterial.blending = 0, this._environmentMapDecodeMaterial.depthTest = !1;
|
|
2990
2975
|
}
|
|
2991
2976
|
dispose() {
|
|
2992
2977
|
this._depthRenderMaterial?.dispose(), this._copyMaterial?.dispose(), this._srgbToLinearCopyMaterial?.dispose();
|
|
2993
2978
|
}
|
|
2994
2979
|
getCopyMaterial(e) {
|
|
2995
|
-
return this._copyMaterial = this._copyMaterial ?? new
|
|
2980
|
+
return this._copyMaterial = this._copyMaterial ?? new Se(), this._copyMaterial.update(e);
|
|
2996
2981
|
}
|
|
2997
2982
|
getBlendAoAndShadowMaterial(e) {
|
|
2998
|
-
return this._blendAoAndShadowMaterial = this._blendAoAndShadowMaterial ?? new
|
|
2983
|
+
return this._blendAoAndShadowMaterial = this._blendAoAndShadowMaterial ?? new qe({ blending: 0 }), this._blendAoAndShadowMaterial.update(e);
|
|
2999
2984
|
}
|
|
3000
2985
|
getBlendAoPassDepthMaterial(e) {
|
|
3001
|
-
return this._blendAoPassDepthMaterial = this._blendAoPassDepthMaterial ?? new
|
|
2986
|
+
return this._blendAoPassDepthMaterial = this._blendAoPassDepthMaterial ?? new Jt({ blending: 0 }), this._blendAoPassDepthMaterial.update(e);
|
|
3002
2987
|
}
|
|
3003
2988
|
getSrgbToLinearCopyMaterial(e) {
|
|
3004
|
-
return this._srgbToLinearCopyMaterial = this._copyMaterial ?? new
|
|
2989
|
+
return this._srgbToLinearCopyMaterial = this._copyMaterial ?? new Se({}, xe.ADDITIVE, !0, !0), this._srgbToLinearCopyMaterial.update(e);
|
|
3005
2990
|
}
|
|
3006
2991
|
_getDepthRenderMaterial(e) {
|
|
3007
|
-
return this._depthRenderMaterial = this._depthRenderMaterial ?? new
|
|
2992
|
+
return this._depthRenderMaterial = this._depthRenderMaterial ?? new Ee({
|
|
3008
2993
|
depthTexture: this.gBufferTextures.textureWithDepthValue,
|
|
3009
|
-
depthFilter: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? new
|
|
2994
|
+
depthFilter: this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? new d(0, 0, 0, 1) : new d(1, 0, 0, 0)
|
|
3010
2995
|
}), this._depthRenderMaterial.update({ camera: e });
|
|
3011
2996
|
}
|
|
3012
2997
|
renderPass(e) {
|
|
@@ -3019,14 +3004,14 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3019
3004
|
this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3020
3005
|
texture: this.gBufferTextures?.gBufferTexture,
|
|
3021
3006
|
blending: 0,
|
|
3022
|
-
colorTransform: new
|
|
3023
|
-
colorBase: new
|
|
3007
|
+
colorTransform: new P().set(.5, 0, 0, 0, 0, .5, 0, 0, 0, 0, .5, 0, 0, 0, 0, 0),
|
|
3008
|
+
colorBase: new d(.5, .5, .5, 1),
|
|
3024
3009
|
multiplyChannels: 0,
|
|
3025
3010
|
uvTransform: K
|
|
3026
3011
|
}), null) : this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3027
3012
|
texture: this.gBufferTextures?.gBufferTexture,
|
|
3028
3013
|
blending: 0,
|
|
3029
|
-
colorTransform:
|
|
3014
|
+
colorTransform: _e,
|
|
3030
3015
|
colorBase: G,
|
|
3031
3016
|
multiplyChannels: 0,
|
|
3032
3017
|
uvTransform: K
|
|
@@ -3036,14 +3021,14 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3036
3021
|
this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth ? this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3037
3022
|
texture: this.gBufferTextures?.gBufferTexture,
|
|
3038
3023
|
blending: 0,
|
|
3039
|
-
colorTransform:
|
|
3024
|
+
colorTransform: ve,
|
|
3040
3025
|
colorBase: G,
|
|
3041
3026
|
multiplyChannels: 0,
|
|
3042
3027
|
uvTransform: K
|
|
3043
3028
|
}), null) : this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3044
3029
|
texture: this.gBufferTextures?.depthBufferTexture,
|
|
3045
3030
|
blending: 0,
|
|
3046
|
-
colorTransform:
|
|
3031
|
+
colorTransform: ye,
|
|
3047
3032
|
colorBase: G,
|
|
3048
3033
|
multiplyChannels: 0,
|
|
3049
3034
|
uvTransform: K
|
|
@@ -3083,7 +3068,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3083
3068
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3084
3069
|
texture: this.renderPassManager.shadowAndAoPass.aoAndSoftShadowRenderTarget.texture,
|
|
3085
3070
|
blending: 0,
|
|
3086
|
-
colorTransform:
|
|
3071
|
+
colorTransform: et.shadowTransform,
|
|
3087
3072
|
colorBase: W,
|
|
3088
3073
|
multiplyChannels: 0,
|
|
3089
3074
|
uvTransform: K
|
|
@@ -3093,7 +3078,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3093
3078
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3094
3079
|
texture: this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,
|
|
3095
3080
|
blending: 0,
|
|
3096
|
-
colorTransform:
|
|
3081
|
+
colorTransform: et.shadowTransform,
|
|
3097
3082
|
colorBase: W,
|
|
3098
3083
|
multiplyChannels: 0,
|
|
3099
3084
|
uvTransform: K
|
|
@@ -3103,7 +3088,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3103
3088
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3104
3089
|
texture: this.renderPassManager.shadowAndAoPass.fadeRenderTarget.texture,
|
|
3105
3090
|
blending: 0,
|
|
3106
|
-
colorTransform:
|
|
3091
|
+
colorTransform: et.shadowTransform,
|
|
3107
3092
|
colorBase: W,
|
|
3108
3093
|
multiplyChannels: 0,
|
|
3109
3094
|
uvTransform: K
|
|
@@ -3127,7 +3112,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3127
3112
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3128
3113
|
texture: this.renderPassManager.aoPassMapTexture,
|
|
3129
3114
|
blending: 0,
|
|
3130
|
-
colorTransform:
|
|
3115
|
+
colorTransform: H,
|
|
3131
3116
|
colorBase: W,
|
|
3132
3117
|
multiplyChannels: 0,
|
|
3133
3118
|
uvTransform: K
|
|
@@ -3137,27 +3122,27 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3137
3122
|
this.passRenderer.renderScreenSpace(e, this.getSrgbToLinearCopyMaterial({
|
|
3138
3123
|
texture: this.renderPassManager.groundReflectionPass.reflectionRenderTarget.texture,
|
|
3139
3124
|
blending: 0,
|
|
3140
|
-
colorTransform:
|
|
3125
|
+
colorTransform: H,
|
|
3141
3126
|
colorBase: W,
|
|
3142
3127
|
multiplyChannels: 0,
|
|
3143
|
-
uvTransform:
|
|
3128
|
+
uvTransform: be
|
|
3144
3129
|
}), null);
|
|
3145
3130
|
break;
|
|
3146
3131
|
case "groundreflectionfinal":
|
|
3147
3132
|
this.passRenderer.renderScreenSpace(e, this.getSrgbToLinearCopyMaterial({
|
|
3148
3133
|
texture: this.renderPassManager.groundReflectionPass.intensityRenderTarget.texture,
|
|
3149
3134
|
blending: 0,
|
|
3150
|
-
colorTransform:
|
|
3135
|
+
colorTransform: H,
|
|
3151
3136
|
colorBase: W,
|
|
3152
3137
|
multiplyChannels: 0,
|
|
3153
|
-
uvTransform:
|
|
3138
|
+
uvTransform: be
|
|
3154
3139
|
}), null);
|
|
3155
3140
|
break;
|
|
3156
3141
|
case "bakedgroundshadow":
|
|
3157
3142
|
this.passRenderer.renderScreenSpace(e, this.getCopyMaterial({
|
|
3158
3143
|
texture: this.renderPassManager.bakedGroundContactShadowPass.renderTarget.texture,
|
|
3159
3144
|
blending: 0,
|
|
3160
|
-
colorTransform:
|
|
3145
|
+
colorTransform: H,
|
|
3161
3146
|
colorBase: W,
|
|
3162
3147
|
multiplyChannels: 0,
|
|
3163
3148
|
uvTransform: K
|
|
@@ -3168,15 +3153,15 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3168
3153
|
break;
|
|
3169
3154
|
case "lightsourcedetection":
|
|
3170
3155
|
if (this.scene.userData?.environmentDefinition) {
|
|
3171
|
-
let t = this.renderPassManager.aspect, n = new
|
|
3172
|
-
|
|
3156
|
+
let t = this.renderPassManager.aspect, n = new m(-1, 1, 1 / t, -1 / t, -1, 1), i = this.scene.userData?.environmentDefinition.createDebugScene(e, this.scene, this.renderPassManager.screenSpaceShadowMapPass.parameters.maximumNumberOfLightSources);
|
|
3157
|
+
i.background = new r(16777215), e.render(i, n);
|
|
3173
3158
|
}
|
|
3174
3159
|
break;
|
|
3175
3160
|
}
|
|
3176
3161
|
}
|
|
3177
|
-
},
|
|
3162
|
+
}, an = class extends J {
|
|
3178
3163
|
constructor(e) {
|
|
3179
|
-
super(e), this.drawGround = !0, this.drawWithDebugMaterial = !1, this.grayDebugMaterial = new
|
|
3164
|
+
super(e), this.drawGround = !0, this.drawWithDebugMaterial = !1, this.grayDebugMaterial = new D({
|
|
3180
3165
|
color: 12632256,
|
|
3181
3166
|
side: 2,
|
|
3182
3167
|
envMapIntensity: .4
|
|
@@ -3190,7 +3175,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3190
3175
|
this.passRenderer.renderWithOverrideMaterial(e, this.scene, this.camera, this.grayDebugMaterial, null, 0, 1);
|
|
3191
3176
|
}) : e.render(this.scene, this.camera), this.renderPassManager.setGroundVisibility(!1), this.renderCacheManager.onAfterRender("floorDepthWrite");
|
|
3192
3177
|
}
|
|
3193
|
-
},
|
|
3178
|
+
}, on = class e {
|
|
3194
3179
|
constructor() {
|
|
3195
3180
|
this.applyAoAndShadowToAlpha = !1, this._aoPassMapUniform = { value: null }, this._aoPassMapScaleUniform = { value: 1 }, this._aoPassMapIntensityUniform = { value: 1 }, this._shPassMapIntensityUniform = { value: 1 }, this._reflectionPassMapUniform = { value: null }, this._reflectionPassMapScaleUniform = { value: 1 }, this._reflectionPassMapIntensityUniform = { value: 0 }, this.applyReflectionPassMap = !1;
|
|
3196
3181
|
}
|
|
@@ -3216,7 +3201,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3216
3201
|
this._reflectionPassMapIntensityUniform.value = e;
|
|
3217
3202
|
}
|
|
3218
3203
|
static addPlugin(t) {
|
|
3219
|
-
if (
|
|
3204
|
+
if (ft(t)) return null;
|
|
3220
3205
|
if (t.userData.postProcessingMaterialPlugin !== void 0) return t.userData.postProcessingMaterialPlugin instanceof e ? t.userData.postProcessingMaterialPlugin : null;
|
|
3221
3206
|
let n = new e();
|
|
3222
3207
|
return t.userData.postProcessingMaterialPlugin = n, t.onBeforeCompile = (e, t) => n._onBeforeCompile(e, t), t.customProgramCacheKey = () => n._customProgramCacheKey(), n;
|
|
@@ -3231,21 +3216,21 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3231
3216
|
_onBeforeCompile(e, t) {
|
|
3232
3217
|
if (this._isEnabled() || this.applyReflectionPassMap) {
|
|
3233
3218
|
let t = this.applyAoAndShadowToAlpha ? "#define USE_APPLY_AO_AND_SHADOW_TO_ALPHA\n" : "";
|
|
3234
|
-
t += this.applyReflectionPassMap ? "#define USE_REFLECTION_PASS_MAP\n" : "", t +=
|
|
3219
|
+
t += this.applyReflectionPassMap ? "#define USE_REFLECTION_PASS_MAP\n" : "", t += sn, e.fragmentShader = e.fragmentShader.replace("#include <aomap_pars_fragment>", t), e.fragmentShader = e.fragmentShader.replace("#include <aomap_fragment>", cn), this._initUniforms(e);
|
|
3235
3220
|
}
|
|
3236
3221
|
}
|
|
3237
3222
|
_initUniforms(e) {
|
|
3238
3223
|
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);
|
|
3239
3224
|
}
|
|
3240
|
-
},
|
|
3225
|
+
}, sn = "\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", cn = "\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", ln = class extends q {
|
|
3241
3226
|
constructor(e, t = "tDiffuse") {
|
|
3242
|
-
super(), this.textureID = t, this.uniforms = null, this.material = null, e instanceof
|
|
3227
|
+
super(), this.textureID = t, this.uniforms = null, this.material = null, e instanceof a ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms = w.clone(e.uniforms), this.material = new a({
|
|
3243
3228
|
name: e.name === void 0 ? "unspecified" : e.name,
|
|
3244
3229
|
defines: Object.assign({}, e.defines),
|
|
3245
3230
|
uniforms: this.uniforms,
|
|
3246
3231
|
vertexShader: e.vertexShader,
|
|
3247
3232
|
fragmentShader: e.fragmentShader
|
|
3248
|
-
})), this._fsQuad = new
|
|
3233
|
+
})), this._fsQuad = new ke(this.material);
|
|
3249
3234
|
}
|
|
3250
3235
|
render(e, t, n) {
|
|
3251
3236
|
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));
|
|
@@ -3253,7 +3238,7 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3253
3238
|
dispose() {
|
|
3254
3239
|
this.material.dispose(), this._fsQuad.dispose();
|
|
3255
3240
|
}
|
|
3256
|
-
},
|
|
3241
|
+
}, un = {
|
|
3257
3242
|
name: "LUTShader",
|
|
3258
3243
|
uniforms: {
|
|
3259
3244
|
lut: { value: null },
|
|
@@ -3263,9 +3248,9 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3263
3248
|
},
|
|
3264
3249
|
vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n\n ",
|
|
3265
3250
|
fragmentShader: "\n\n uniform float lutSize;\n uniform sampler3D lut;\n\n varying vec2 vUv;\n uniform float intensity;\n uniform sampler2D tDiffuse;\n void main() {\n\n vec4 val = texture2D( tDiffuse, vUv );\n vec4 lutVal;\n\n // pull the sample in by half a pixel so the sample begins\n // at the center of the edge pixels.\n float pixelWidth = 1.0 / lutSize;\n float halfPixelWidth = 0.5 / lutSize;\n vec3 uvw = vec3( halfPixelWidth ) + val.rgb * ( 1.0 - pixelWidth );\n\n\n lutVal = vec4( texture( lut, uvw ).rgb, val.a );\n\n gl_FragColor = vec4( mix( val, lutVal, intensity ) );\n\n }\n\n "
|
|
3266
|
-
},
|
|
3251
|
+
}, dn = class extends ln {
|
|
3267
3252
|
constructor(e = {}) {
|
|
3268
|
-
super(
|
|
3253
|
+
super(un), this.lut = e.lut || null, this.intensity = "intensity" in e ? e.intensity : 1;
|
|
3269
3254
|
}
|
|
3270
3255
|
set lut(e) {
|
|
3271
3256
|
let t = this.material;
|
|
@@ -3280,45 +3265,45 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3280
3265
|
get intensity() {
|
|
3281
3266
|
return this.material.uniforms.intensity.value;
|
|
3282
3267
|
}
|
|
3283
|
-
},
|
|
3268
|
+
}, fn = class extends e {
|
|
3284
3269
|
constructor(e) {
|
|
3285
|
-
super(e), this.type =
|
|
3270
|
+
super(e), this.type = E;
|
|
3286
3271
|
}
|
|
3287
3272
|
setType(e) {
|
|
3288
3273
|
return this.type = e, this;
|
|
3289
3274
|
}
|
|
3290
|
-
load(e, t, n,
|
|
3291
|
-
let
|
|
3292
|
-
|
|
3275
|
+
load(e, t, n, r) {
|
|
3276
|
+
let i = new ee(this.manager);
|
|
3277
|
+
i.setPath(this.path), i.setResponseType("text"), i.load(e, (n) => {
|
|
3293
3278
|
try {
|
|
3294
3279
|
t(this.parse(n));
|
|
3295
3280
|
} catch (t) {
|
|
3296
|
-
|
|
3281
|
+
r ? r(t) : console.error(t), this.manager.itemError(e);
|
|
3297
3282
|
}
|
|
3298
|
-
}, n,
|
|
3283
|
+
}, n, r);
|
|
3299
3284
|
}
|
|
3300
3285
|
parse(e) {
|
|
3301
|
-
let t = /TITLE +"([^"]*)"/, n = /LUT_3D_SIZE +(\d+)/, r = /DOMAIN_MIN +([\d.]+) +([\d.]+) +([\d.]+)/, i = /DOMAIN_MAX +([\d.]+) +([\d.]+) +([\d.]+)/, a = /^([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+) *$/gm, o = t.exec(e),
|
|
3286
|
+
let t = /TITLE +"([^"]*)"/, n = /LUT_3D_SIZE +(\d+)/, r = /DOMAIN_MIN +([\d.]+) +([\d.]+) +([\d.]+)/, i = /DOMAIN_MAX +([\d.]+) +([\d.]+) +([\d.]+)/, a = /^([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+) *$/gm, o = t.exec(e), c = o === null ? null : o[1];
|
|
3302
3287
|
if (o = n.exec(e), o === null) throw Error("LUTCubeLoader: Missing LUT_3D_SIZE information");
|
|
3303
|
-
let
|
|
3304
|
-
if (o = r.exec(e), o !== null &&
|
|
3305
|
-
let
|
|
3306
|
-
for (; (o = a.exec(e)) !== null;)
|
|
3307
|
-
let
|
|
3308
|
-
return
|
|
3309
|
-
title:
|
|
3310
|
-
size:
|
|
3311
|
-
domainMin:
|
|
3312
|
-
domainMax:
|
|
3313
|
-
texture3D:
|
|
3288
|
+
let u = Number(o[1]), d = u ** 3 * 4, f = this.type === 1009 ? new Uint8Array(d) : new Float32Array(d), p = new B(0, 0, 0), m = new B(1, 1, 1);
|
|
3289
|
+
if (o = r.exec(e), o !== null && p.set(Number(o[1]), Number(o[2]), Number(o[3])), o = i.exec(e), o !== null && m.set(Number(o[1]), Number(o[2]), Number(o[3])), p.x > m.x || p.y > m.y || p.z > m.z) throw Error("LUTCubeLoader: Invalid input domain");
|
|
3290
|
+
let h = this.type === 1009 ? 255 : 1, g = 0;
|
|
3291
|
+
for (; (o = a.exec(e)) !== null;) f[g++] = Number(o[1]) * h, f[g++] = Number(o[2]) * h, f[g++] = Number(o[3]) * h, f[g++] = h;
|
|
3292
|
+
let _ = new l();
|
|
3293
|
+
return _.image.data = f, _.image.width = u, _.image.height = u, _.image.depth = u, _.type = this.type, _.magFilter = s, _.minFilter = s, _.wrapS = z, _.wrapT = z, _.wrapR = z, _.generateMipmaps = !1, _.needsUpdate = !0, {
|
|
3294
|
+
title: c,
|
|
3295
|
+
size: u,
|
|
3296
|
+
domainMin: p,
|
|
3297
|
+
domainMax: m,
|
|
3298
|
+
texture3D: _
|
|
3314
3299
|
};
|
|
3315
3300
|
}
|
|
3316
|
-
},
|
|
3301
|
+
}, pn = class extends e {
|
|
3317
3302
|
constructor(e) {
|
|
3318
3303
|
super(e), this.flip = !1;
|
|
3319
3304
|
}
|
|
3320
3305
|
load(e, t, n, r) {
|
|
3321
|
-
let i = new
|
|
3306
|
+
let i = new re(this.manager);
|
|
3322
3307
|
i.setCrossOrigin(this.crossOrigin), i.setPath(this.path), i.load(e, (n) => {
|
|
3323
3308
|
try {
|
|
3324
3309
|
let e;
|
|
@@ -3329,8 +3314,8 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3329
3314
|
}, n, r);
|
|
3330
3315
|
}
|
|
3331
3316
|
parse(e, t) {
|
|
3332
|
-
let n = new Uint8Array(e), r = new
|
|
3333
|
-
return r.image.data = n, r.image.width = t, r.image.height = t, r.image.depth = t, r.format =
|
|
3317
|
+
let n = new Uint8Array(e), r = new l();
|
|
3318
|
+
return r.image.data = n, r.image.width = t, r.image.height = t, r.image.depth = t, r.format = _, r.type = E, r.magFilter = s, r.minFilter = s, r.wrapS = z, r.wrapT = z, r.wrapR = z, r.generateMipmaps = !1, r.needsUpdate = !0, {
|
|
3334
3319
|
size: t,
|
|
3335
3320
|
texture3D: r
|
|
3336
3321
|
};
|
|
@@ -3352,47 +3337,47 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3352
3337
|
}
|
|
3353
3338
|
return i.getImageData(0, 0, t, n);
|
|
3354
3339
|
}
|
|
3355
|
-
},
|
|
3340
|
+
}, mn = class extends e {
|
|
3356
3341
|
constructor(e) {
|
|
3357
|
-
super(e), this.type =
|
|
3342
|
+
super(e), this.type = E;
|
|
3358
3343
|
}
|
|
3359
3344
|
setType(e) {
|
|
3360
3345
|
return this.type = e, this;
|
|
3361
3346
|
}
|
|
3362
|
-
load(e, t, n,
|
|
3363
|
-
let
|
|
3364
|
-
|
|
3347
|
+
load(e, t, n, r) {
|
|
3348
|
+
let i = new ee(this.manager);
|
|
3349
|
+
i.setPath(this.path), i.setResponseType("text"), i.load(e, (n) => {
|
|
3365
3350
|
try {
|
|
3366
3351
|
t(this.parse(n));
|
|
3367
3352
|
} catch (t) {
|
|
3368
|
-
|
|
3353
|
+
r ? r(t) : console.error(t), this.manager.itemError(e);
|
|
3369
3354
|
}
|
|
3370
|
-
}, n,
|
|
3355
|
+
}, n, r);
|
|
3371
3356
|
}
|
|
3372
3357
|
parse(e) {
|
|
3373
3358
|
let t = /^[\d ]+$/m, n = /^([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+) *$/gm, r = t.exec(e);
|
|
3374
3359
|
if (r === null) throw Error("LUT3dlLoader: Missing grid information");
|
|
3375
|
-
let i = r[0].trim().split(/\s+/g).map(Number), a = i[1] - i[0], o = i.length,
|
|
3360
|
+
let i = r[0].trim().split(/\s+/g).map(Number), a = i[1] - i[0], o = i.length, c = o ** 2;
|
|
3376
3361
|
for (let e = 1, t = i.length; e < t; ++e) if (a !== i[e] - i[e - 1]) throw Error("LUT3dlLoader: Inconsistent grid size");
|
|
3377
|
-
let
|
|
3362
|
+
let u = new Float32Array(o ** 3 * 4), d = 0, f = 0;
|
|
3378
3363
|
for (; (r = n.exec(e)) !== null;) {
|
|
3379
3364
|
let e = Number(r[1]), t = Number(r[2]), n = Number(r[3]);
|
|
3380
|
-
|
|
3381
|
-
let i =
|
|
3382
|
-
|
|
3365
|
+
d = Math.max(d, e, t, n);
|
|
3366
|
+
let i = f % o, a = Math.floor(f / o) % o, s = Math.floor(f / c) % o, l = (i * c + a * o + s) * 4;
|
|
3367
|
+
u[l + 0] = e, u[l + 1] = t, u[l + 2] = n, ++f;
|
|
3383
3368
|
}
|
|
3384
|
-
let
|
|
3385
|
-
for (let e = 0, t =
|
|
3369
|
+
let p = 2 ** Math.ceil(Math.log2(d)), m = this.type === 1009 ? new Uint8Array(u.length) : u, h = this.type === 1009 ? 255 : 1;
|
|
3370
|
+
for (let e = 0, t = m.length; e < t; e += 4) {
|
|
3386
3371
|
let t = e + 1, n = e + 2, r = e + 3;
|
|
3387
|
-
|
|
3372
|
+
m[e] = u[e] / p * h, m[t] = u[t] / p * h, m[n] = u[n] / p * h, m[r] = h;
|
|
3388
3373
|
}
|
|
3389
|
-
let
|
|
3390
|
-
return
|
|
3374
|
+
let g = new l();
|
|
3375
|
+
return g.image.data = m, g.image.width = o, g.image.height = o, g.image.depth = o, g.format = _, g.type = this.type, g.magFilter = s, g.minFilter = s, g.wrapS = z, g.wrapT = z, g.wrapR = z, g.generateMipmaps = !1, g.needsUpdate = !0, {
|
|
3391
3376
|
size: o,
|
|
3392
|
-
texture3D:
|
|
3377
|
+
texture3D: g
|
|
3393
3378
|
};
|
|
3394
3379
|
}
|
|
3395
|
-
},
|
|
3380
|
+
}, hn = {
|
|
3396
3381
|
name: "OutputShader",
|
|
3397
3382
|
uniforms: {
|
|
3398
3383
|
tDiffuse: { value: null },
|
|
@@ -3400,26 +3385,26 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3400
3385
|
},
|
|
3401
3386
|
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 }",
|
|
3402
3387
|
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 }"
|
|
3403
|
-
},
|
|
3388
|
+
}, gn = class extends q {
|
|
3404
3389
|
constructor() {
|
|
3405
|
-
super(), this.isOutputPass = !0, this.uniforms =
|
|
3406
|
-
name:
|
|
3390
|
+
super(), this.isOutputPass = !0, this.uniforms = w.clone(hn.uniforms), this.material = new le({
|
|
3391
|
+
name: hn.name,
|
|
3407
3392
|
uniforms: this.uniforms,
|
|
3408
|
-
vertexShader:
|
|
3409
|
-
fragmentShader:
|
|
3410
|
-
}), this._fsQuad = new
|
|
3393
|
+
vertexShader: hn.vertexShader,
|
|
3394
|
+
fragmentShader: hn.fragmentShader
|
|
3395
|
+
}), this._fsQuad = new ke(this.material), this._outputColorSpace = null, this._toneMapping = null;
|
|
3411
3396
|
}
|
|
3412
3397
|
render(e, t, n) {
|
|
3413
|
-
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 = {},
|
|
3398
|
+
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 = {}, f.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));
|
|
3414
3399
|
}
|
|
3415
3400
|
dispose() {
|
|
3416
3401
|
this.material.dispose(), this._fsQuad.dispose();
|
|
3417
3402
|
}
|
|
3418
|
-
},
|
|
3403
|
+
}, _n = {
|
|
3419
3404
|
enabled: !1,
|
|
3420
3405
|
intensity: 1,
|
|
3421
3406
|
lut: "Bourbon 64"
|
|
3422
|
-
},
|
|
3407
|
+
}, vn = class {
|
|
3423
3408
|
get passRenderer() {
|
|
3424
3409
|
return this._passRenderer;
|
|
3425
3410
|
}
|
|
@@ -3475,36 +3460,36 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3475
3460
|
return this._sceneRenderer.outlineRenderer;
|
|
3476
3461
|
}
|
|
3477
3462
|
get debugPass() {
|
|
3478
|
-
return this._debugPass ??= new
|
|
3463
|
+
return this._debugPass ??= new rn(this), this._debugPass;
|
|
3479
3464
|
}
|
|
3480
3465
|
get debugOutput() {
|
|
3481
3466
|
return this._sceneRenderer.debugOutput;
|
|
3482
3467
|
}
|
|
3483
3468
|
constructor(e, t) {
|
|
3484
|
-
this.materialsNeedUpdate = !0, this._passRenderer = new
|
|
3469
|
+
this.materialsNeedUpdate = !0, this._passRenderer = new Le(), this._outlinePass = null, this._debugPass = null, this._cameraUpdate = new Pe(), this._cameraChanged = !0, this._noUpdateNeededCount = 0, this._noOStaticFrames = 0, this._maxSamples = 1, this._passUpdateStates = {
|
|
3485
3470
|
updateGroundReflection: !1,
|
|
3486
3471
|
updateGBuffer: !1,
|
|
3487
3472
|
updateScreenSpaceShadow: !1,
|
|
3488
3473
|
updateShadowAndAoPass: !1,
|
|
3489
3474
|
updateOutlinePass: !1,
|
|
3490
3475
|
updateDebugPass: !1
|
|
3491
|
-
}, this.aoPassMapTexture = null, this._lutMap = /* @__PURE__ */ new Map(), this._lutPassParameters =
|
|
3476
|
+
}, this.aoPassMapTexture = null, this._lutMap = /* @__PURE__ */ new Map(), this._lutPassParameters = _n, this.lutPassNeedsUpdate = !1, this._renderToRenderTarget = !1, this._creator_ = e, this._sceneRenderer = t, this._maxSamples = de(this._sceneRenderer.renderer);
|
|
3492
3477
|
let n = this._sceneRenderer.linearAoFilter, r = n ? this._maxSamples : 0, i = n ? this._maxSamples : 0;
|
|
3493
|
-
this._sceneRenderPass = new
|
|
3478
|
+
this._sceneRenderPass = new an(this), this._bakedGroundContactShadowPass = new yt(this, this._sceneRenderer.renderer, this._sceneRenderer.groundGroup, { sharedShadowGroundPlane: this._sceneRenderer.shadowAndAoGroundPlane }), this._gBufferRenderPass = new wt(this, {
|
|
3494
3479
|
shared: !0,
|
|
3495
3480
|
capabilities: this._sceneRenderer.renderer.capabilities,
|
|
3496
3481
|
width: this._sceneRenderer.width,
|
|
3497
3482
|
height: this._sceneRenderer.height,
|
|
3498
3483
|
samples: r,
|
|
3499
|
-
textureMinificationFilter: n ?
|
|
3500
|
-
textureMagnificationFilter: n ?
|
|
3501
|
-
}), this._groundReflectionPass = new
|
|
3484
|
+
textureMinificationFilter: n ? s : V,
|
|
3485
|
+
textureMagnificationFilter: n ? s : V
|
|
3486
|
+
}), this._groundReflectionPass = new Et(this, this._sceneRenderer.width, this._sceneRenderer.height, this._maxSamples, {}), this._screenSpaceShadowMapPass = new It(this, new x(this._sceneRenderer.width, this._sceneRenderer.height), {
|
|
3502
3487
|
samples: i,
|
|
3503
3488
|
alwaysUpdate: !1
|
|
3504
|
-
}), this._shadowAndAoPass = new
|
|
3489
|
+
}), this._shadowAndAoPass = new et(this, this._sceneRenderer.width, this._sceneRenderer.height, r), this._lutPass = new dn({
|
|
3505
3490
|
lut: void 0,
|
|
3506
3491
|
intensity: 1
|
|
3507
|
-
}), this._outputPass = new
|
|
3492
|
+
}), this._outputPass = new gn();
|
|
3508
3493
|
}
|
|
3509
3494
|
dispose() {
|
|
3510
3495
|
this._sceneRenderPass.dispose(), this._bakedGroundContactShadowPass.dispose(), this._gBufferRenderPass.dispose(), this._groundReflectionPass.dispose(), this._screenSpaceShadowMapPass.dispose(), this._shadowAndAoPass.dispose(), this._outlinePass?.dispose(), this._lutPass.dispose(), this._outputPass.dispose(), this._passRenderTarget?.dispose(), this._passPassRenderTarget?.dispose();
|
|
@@ -3515,34 +3500,34 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3515
3500
|
this._lutPass.setSize(r, i), this._outputPass.setSize(r, i), this._passRenderTarget?.setSize(r, i), this._passPassRenderTarget?.setSize(r, i);
|
|
3516
3501
|
}
|
|
3517
3502
|
loadLutImage(e, t) {
|
|
3518
|
-
this._lutMap.set(e, null), new
|
|
3503
|
+
this._lutMap.set(e, null), new pn().load(t, (t) => {
|
|
3519
3504
|
this._lutMap.set(e, t);
|
|
3520
3505
|
});
|
|
3521
3506
|
}
|
|
3522
3507
|
loadLutCube(e, t) {
|
|
3523
|
-
this._lutMap.set(e, null), new
|
|
3508
|
+
this._lutMap.set(e, null), new fn().load(t, (t) => {
|
|
3524
3509
|
this._lutMap.set(e, t);
|
|
3525
3510
|
});
|
|
3526
3511
|
}
|
|
3527
3512
|
loadLut3dl(e, t) {
|
|
3528
|
-
this._lutMap.set(e, null), new
|
|
3513
|
+
this._lutMap.set(e, null), new mn().load(t, (t) => {
|
|
3529
3514
|
this._lutMap.set(e, t);
|
|
3530
3515
|
});
|
|
3531
3516
|
}
|
|
3532
3517
|
createOutlinePass() {
|
|
3533
|
-
return this._outlinePass ||= new
|
|
3518
|
+
return this._outlinePass ||= new Kt(this, new x(this._sceneRenderer.width, this._sceneRenderer.height), this.scene, this.camera, [], {
|
|
3534
3519
|
downSampleRatio: 2,
|
|
3535
3520
|
edgeDetectionFxaa: !0
|
|
3536
3521
|
}), this._outlinePass;
|
|
3537
3522
|
}
|
|
3538
3523
|
getRenderPassRenderTarget(e) {
|
|
3539
|
-
return this._lutPassParameters.enabled ? (this._passRenderTarget = this._passRenderTarget ?? new
|
|
3524
|
+
return this._lutPassParameters.enabled ? (this._passRenderTarget = this._passRenderTarget ?? new p(this._sceneRenderer.width * e.getPixelRatio(), this._sceneRenderer.height * e.getPixelRatio(), {
|
|
3540
3525
|
type: 1016,
|
|
3541
3526
|
samples: this._maxSamples
|
|
3542
3527
|
}), this._passRenderTarget) : null;
|
|
3543
3528
|
}
|
|
3544
3529
|
getPostPassRenderTarget(e) {
|
|
3545
|
-
return this._lutPassParameters.enabled ? (this._passPassRenderTarget = this._passPassRenderTarget ?? new
|
|
3530
|
+
return this._lutPassParameters.enabled ? (this._passPassRenderTarget = this._passPassRenderTarget ?? new p(this._sceneRenderer.width * e.getPixelRatio(), this._sceneRenderer.height * e.getPixelRatio(), { type: 1016 }), this._passPassRenderTarget) : null;
|
|
3546
3531
|
}
|
|
3547
3532
|
setGroundVisibility(e) {
|
|
3548
3533
|
this._sceneRenderer.shadowAndAoGroundPlane.setVisibility(e);
|
|
@@ -3633,12 +3618,12 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3633
3618
|
this.materialsNeedUpdate = !1, t.traverse((e) => {
|
|
3634
3619
|
if (e.isMesh) {
|
|
3635
3620
|
let t = e.material;
|
|
3636
|
-
t instanceof
|
|
3621
|
+
t instanceof D && this._updateMaterial(e, t, n);
|
|
3637
3622
|
}
|
|
3638
3623
|
});
|
|
3639
3624
|
}
|
|
3640
3625
|
_updateMaterial(e, t, n) {
|
|
3641
|
-
let r =
|
|
3626
|
+
let r = on.addPlugin(t);
|
|
3642
3627
|
r && (this._updatePlugInAo(r, e, t, n), this._updatePlugInReflection(r, e), t.needsUpdate = !1);
|
|
3643
3628
|
}
|
|
3644
3629
|
_updatePlugInAo(e, t, n, r) {
|
|
@@ -3651,20 +3636,18 @@ var Me = "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
|
|
|
3651
3636
|
}
|
|
3652
3637
|
renderPasses(e, t) {
|
|
3653
3638
|
let n = this.getRenderPassRenderTarget(e), r = this.getPostPassRenderTarget(e);
|
|
3654
|
-
e.setRenderTarget(n);
|
|
3655
|
-
let i = V(e);
|
|
3656
|
-
i && this._bakedGroundContactShadowPass.renderPass(e), this._passUpdateStates.updateGBuffer && i && this._gBufferRenderPass.renderPass(e), this._passUpdateStates.updateScreenSpaceShadow && i && this._screenSpaceShadowMapPass.renderPass(e), this._passUpdateStates.updateShadowAndAoPass && i && this._shadowAndAoPass.renderPass(e), this._updateMaterials(e, t), this._sceneRenderPass.renderPass(e), this._passUpdateStates.updateGroundReflection && i && this._groundReflectionPass.renderPass(e), this._passUpdateStates.updateShadowAndAoPass && !this._shadowAndAoPass.parameters.applyToMaterial && i && this._shadowAndAoPass.renderToTarget(e), this._lutPassParameters.enabled && (e.setRenderTarget(r), this._outputPass.renderToScreen = !1, this._outputPass.render(e, e.getRenderTarget(), n, 0, !1), e.setRenderTarget(null), this._lutPass.renderToScreen = !0, this._lutPass.render(e, e.getRenderTarget(), r, 0, !1)), this._passUpdateStates.updateOutlinePass && i && this._outlinePass?.renderPass(e), this._passUpdateStates.updateDebugPass && i && this._debugPass?.renderPass(e);
|
|
3639
|
+
e.setRenderTarget(n), this._bakedGroundContactShadowPass.renderPass(e), this._passUpdateStates.updateGBuffer && this._gBufferRenderPass.renderPass(e), this._passUpdateStates.updateScreenSpaceShadow && this._screenSpaceShadowMapPass.renderPass(e), this._passUpdateStates.updateShadowAndAoPass && this._shadowAndAoPass.renderPass(e), this._updateMaterials(e, t), this._sceneRenderPass.renderPass(e), this._passUpdateStates.updateGroundReflection && this._groundReflectionPass.renderPass(e), this._passUpdateStates.updateShadowAndAoPass && !this._shadowAndAoPass.parameters.applyToMaterial && this._shadowAndAoPass.renderToTarget(e), this._lutPassParameters.enabled && (e.setRenderTarget(r), this._outputPass.renderToScreen = !1, this._outputPass.render(e, e.getRenderTarget(), n, 0, !1), e.setRenderTarget(null), this._lutPass.renderToScreen = !0, this._lutPass.render(e, e.getRenderTarget(), r, 0, !1)), this._passUpdateStates.updateOutlinePass && this._outlinePass?.renderPass(e), this._passUpdateStates.updateDebugPass && this._debugPass?.renderPass(e);
|
|
3657
3640
|
}
|
|
3658
3641
|
};
|
|
3659
|
-
|
|
3642
|
+
he([me, pe("design:type", Object)], vn.prototype, "_initData", void 0);
|
|
3660
3643
|
//#endregion
|
|
3661
3644
|
//#region packages/common-core/src/webgl/renderer/scene-renderer.ts
|
|
3662
|
-
var
|
|
3645
|
+
var yn = {
|
|
3663
3646
|
HIGHEST: "highest",
|
|
3664
3647
|
HIGH: "high",
|
|
3665
3648
|
MEDIUM: "medium",
|
|
3666
3649
|
LOW: "low"
|
|
3667
|
-
},
|
|
3650
|
+
}, bn = class {
|
|
3668
3651
|
get sceneRenderPass() {
|
|
3669
3652
|
return this._renderPassManager.sceneRenderPass;
|
|
3670
3653
|
}
|
|
@@ -3696,7 +3679,7 @@ var kn = {
|
|
|
3696
3679
|
return this._shadowAndAoGroundPlane;
|
|
3697
3680
|
}
|
|
3698
3681
|
constructor(e, t, n, r, i) {
|
|
3699
|
-
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
|
|
3682
|
+
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 Ne(), this.boundingVolumeSet = !1, this.renderCacheManager = new mt(), this.selectedObjects = [], this.groundGroup = new F(), this._shadingType = nt.DEFAULT, this._qualityLevel = yn.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 ht((e) => e === this.groundGroup)), this.renderCacheManager.registerCache("groundReflection", new ht((e) => e === this.groundGroup || e.name === "dimensioning" ? !0 : !!(e instanceof R && ft(e.material)))), this.renderCacheManager.registerCache("debug", new ht()), this.renderCacheManager.registerCache("floorDepthWrite", new gt((e) => e.userData?.isFloor)), this._shadowAndAoGroundPlane = new ze(null), this.groundGroup.rotateX(-Math.PI / 2), this._renderPassManager = new vn(e, this), this.outlineRenderer = new tt(this._renderPassManager, null, {}), this.parameters = {
|
|
3700
3683
|
gBufferRenderTargetParameters: this.gBufferRenderPass.parameters,
|
|
3701
3684
|
bakedGroundContactShadowParameters: this.bakedGroundContactShadowPass.parameters,
|
|
3702
3685
|
screenSpaceShadowMapParameters: this.screenSpaceShadowMapPass.parameters,
|
|
@@ -3749,11 +3732,11 @@ var kn = {
|
|
|
3749
3732
|
applyCurrentParameters() {
|
|
3750
3733
|
let e = [];
|
|
3751
3734
|
this._qualityMap.has(this._qualityLevel) && e.push(this._qualityMap.get(this._qualityLevel));
|
|
3752
|
-
let t =
|
|
3735
|
+
let t = ot(this._shadingType);
|
|
3753
3736
|
t && e.push(t);
|
|
3754
|
-
let n =
|
|
3755
|
-
if (n && e.push(n), this._customShadingParameters && e.push(
|
|
3756
|
-
let t =
|
|
3737
|
+
let n = at(this.uiInteractionMode);
|
|
3738
|
+
if (n && e.push(n), this._customShadingParameters && e.push(st(this._customShadingParameters)), e.length > 0) {
|
|
3739
|
+
let t = it(...e);
|
|
3757
3740
|
this.updateParameters(t), this.bakedGroundContactShadowPass.applyParameters();
|
|
3758
3741
|
}
|
|
3759
3742
|
}
|
|
@@ -3808,7 +3791,7 @@ var kn = {
|
|
|
3808
3791
|
let n = e.userData;
|
|
3809
3792
|
if (t.userData?.environmentDefinition.needsUpdate || !n.environmentTexture || n.environmentDefinition !== t.userData.environmentDefinition) {
|
|
3810
3793
|
let r = t.userData.environmentDefinition;
|
|
3811
|
-
if (n.environmentDefinition = r, n.environmentTexture = r.createNewEnvironment(e), t.userData.shadowFromEnvironment &&
|
|
3794
|
+
if (n.environmentDefinition = r, n.environmentTexture = r.createNewEnvironment(e), t.userData.shadowFromEnvironment && e instanceof ue) {
|
|
3812
3795
|
let e = r.maxNoOfLightSources;
|
|
3813
3796
|
e !== void 0 && (this.screenSpaceShadowMapPass.parameters.maximumNumberOfLightSources = e), this.createShadowFromLightSources(t, r.lightSources);
|
|
3814
3797
|
}
|
|
@@ -3819,8 +3802,8 @@ var kn = {
|
|
|
3819
3802
|
e.add(this.groundGroup), this._updateEnvironment(this.renderer, e), this.outlineRenderer.updateOutline(e, t, this.enableObjectSelection ? this.selectedObjects : []), this._renderPassManager.updatePasses(this.renderer, e, t), this._renderPassManager.renderPasses(this.renderer, e), e.remove(this.groundGroup);
|
|
3820
3803
|
}
|
|
3821
3804
|
};
|
|
3822
|
-
|
|
3805
|
+
he([me, pe("design:type", Object)], bn.prototype, "_initData", void 0);
|
|
3823
3806
|
//#endregion
|
|
3824
|
-
export {
|
|
3807
|
+
export { At as a, Be as c, $t as i, bn as n, nt as o, Qt as r, Z as s, yn as t };
|
|
3825
3808
|
|
|
3826
|
-
//# sourceMappingURL=scene-renderer-
|
|
3809
|
+
//# sourceMappingURL=scene-renderer-DWY_zPvU.mjs.map
|