babylonjs-addons 9.26.0 → 9.26.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.
@@ -79,27 +79,27 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
79
79
  };
80
80
  !function (e, t) { "object" == typeof exports && "undefined" != typeof module ? t(exports, require("babylonjs")) : "function" == typeof define && define.amd ? define(["exports", "babylonjs"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).ADDONS = e.ADDONS || {}, e.BABYLON); }(this, function (e, t) {
81
81
  "use strict";
82
- var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _f, e_6, _g, e_7, _h, e_8, _j, e_9, _k, e_10, _l, e_11, _m, e_12, _o, e_13, _p, e_14, _q, e_15, _r, e_16, _s, e_17, _u, e_18, _v;
83
- function i(e, t, i, n) { return new (i || (i = Promise))(function (r, a) { function s(e) { try {
84
- l(n.next(e));
82
+ var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _f, e_6, _g, e_7, _h, e_8, _j, e_9, _k, e_10, _l, e_11, _m, e_12, _o, e_13, _p, e_14, _q, e_15, _s, e_16, _u, e_17, _v, e_18, _w;
83
+ function i(e, t, i, r) { return new (i || (i = Promise))(function (n, a) { function s(e) { try {
84
+ l(r.next(e));
85
85
  }
86
86
  catch (e) {
87
87
  a(e);
88
88
  } } function o(e) { try {
89
- l(n.throw(e));
89
+ l(r.throw(e));
90
90
  }
91
91
  catch (e) {
92
92
  a(e);
93
- } } function l(e) { var t; e.done ? r(e.value) : (t = e.value, t instanceof i ? t : new i(function (e) { e(t); })).then(s, o); } l((n = n.apply(e, t || [])).next()); }); }
93
+ } } function l(e) { var t; e.done ? n(e.value) : (t = e.value, t instanceof i ? t : new i(function (e) { e(t); })).then(s, o); } l((r = r.apply(e, t || [])).next()); }); }
94
94
  Object.create, Object.create, "function" == typeof SuppressedError && SuppressedError, t.MaterialDefines;
95
- var n = "originOffsetKm", r = "inverseViewportSize", a = [{ name: n, size: 3, type: "vec3" }, { name: "_atmoPbrPadding1", size: 1, type: "float" }, { name: r, size: 2, type: "vec2" }], s = { x: 0, y: 0, z: 0 }, o = ["atmosphereFunctions", "atmosphereUboDeclaration", "atmosphereFragmentDeclaration"], l = ["atmosphereFunctions", "atmosphereUboDeclaration"], c = { loaded: !1, loadPromise: null, nextRetryTime: 0 }, d = { loaded: !1, loadPromise: null, nextRetryTime: 0 };
96
- function h(e) { return 1 === e ? d : c; }
97
- function u(e) {
95
+ var r = "originOffsetKm", n = "inverseViewportSize", a = [{ name: r, size: 3, type: "vec3" }, { name: "_atmoPbrPadding1", size: 1, type: "float" }, { name: n, size: 2, type: "vec2" }], s = { x: 0, y: 0, z: 0 }, o = ["atmosphereFunctions", "atmosphereUboDeclaration", "atmosphereFragmentDeclaration"], l = ["atmosphereFunctions", "atmosphereUboDeclaration"], c = { loaded: !1, loadPromise: null, nextRetryTime: 0 }, u = { loaded: !1, loadPromise: null, nextRetryTime: 0 };
96
+ function h(e) { return 1 === e ? u : c; }
97
+ function d(e) {
98
98
  var e_19, _a;
99
- var i = t.ShaderStore.GetIncludesShadersStore(e), n = 1 === e ? l : o;
99
+ var i = t.ShaderStore.GetIncludesShadersStore(e), r = 1 === e ? l : o;
100
100
  try {
101
- for (var n_1 = __values(n), n_1_1 = n_1.next(); !n_1_1.done; n_1_1 = n_1.next()) {
102
- var e_20 = n_1_1.value;
101
+ for (var r_1 = __values(r), r_1_1 = r_1.next(); !r_1_1.done; r_1_1 = r_1.next()) {
102
+ var e_20 = r_1_1.value;
103
103
  if (void 0 === i[e_20])
104
104
  return !1;
105
105
  }
@@ -107,7 +107,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
107
107
  catch (e_19_1) { e_19 = { error: e_19_1 }; }
108
108
  finally {
109
109
  try {
110
- if (n_1_1 && !n_1_1.done && (_a = n_1.return)) _a.call(n_1);
110
+ if (r_1_1 && !r_1_1.done && (_a = r_1.return)) _a.call(r_1);
111
111
  }
112
112
  finally { if (e_19) throw e_19.error; }
113
113
  }
@@ -117,7 +117,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
117
117
  switch (_a.label) {
118
118
  case 0:
119
119
  t = h(e);
120
- if (!(t.loaded || u(e))) return [3 /*break*/, 1];
120
+ if (!(t.loaded || d(e))) return [3 /*break*/, 1];
121
121
  t.loaded = !0;
122
122
  return [3 /*break*/, 5];
123
123
  case 1:
@@ -125,11 +125,11 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
125
125
  switch (_b.label) {
126
126
  case 0:
127
127
  if (!(1 === e)) return [3 /*break*/, 2];
128
- return [4 /*yield*/, Promise.all([Promise.resolve().then(function () { return vt; }), Promise.resolve().then(function () { return Tt; })])];
128
+ return [4 /*yield*/, Promise.all([Promise.resolve().then(function () { return Lt; }), Promise.resolve().then(function () { return Ct; })])];
129
129
  case 1:
130
130
  _a = _b.sent();
131
131
  return [3 /*break*/, 4];
132
- case 2: return [4 /*yield*/, Promise.all([Promise.resolve().then(function () { return Rt; }), Promise.resolve().then(function () { return It; }), Promise.resolve().then(function () { return Dt; })])];
132
+ case 2: return [4 /*yield*/, Promise.all([Promise.resolve().then(function () { return wt; }), Promise.resolve().then(function () { return Nt; }), Promise.resolve().then(function () { return Gt; })])];
133
133
  case 3:
134
134
  _a = _b.sent();
135
135
  _b.label = 4;
@@ -164,7 +164,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
164
164
  var i_1 = 1 === this._material.shaderLanguage ? "atmosphere" : t.name;
165
165
  e.push(i_1);
166
166
  } };
167
- p.prototype.getUniforms = function () { return e = this._atmosphere, { ubo: a, fragment: "uniform vec2 ".concat(r, ";\nuniform vec3 ").concat(n, ";\n"), externalUniforms: e.uniformBuffer.getUniformNames() }; var e; };
167
+ p.prototype.getUniforms = function () { return e = this._atmosphere, { ubo: a, fragment: "uniform vec2 ".concat(n, ";\nuniform vec3 ").concat(r, ";\n"), externalUniforms: e.uniformBuffer.getUniformNames() }; var e; };
168
168
  p.prototype.isReadyForSubMesh = function () { var e; if (!this._ensureShaderIncludesLoaded())
169
169
  return !1; var t = this._atmosphere; if (!(null === (e = t.transmittanceLut) || void 0 === e ? void 0 : e.hasLutData) || t.diffuseSkyIrradianceLut && !t.diffuseSkyIrradianceLut.hasLutData)
170
170
  return !1; if (this._isAerialPerspectiveEnabled && t.isAerialPerspectiveLutEnabled) {
@@ -172,8 +172,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
172
172
  if (!(null == e_22 ? void 0 : e_22.isReady()))
173
173
  return !1;
174
174
  } return !0; };
175
- p.prototype._ensureShaderIncludesLoaded = function () { var e = this._material.shaderLanguage, t = h(e); return t.loaded || u(e) ? (t.loaded = !0, !0) : (!t.loadPromise && Date.now() >= t.nextRetryTime && this._tryLoadShaderIncludesAsync(e, t), !1); };
176
- p.prototype._tryLoadShaderIncludesAsync = function (e, n) { return i(this, void 0, void 0, function () { var e_23; return __generator(this, function (_a) {
175
+ p.prototype._ensureShaderIncludesLoaded = function () { var e = this._material.shaderLanguage, t = h(e); return t.loaded || d(e) ? (t.loaded = !0, !0) : (!t.loadPromise && Date.now() >= t.nextRetryTime && this._tryLoadShaderIncludesAsync(e, t), !1); };
176
+ p.prototype._tryLoadShaderIncludesAsync = function (e, r) { return i(this, void 0, void 0, function () { var e_23; return __generator(this, function (_a) {
177
177
  switch (_a.label) {
178
178
  case 0:
179
179
  _a.trys.push([0, 2, , 3]);
@@ -183,7 +183,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
183
183
  return [3 /*break*/, 3];
184
184
  case 2:
185
185
  e_23 = _a.sent();
186
- t.Logger.Error("AtmospherePBRMaterialPlugin: Failed to load atmosphere shader includes; the atmosphere material will not render until they load. Retrying in 5s. ".concat(e_23)), n.nextRetryTime = Date.now() + 5e3;
186
+ t.Logger.Error("AtmospherePBRMaterialPlugin: Failed to load atmosphere shader includes; the atmosphere material will not render until they load. Retrying in 5s. ".concat(e_23)), r.nextRetryTime = Date.now() + 5e3;
187
187
  return [3 /*break*/, 3];
188
188
  case 3: return [2 /*return*/];
189
189
  }
@@ -199,18 +199,18 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
199
199
  }
200
200
  });
201
201
  }); };
202
- p.prototype.getActiveTextures = function (e) { var t, i; var n = this._atmosphere; if (this._isAerialPerspectiveEnabled && n.isAerialPerspectiveLutEnabled) {
203
- var t_1 = n.aerialPerspectiveLutRenderTarget;
202
+ p.prototype.getActiveTextures = function (e) { var t, i; var r = this._atmosphere; if (this._isAerialPerspectiveEnabled && r.isAerialPerspectiveLutEnabled) {
203
+ var t_1 = r.aerialPerspectiveLutRenderTarget;
204
204
  t_1 && e.push(t_1);
205
- } var r = null !== (i = null === (t = n.transmittanceLut) || void 0 === t ? void 0 : t.renderTarget) && void 0 !== i ? i : null; r && e.push(r); };
206
- p.prototype.bindForSubMesh = function (e) { var i, a; var o = this._atmosphere, l = o.scene, c = l.getEngine(), d = e.currentEffect; d && this._atmosphere.bindUniformBufferToEffect(d), e.updateVector3(n, l.floatingOriginMode ? t.Vector3ScaleToRef(l.floatingOriginOffset, .001, s) : t.Vector3FromFloatsToRef(0, o.physicalProperties.planetRadius, 0, s)); var h = c.getRenderWidth(), u = c.getRenderHeight(); if (e.updateFloat2(r, 1 / h, 1 / u), this._isAerialPerspectiveEnabled && o.isAerialPerspectiveLutEnabled) {
205
+ } var n = null !== (i = null === (t = r.transmittanceLut) || void 0 === t ? void 0 : t.renderTarget) && void 0 !== i ? i : null; n && e.push(n); };
206
+ p.prototype.bindForSubMesh = function (e) { var i, a; var o = this._atmosphere, l = o.scene, c = l.getEngine(), u = e.currentEffect; u && this._atmosphere.bindUniformBufferToEffect(u), e.updateVector3(r, l.floatingOriginMode ? t.Vector3ScaleToRef(l.floatingOriginOffset, .001, s) : t.Vector3FromFloatsToRef(0, o.physicalProperties.planetRadius, 0, s)); var h = c.getRenderWidth(), d = c.getRenderHeight(); if (e.updateFloat2(n, 1 / h, 1 / d), this._isAerialPerspectiveEnabled && o.isAerialPerspectiveLutEnabled) {
207
207
  var t_2 = o.aerialPerspectiveLutRenderTarget;
208
208
  e.setTexture("aerialPerspectiveLut", t_2);
209
209
  } var m = null !== (a = null === (i = o.transmittanceLut) || void 0 === i ? void 0 : i.renderTarget) && void 0 !== a ? a : null; e.setTexture("transmittanceLut", m); };
210
- p.prototype.prepareDefines = function (e) { var t = e.USE_CUSTOM_REFLECTION, i = e.USE_AERIAL_PERSPECTIVE_LUT, n = e.APPLY_AERIAL_PERSPECTIVE_INTENSITY, r = e.APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS; e.USE_CUSTOM_REFLECTION = null !== this._atmosphere.diffuseSkyIrradianceLut && !!e.USEIRRADIANCEMAP, e.USE_AERIAL_PERSPECTIVE_LUT = this._isAerialPerspectiveEnabled && this._atmosphere.isAerialPerspectiveLutEnabled, e.APPLY_AERIAL_PERSPECTIVE_INTENSITY = this._isAerialPerspectiveEnabled && 1 !== this._atmosphere.aerialPerspectiveIntensity, e.APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS = this._isAerialPerspectiveEnabled && 0 !== this._atmosphere.aerialPerspectiveRadianceBias, t === e.USE_CUSTOM_REFLECTION && i === e.USE_AERIAL_PERSPECTIVE_LUT && n === e.APPLY_AERIAL_PERSPECTIVE_INTENSITY && r === e.APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS || e.markAllAsDirty(); };
210
+ p.prototype.prepareDefines = function (e) { var t = e.USE_CUSTOM_REFLECTION, i = e.USE_AERIAL_PERSPECTIVE_LUT, r = e.APPLY_AERIAL_PERSPECTIVE_INTENSITY, n = e.APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS; e.USE_CUSTOM_REFLECTION = null !== this._atmosphere.diffuseSkyIrradianceLut && !!e.USEIRRADIANCEMAP, e.USE_AERIAL_PERSPECTIVE_LUT = this._isAerialPerspectiveEnabled && this._atmosphere.isAerialPerspectiveLutEnabled, e.APPLY_AERIAL_PERSPECTIVE_INTENSITY = this._isAerialPerspectiveEnabled && 1 !== this._atmosphere.aerialPerspectiveIntensity, e.APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS = this._isAerialPerspectiveEnabled && 0 !== this._atmosphere.aerialPerspectiveRadianceBias, t === e.USE_CUSTOM_REFLECTION && i === e.USE_AERIAL_PERSPECTIVE_LUT && r === e.APPLY_AERIAL_PERSPECTIVE_INTENSITY && n === e.APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS || e.markAllAsDirty(); };
211
211
  p.prototype.getSamplers = function (e) { e.push("transmittanceLut"), this._isAerialPerspectiveEnabled && this._atmosphere.isAerialPerspectiveLutEnabled && e.push("aerialPerspectiveLut"); };
212
212
  p.prototype.getCustomCode = function (e, t) { if ("fragment" !== e)
213
- return null; var i = this._atmosphere.scene.getEngine().supportsUniformBuffers ? "-light0.vLightData.xyz" : "-vLightData0.xyz", a = 1 === t || this._atmosphere.uniformBuffer.useUbo ? "#include<atmosphereUboDeclaration>" : "#include<atmosphereFragmentDeclaration>"; return 0 === t ? { CUSTOM_FRAGMENT_DEFINITIONS: this._isAerialPerspectiveEnabled && this._atmosphere.isAerialPerspectiveLutEnabled ? "uniform sampler2D transmittanceLut;\r\nprecision highp sampler2DArray;\r\nuniform sampler2DArray aerialPerspectiveLut;\r\n".concat(a, "\r\n#include<atmosphereFunctions>") : "uniform sampler2D transmittanceLut;\r\n".concat(a, "\r\n#include<atmosphereFunctions>"), CUSTOM_LIGHT0_COLOR: "\n {\n vec3 positionGlobal = 0.001 * vPositionW + ".concat(n, ";\n float positionRadius = length(positionGlobal);\n vec3 geocentricNormal = positionGlobal / positionRadius;\n vec3 directionToLight = ").concat(i, ";\n float cosAngleLightToZenith = dot(directionToLight, geocentricNormal);\n diffuse0 = lightIntensity * sampleTransmittanceLut(transmittanceLut, positionRadius, cosAngleLightToZenith);\n }\n"), CUSTOM_REFLECTION: "\n {\n vec3 positionGlobal = 0.001 * vPositionW + ".concat(n, ";\n float positionRadius = length(positionGlobal);\n vec3 geocentricNormal = positionGlobal / positionRadius;\n\n vec3 directionToLight = ").concat(i, ";\n float cosAngleLightToZenith = dot(directionToLight, geocentricNormal);\n\n vec2 uv = vec2(0.5 + 0.5 * cosAngleLightToZenith, (positionRadius - planetRadius) / atmosphereThickness);\n float irradianceScaleT = 0.5 * dot(normalW, geocentricNormal) + 0.5;\n float irradianceScale = ((-0.6652 * irradianceScaleT) + 1.5927) * irradianceScaleT + 0.1023;\n vec3 environmentIrradiance = lightIntensity * sampleReflection(irradianceSampler, uv).rgb;\n\n // Add a contribution here to estimate indirect lighting.\n const float r = 0.2;\n float indirect = getLuminanceUnclamped(environmentIrradiance) / max(0.00001, 1. - r);\n environmentIrradiance *= irradianceScale;\n environmentIrradiance += indirect;\n\n environmentIrradiance += additionalDiffuseSkyIrradiance;\n\n const float diffuseBrdf = 1. / PI;\n environmentIrradiance *= diffuseBrdf * diffuseSkyIrradianceIntensity;\n\n reflectionOut.environmentIrradiance = environmentIrradiance;\n reflectionOut.environmentRadiance.rgb = reflectionOut.environmentIrradiance;\n }\n"), CUSTOM_FRAGMENT_BEFORE_FOG: "\n #if USE_AERIAL_PERSPECTIVE_LUT\n {\n float distanceFromCameraKm = 0.001 * distance(vEyePosition.xyz, vPositionW);\n vec4 aerialPerspective = vec4(0.);\n if (sampleAerialPerspectiveLut(\n gl_FragCoord.xy * ".concat(r, ",\n true,\n distanceFromCameraKm,\n NumAerialPerspectiveLutLayers,\n AerialPerspectiveLutKMPerSlice,\n AerialPerspectiveLutRangeKM,\n aerialPerspective)) {\n finalColor = aerialPerspective + (1. - aerialPerspective.a) * finalColor;\n }\n }\n #endif\n") } : { CUSTOM_FRAGMENT_DEFINITIONS: this._isAerialPerspectiveEnabled && this._atmosphere.isAerialPerspectiveLutEnabled ? "var transmittanceLutSampler: sampler;\r\nvar transmittanceLut: texture_2d<f32>;\r\nvar aerialPerspectiveLutSampler: sampler;\r\nvar aerialPerspectiveLut: texture_2d_array<f32>;\r\n".concat(a, "\r\n#include<atmosphereFunctions>") : "var transmittanceLutSampler: sampler;\r\nvar transmittanceLut: texture_2d<f32>;\r\n".concat(a, "\r\n#include<atmosphereFunctions>"), CUSTOM_LIGHT0_COLOR: "\n {\n var positionGlobal = 0.001 * fragmentInputs.vPositionW + uniforms.".concat(n, ";\n var positionRadius = length(positionGlobal);\n var geocentricNormal = positionGlobal / positionRadius;\n var directionToLight = ").concat(i, ";\n var cosAngleLightToZenith = dot(directionToLight, geocentricNormal);\n diffuse0 = atmosphere.lightIntensity * sampleTransmittanceLut(transmittanceLut, positionRadius, cosAngleLightToZenith);\n }\n"), CUSTOM_REFLECTION: "\n {\n var positionGlobal = 0.001 * fragmentInputs.vPositionW + uniforms.".concat(n, ";\n var positionRadius = length(positionGlobal);\n var geocentricNormal = positionGlobal / positionRadius;\n\n var directionToLight = ").concat(i, ";\n var cosAngleLightToZenith = dot(directionToLight, geocentricNormal);\n\n var uv = vec2f(0.5 + 0.5 * cosAngleLightToZenith, (positionRadius - atmosphere.planetRadius) / atmosphere.atmosphereThickness);\n var irradianceScaleT = 0.5 * dot(normalW, geocentricNormal) + 0.5;\n var irradianceScale = ((-0.6652 * irradianceScaleT) + 1.5927) * irradianceScaleT + 0.1023;\n var environmentIrradiance = atmosphere.lightIntensity * textureSample(irradianceSampler, irradianceSamplerSampler, uv).rgb;\n\n // Add a contribution here to estimate indirect lighting.\n const r = 0.2;\n var indirect = getLuminanceUnclamped(environmentIrradiance) / max(0.00001, 1.0 - r);\n environmentIrradiance *= irradianceScale;\n environmentIrradiance += indirect;\n\n environmentIrradiance += atmosphere.additionalDiffuseSkyIrradiance;\n\n const diffuseBrdf = 1.0 / PI;\n environmentIrradiance *= diffuseBrdf * atmosphere.diffuseSkyIrradianceIntensity;\n\n reflectionOut.environmentIrradiance = environmentIrradiance;\n reflectionOut.environmentRadiance = vec4f(reflectionOut.environmentIrradiance, reflectionOut.environmentRadiance.a);\n }\n"), CUSTOM_FRAGMENT_BEFORE_FOG: "\n #if USE_AERIAL_PERSPECTIVE_LUT\n {\n var distanceFromCameraKm = 0.001 * distance(scene.vEyePosition.xyz, fragmentInputs.vPositionW);\n var aerialPerspective = vec4f(0.);\n if (sampleAerialPerspectiveLut(\n fragmentInputs.position.xy * uniforms.".concat(r, ",\n true,\n distanceFromCameraKm,\n NumAerialPerspectiveLutLayers,\n AerialPerspectiveLutKMPerSlice,\n AerialPerspectiveLutRangeKM,\n &aerialPerspective)) {\n finalColor = aerialPerspective + (1. - aerialPerspective.a) * finalColor;\n }\n }\n #endif\n") }; };
213
+ return null; var i = this._atmosphere.scene.getEngine().supportsUniformBuffers ? "-light0.vLightData.xyz" : "-vLightData0.xyz", a = 1 === t || this._atmosphere.uniformBuffer.useUbo ? "#include<atmosphereUboDeclaration>" : "#include<atmosphereFragmentDeclaration>"; return 0 === t ? { CUSTOM_FRAGMENT_DEFINITIONS: this._isAerialPerspectiveEnabled && this._atmosphere.isAerialPerspectiveLutEnabled ? "uniform sampler2D transmittanceLut;\r\nprecision highp sampler2DArray;\r\nuniform sampler2DArray aerialPerspectiveLut;\r\n".concat(a, "\r\n#include<atmosphereFunctions>") : "uniform sampler2D transmittanceLut;\r\n".concat(a, "\r\n#include<atmosphereFunctions>"), CUSTOM_LIGHT0_COLOR: "\n {\n vec3 positionGlobal = 0.001 * vPositionW + ".concat(r, ";\n float positionRadius = length(positionGlobal);\n vec3 geocentricNormal = positionGlobal / positionRadius;\n vec3 directionToLight = ").concat(i, ";\n float cosAngleLightToZenith = dot(directionToLight, geocentricNormal);\n diffuse0 = lightIntensity * sampleTransmittanceLut(transmittanceLut, positionRadius, cosAngleLightToZenith);\n }\n"), CUSTOM_REFLECTION: "\n {\n vec3 positionGlobal = 0.001 * vPositionW + ".concat(r, ";\n float positionRadius = length(positionGlobal);\n vec3 geocentricNormal = positionGlobal / positionRadius;\n\n vec3 directionToLight = ").concat(i, ";\n float cosAngleLightToZenith = dot(directionToLight, geocentricNormal);\n\n vec2 uv = vec2(0.5 + 0.5 * cosAngleLightToZenith, (positionRadius - planetRadius) / atmosphereThickness);\n float irradianceScaleT = 0.5 * dot(normalW, geocentricNormal) + 0.5;\n float irradianceScale = ((-0.6652 * irradianceScaleT) + 1.5927) * irradianceScaleT + 0.1023;\n vec3 environmentIrradiance = lightIntensity * sampleReflection(irradianceSampler, uv).rgb;\n\n // Add a contribution here to estimate indirect lighting.\n const float r = 0.2;\n float indirect = getLuminanceUnclamped(environmentIrradiance) / max(0.00001, 1. - r);\n environmentIrradiance *= irradianceScale;\n environmentIrradiance += indirect;\n\n environmentIrradiance += additionalDiffuseSkyIrradiance;\n\n const float diffuseBrdf = 1. / PI;\n environmentIrradiance *= diffuseBrdf * diffuseSkyIrradianceIntensity;\n\n reflectionOut.environmentIrradiance = environmentIrradiance;\n reflectionOut.environmentRadiance.rgb = reflectionOut.environmentIrradiance;\n }\n"), CUSTOM_FRAGMENT_BEFORE_FOG: "\n #if USE_AERIAL_PERSPECTIVE_LUT\n {\n float distanceFromCameraKm = 0.001 * distance(vEyePosition.xyz, vPositionW);\n vec4 aerialPerspective = vec4(0.);\n if (sampleAerialPerspectiveLut(\n gl_FragCoord.xy * ".concat(n, ",\n true,\n distanceFromCameraKm,\n NumAerialPerspectiveLutLayers,\n AerialPerspectiveLutKMPerSlice,\n AerialPerspectiveLutRangeKM,\n aerialPerspective)) {\n finalColor = aerialPerspective + (1. - aerialPerspective.a) * finalColor;\n }\n }\n #endif\n") } : { CUSTOM_FRAGMENT_DEFINITIONS: this._isAerialPerspectiveEnabled && this._atmosphere.isAerialPerspectiveLutEnabled ? "var transmittanceLutSampler: sampler;\r\nvar transmittanceLut: texture_2d<f32>;\r\nvar aerialPerspectiveLutSampler: sampler;\r\nvar aerialPerspectiveLut: texture_2d_array<f32>;\r\n".concat(a, "\r\n#include<atmosphereFunctions>") : "var transmittanceLutSampler: sampler;\r\nvar transmittanceLut: texture_2d<f32>;\r\n".concat(a, "\r\n#include<atmosphereFunctions>"), CUSTOM_LIGHT0_COLOR: "\n {\n var positionGlobal = 0.001 * fragmentInputs.vPositionW + uniforms.".concat(r, ";\n var positionRadius = length(positionGlobal);\n var geocentricNormal = positionGlobal / positionRadius;\n var directionToLight = ").concat(i, ";\n var cosAngleLightToZenith = dot(directionToLight, geocentricNormal);\n diffuse0 = atmosphere.lightIntensity * sampleTransmittanceLut(transmittanceLut, positionRadius, cosAngleLightToZenith);\n }\n"), CUSTOM_REFLECTION: "\n {\n var positionGlobal = 0.001 * fragmentInputs.vPositionW + uniforms.".concat(r, ";\n var positionRadius = length(positionGlobal);\n var geocentricNormal = positionGlobal / positionRadius;\n\n var directionToLight = ").concat(i, ";\n var cosAngleLightToZenith = dot(directionToLight, geocentricNormal);\n\n var uv = vec2f(0.5 + 0.5 * cosAngleLightToZenith, (positionRadius - atmosphere.planetRadius) / atmosphere.atmosphereThickness);\n var irradianceScaleT = 0.5 * dot(normalW, geocentricNormal) + 0.5;\n var irradianceScale = ((-0.6652 * irradianceScaleT) + 1.5927) * irradianceScaleT + 0.1023;\n var environmentIrradiance = atmosphere.lightIntensity * textureSample(irradianceSampler, irradianceSamplerSampler, uv).rgb;\n\n // Add a contribution here to estimate indirect lighting.\n const r = 0.2;\n var indirect = getLuminanceUnclamped(environmentIrradiance) / max(0.00001, 1.0 - r);\n environmentIrradiance *= irradianceScale;\n environmentIrradiance += indirect;\n\n environmentIrradiance += atmosphere.additionalDiffuseSkyIrradiance;\n\n const diffuseBrdf = 1.0 / PI;\n environmentIrradiance *= diffuseBrdf * atmosphere.diffuseSkyIrradianceIntensity;\n\n reflectionOut.environmentIrradiance = environmentIrradiance;\n reflectionOut.environmentRadiance = vec4f(reflectionOut.environmentIrradiance, reflectionOut.environmentRadiance.a);\n }\n"), CUSTOM_FRAGMENT_BEFORE_FOG: "\n #if USE_AERIAL_PERSPECTIVE_LUT\n {\n var distanceFromCameraKm = 0.001 * distance(scene.vEyePosition.xyz, fragmentInputs.vPositionW);\n var aerialPerspective = vec4f(0.);\n if (sampleAerialPerspectiveLut(\n fragmentInputs.position.xy * uniforms.".concat(n, ",\n true,\n distanceFromCameraKm,\n NumAerialPerspectiveLutLayers,\n AerialPerspectiveLutKMPerSlice,\n AerialPerspectiveLutRangeKM,\n &aerialPerspective)) {\n finalColor = aerialPerspective + (1. - aerialPerspective.a) * finalColor;\n }\n }\n #endif\n") }; };
214
214
  return p;
215
215
  }(t.MaterialPluginBase));
216
216
  var f = new t.Ray(t.Vector3.Zero(), t.Vector3.Zero());
@@ -298,18 +298,18 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
298
298
  enumerable: false,
299
299
  configurable: true
300
300
  });
301
- g.prototype.update = function (e, i, n, r, a, s) { this._cameraNearPlane = e.minZ, this._cameraForward.copyFrom(e.getForwardRayToRef(f, 1).direction); var o = e.getScene(), l = o.getEngine(); this._viewport.copyFromFloats(0, 0, l.getRenderWidth(), l.getRenderHeight()); var c = e.getViewMatrix(), d = e.getProjectionMatrix(), h = this._lastViewMatrix, u = this._lastProjectionMatrix; h.equals(c) && u.equals(d) || (h.copyFrom(c), h.setTranslation(t.Vector3.ZeroReadOnly), h.invertToRef(this._inverseViewMatrixWithoutTranslation), u.copyFrom(d), u.invertToRef(this._inverseProjectionMatrix), this._inverseProjectionMatrix.multiplyToRef(this._inverseViewMatrixWithoutTranslation, this._inverseViewProjectionMatrixWithoutTranslation)); var m = this._cameraPosition.copyFrom(e.globalPosition).scaleToRef(.001, this._cameraPositionGlobal); o.floatingOriginMode ? (m.normalizeToRef(this._cameraGeocentricNormal), this._cameraGeocentricNormal.scaleAndAddToRef(s, m)) : (m.y += i + s, m.normalizeToRef(this._cameraGeocentricNormal)), this._cameraRadius = m.length(), this._cameraHeight = this._cameraRadius - i, this._clampedCameraRadius = this._cameraRadius, this._clampedCameraRadius < n ? (this._clampedCameraRadius = n, this._cameraGeocentricNormal.scaleToRef(n, this._clampedCameraPositionGlobal)) : this._clampedCameraPositionGlobal.copyFrom(m), this._cosCameraHorizonAngleFromZenith = v(i, this._clampedCameraRadius), this._sinCameraAtmosphereHorizonAngleFromNadir = Math.min(1, r / this._clampedCameraRadius), this._clampedCameraHeight = this._clampedCameraRadius - i; {
301
+ g.prototype.update = function (e, i, r, n, a, s) { this._cameraNearPlane = e.minZ, this._cameraForward.copyFrom(e.getForwardRayToRef(f, 1).direction); var o = e.getScene(), l = o.getEngine(); this._viewport.copyFromFloats(0, 0, l.getRenderWidth(), l.getRenderHeight()); var c = e.getViewMatrix(), u = e.getProjectionMatrix(), h = this._lastViewMatrix, d = this._lastProjectionMatrix; h.equals(c) && d.equals(u) || (h.copyFrom(c), h.setTranslation(t.Vector3.ZeroReadOnly), h.invertToRef(this._inverseViewMatrixWithoutTranslation), d.copyFrom(u), d.invertToRef(this._inverseProjectionMatrix), this._inverseProjectionMatrix.multiplyToRef(this._inverseViewMatrixWithoutTranslation, this._inverseViewProjectionMatrixWithoutTranslation)); var m = this._cameraPosition.copyFrom(e.globalPosition).scaleToRef(.001, this._cameraPositionGlobal); o.floatingOriginMode ? (m.normalizeToRef(this._cameraGeocentricNormal), this._cameraGeocentricNormal.scaleAndAddToRef(s, m)) : (m.y += i + s, m.normalizeToRef(this._cameraGeocentricNormal)), this._cameraRadius = m.length(), this._cameraHeight = this._cameraRadius - i, this._clampedCameraRadius = this._cameraRadius, this._clampedCameraRadius < r ? (this._clampedCameraRadius = r, this._cameraGeocentricNormal.scaleToRef(r, this._clampedCameraPositionGlobal)) : this._clampedCameraPositionGlobal.copyFrom(m), this._cosCameraHorizonAngleFromZenith = v(i, this._clampedCameraRadius), this._sinCameraAtmosphereHorizonAngleFromNadir = Math.min(1, n / this._clampedCameraRadius), this._clampedCameraHeight = this._clampedCameraRadius - i; {
302
302
  this._cosAngleLightToZenith = t.Vector3Dot(a, this._cameraGeocentricNormal);
303
303
  var e_24 = Math.sqrt(Math.max(0, 1 - this._cosAngleLightToZenith * this._cosAngleLightToZenith));
304
304
  this._directionToLightRelativeToCameraGeocentricNormal.copyFromFloats(e_24, this._cosAngleLightToZenith, 0), this._directionToLightRelativeToCameraGeocentricNormal.normalize();
305
305
  } };
306
306
  return g;
307
307
  }());
308
- var v = function (e, t) { var i = Math.min(1, e / t); return -Math.sqrt(1 - i * i); }, S = new t.Vector3(.005802, .013558, .0331), _ = new t.Vector3(.003996, .003996, .003996), y = new t.Vector3(444e-6, 444e-6, 444e-6), T = new t.Vector3(65e-5, .001881, 85e-6);
308
+ var v = function (e, t) { var i = Math.min(1, e / t); return -Math.sqrt(1 - i * i); }, _ = new t.Vector3(.005802, .013558, .0331), S = new t.Vector3(.003996, .003996, .003996), y = new t.Vector3(444e-6, 444e-6, 444e-6), T = new t.Vector3(65e-5, .001881, 85e-6);
309
309
  var A = /** @class */ (function () {
310
310
  function A(e) {
311
- var i, n, r, a, s, o, l, c, d, h, u;
312
- this.onChangedObservable = new t.Observable, this._peakRayleighScattering = new t.Vector3, this._peakMieScattering = new t.Vector3, this._peakMieAbsorption = new t.Vector3, this._peakOzoneAbsorption = new t.Vector3, this._planetRadiusWithOffset = 0, this._planetRadiusSquared = 0, this._atmosphereRadius = 0, this._atmosphereRadiusSquared = 0, this._horizonDistanceToAtmosphereEdge = 0, this._horizonDistanceToAtmosphereEdgeSquared = 0, this._rayleighScattering = new t.Vector3, this._mieScattering = new t.Vector3, this._mieAbsorption = new t.Vector3, this._mieExtinction = new t.Vector3, this._ozoneAbsorption = new t.Vector3, this._planetRadius = null !== (i = null == e ? void 0 : e.planetRadius) && void 0 !== i ? i : 6360, this._planetRadiusOffset = null !== (n = null == e ? void 0 : e.planetRadiusOffset) && void 0 !== n ? n : .01, this._atmosphereThickness = null !== (r = null == e ? void 0 : e.atmosphereThickness) && void 0 !== r ? r : 100, this._rayleighScatteringScale = null !== (a = null == e ? void 0 : e.rayleighScatteringScale) && void 0 !== a ? a : 1, this._peakRayleighScattering.copyFrom(null !== (s = null == e ? void 0 : e.peakRayleighScattering) && void 0 !== s ? s : S), this._mieScatteringScale = null !== (o = null == e ? void 0 : e.mieScatteringScale) && void 0 !== o ? o : 1, this._peakMieScattering.copyFrom(null !== (l = null == e ? void 0 : e.peakMieScattering) && void 0 !== l ? l : _), this._mieAbsorptionScale = null !== (c = null == e ? void 0 : e.mieAbsorptionScale) && void 0 !== c ? c : 1, this._peakMieAbsorption.copyFrom(null !== (d = null == e ? void 0 : e.peakMieAbsorption) && void 0 !== d ? d : y), this._ozoneAbsorptionScale = null !== (h = null == e ? void 0 : e.ozoneAbsorptionScale) && void 0 !== h ? h : 1, this._peakOzoneAbsorption.copyFrom(null !== (u = null == e ? void 0 : e.peakOzoneAbsorption) && void 0 !== u ? u : T), this._recomputeDimensionalParameters(), this._recomputeRayleighScattering(), this._recomputeMieScattering(), this._recomputeMieAbsorption(), this._recomputeOzoneAbsorption();
311
+ var i, r, n, a, s, o, l, c, u, h, d;
312
+ this.onChangedObservable = new t.Observable, this._peakRayleighScattering = new t.Vector3, this._peakMieScattering = new t.Vector3, this._peakMieAbsorption = new t.Vector3, this._peakOzoneAbsorption = new t.Vector3, this._planetRadiusWithOffset = 0, this._planetRadiusSquared = 0, this._atmosphereRadius = 0, this._atmosphereRadiusSquared = 0, this._horizonDistanceToAtmosphereEdge = 0, this._horizonDistanceToAtmosphereEdgeSquared = 0, this._rayleighScattering = new t.Vector3, this._mieScattering = new t.Vector3, this._mieAbsorption = new t.Vector3, this._mieExtinction = new t.Vector3, this._ozoneAbsorption = new t.Vector3, this._planetRadius = null !== (i = null == e ? void 0 : e.planetRadius) && void 0 !== i ? i : 6360, this._planetRadiusOffset = null !== (r = null == e ? void 0 : e.planetRadiusOffset) && void 0 !== r ? r : .01, this._atmosphereThickness = null !== (n = null == e ? void 0 : e.atmosphereThickness) && void 0 !== n ? n : 100, this._rayleighScatteringScale = null !== (a = null == e ? void 0 : e.rayleighScatteringScale) && void 0 !== a ? a : 1, this._peakRayleighScattering.copyFrom(null !== (s = null == e ? void 0 : e.peakRayleighScattering) && void 0 !== s ? s : _), this._mieScatteringScale = null !== (o = null == e ? void 0 : e.mieScatteringScale) && void 0 !== o ? o : 1, this._peakMieScattering.copyFrom(null !== (l = null == e ? void 0 : e.peakMieScattering) && void 0 !== l ? l : S), this._mieAbsorptionScale = null !== (c = null == e ? void 0 : e.mieAbsorptionScale) && void 0 !== c ? c : 1, this._peakMieAbsorption.copyFrom(null !== (u = null == e ? void 0 : e.peakMieAbsorption) && void 0 !== u ? u : y), this._ozoneAbsorptionScale = null !== (h = null == e ? void 0 : e.ozoneAbsorptionScale) && void 0 !== h ? h : 1, this._peakOzoneAbsorption.copyFrom(null !== (d = null == e ? void 0 : e.peakOzoneAbsorption) && void 0 !== d ? d : T), this._recomputeDimensionalParameters(), this._recomputeRayleighScattering(), this._recomputeMieScattering(), this._recomputeMieAbsorption(), this._recomputeOzoneAbsorption();
313
313
  }
314
314
  Object.defineProperty(A.prototype, "planetRadius", {
315
315
  get: function () { return this._planetRadius; },
@@ -440,79 +440,79 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
440
440
  A.prototype._recomputeOzoneAbsorption = function () { this._peakOzoneAbsorption.scaleToRef(this._ozoneAbsorptionScale, this._ozoneAbsorption); };
441
441
  return A;
442
442
  }());
443
- var P = function () { return ({ r: Number.NaN, g: Number.NaN, b: Number.NaN, a: Number.NaN }); }, L = P(), R = P(), E = P(), C = P(), x = function (e) { return e / 255; };
444
- function I(e, i, n, r, a, s, o) {
443
+ var L = function () { return ({ r: Number.NaN, g: Number.NaN, b: Number.NaN, a: Number.NaN }); }, P = L(), E = L(), R = L(), C = L(), x = function (e) { return e / 255; };
444
+ function M(e, i, r, n, a, s, o) {
445
445
  if (o === void 0) { o = x; }
446
- if (n <= 0 || r <= 0)
446
+ if (r <= 0 || n <= 0)
447
447
  throw new Error("Sample2DRgbaToRef: widthPx and heightPx must be positive.");
448
- var l = n * r * 4;
448
+ var l = r * n * 4;
449
449
  if (a.length < l)
450
450
  throw new Error("Sample2DRgbaToRef: data length (".concat(a.length, ") is less than required (").concat(l, ")."));
451
451
  e = t.Clamp(e), i = t.Clamp(i);
452
- var c = Math.max(e * n - .5, 0), d = Math.max(i * r - .5, 0), h = Math.floor(c), u = Math.min(h + 1, n - 1), m = Math.floor(d), p = Math.min(m + 1, r - 1), f = w(h, m, n, r, a, L, o), g = w(h, p, n, r, a, R, o), v = w(u, m, n, r, a, E, o), S = w(u, p, n, r, a, C, o), _ = c - h, y = d - m, T = 1 - _, A = 1 - y, P = T * A, I = _ * A, M = T * y, b = _ * y;
453
- return s.r = f.r * P + v.r * I + g.r * M + S.r * b, s.g = f.g * P + v.g * I + g.g * M + S.g * b, s.b = f.b * P + v.b * I + g.b * M + S.b * b, s.a = f.a * P + v.a * I + g.a * M + S.a * b, s;
452
+ var c = Math.max(e * r - .5, 0), u = Math.max(i * n - .5, 0), h = Math.floor(c), d = Math.min(h + 1, r - 1), m = Math.floor(u), p = Math.min(m + 1, n - 1), f = I(h, m, r, n, a, P, o), g = I(h, p, r, n, a, E, o), v = I(d, m, r, n, a, R, o), _ = I(d, p, r, n, a, C, o), S = c - h, y = u - m, T = 1 - S, A = 1 - y, L = T * A, M = S * A, w = T * y, b = S * y;
453
+ return s.r = f.r * L + v.r * M + g.r * w + _.r * b, s.g = f.g * L + v.g * M + g.g * w + _.g * b, s.b = f.b * L + v.b * M + g.b * w + _.b * b, s.a = f.a * L + v.a * M + g.a * w + _.a * b, s;
454
454
  }
455
- var w = function (e, i, n, r, a, s, o) {
455
+ var I = function (e, i, r, n, a, s, o) {
456
456
  if (o === void 0) { o = x; }
457
- var l = t.Clamp(e, 0, n - 1), c = 4 * (t.Clamp(i, 0, r - 1) * n + l);
457
+ var l = t.Clamp(e, 0, r - 1), c = 4 * (t.Clamp(i, 0, n - 1) * r + l);
458
458
  return o ? (s.r = o(a[c]), s.g = o(a[c + 1]), s.b = o(a[c + 2]), s.a = o(a[c + 3])) : (s.r = a[c], s.g = a[c + 1], s.b = a[c + 2], s.a = a[c + 3]), s;
459
- }, M = { x: Number.NaN, y: Number.NaN }, b = { r: Number.NaN, g: Number.NaN, b: Number.NaN, a: Number.NaN };
460
- var D = /** @class */ (function () {
461
- function D(e) {
459
+ }, w = { x: Number.NaN, y: Number.NaN }, b = { r: Number.NaN, g: Number.NaN, b: Number.NaN, a: Number.NaN };
460
+ var O = /** @class */ (function () {
461
+ function O(e) {
462
462
  var _this = this;
463
463
  this._renderTarget = null, this._effectWrapper = null, this._effectRenderer = null, this._isDirty = !0, this._isDisposed = !1, this._needsReadPixels = !1, this._lutData = new Float32Array(0), t.RegisterEnginesExtensionsEngineRenderTarget(), t.RegisterEnginesExtensionsEngineReadTexture(), this._atmosphere = e;
464
- var n = e.scene, r = n.getEngine(), a = "atmo-diffuseSkyIrradiance", s = r.getCaps().textureHalfFloatRender ? t.Constants.TEXTURETYPE_HALF_FLOAT : t.Constants.TEXTURETYPE_UNSIGNED_BYTE, o = this._renderTarget = new t.RenderTargetTexture(a, { width: 64, height: 16 }, n, { generateMipMaps: !1, type: s, samplingMode: t.Constants.TEXTURE_BILINEAR_SAMPLINGMODE, generateDepthBuffer: !1, gammaSpace: !1 });
464
+ var r = e.scene, n = r.getEngine(), a = "atmo-diffuseSkyIrradiance", s = n.getCaps().textureHalfFloatRender ? t.Constants.TEXTURETYPE_HALF_FLOAT : t.Constants.TEXTURETYPE_UNSIGNED_BYTE, o = this._renderTarget = new t.RenderTargetTexture(a, { width: 64, height: 16 }, r, { generateMipMaps: !1, type: s, samplingMode: t.Constants.TEXTURE_BILINEAR_SAMPLINGMODE, generateDepthBuffer: !1, gammaSpace: !1 });
465
465
  o.wrapU = t.Constants.TEXTURE_CLAMP_ADDRESSMODE, o.wrapV = t.Constants.TEXTURE_CLAMP_ADDRESSMODE, o.anisotropicFilteringLevel = 1, o.skipInitialClear = !0;
466
- var l = e.uniformBuffer, c = l.useUbo, d = r.isWebGPU && !t.EffectWrapper.ForceGLSL, h = d ? "atmosphere" : l.name;
467
- this._effectWrapper = new t.EffectWrapper({ engine: r, name: a, vertexShader: "fullscreenTriangle", fragmentShader: "diffuseSkyIrradiance", attributeNames: ["position"], uniformNames: __spreadArray(["depth"], __read(c ? [] : l.getUniformNames()), false), uniformBuffers: c ? [h] : [], defines: ["#define POSITION_VEC2", "#define NUM_SAMPLES 128u", "#define CUSTOM_IRRADIANCE_FILTERING_INPUT", "#define CUSTOM_IRRADIANCE_FILTERING_FUNCTION"], samplers: ["transmittanceLut", "multiScatteringLut"], useShaderStore: !0, shaderLanguage: d ? 1 : 0, extraInitializationsAsync: function () { return i(_this, void 0, void 0, function () { var e, i, n; return __generator(this, function (_a) {
466
+ var l = e.uniformBuffer, c = l.useUbo, u = n.isWebGPU && !t.EffectWrapper.ForceGLSL, h = u ? "atmosphere" : l.name;
467
+ this._effectWrapper = new t.EffectWrapper({ engine: n, name: a, vertexShader: "fullscreenTriangle", fragmentShader: "diffuseSkyIrradiance", attributeNames: ["position"], uniformNames: __spreadArray(["depth"], __read(c ? [] : l.getUniformNames()), false), uniformBuffers: c ? [h] : [], defines: ["#define POSITION_VEC2", "#define NUM_SAMPLES 128u", "#define CUSTOM_IRRADIANCE_FILTERING_INPUT", "#define CUSTOM_IRRADIANCE_FILTERING_FUNCTION"], samplers: ["transmittanceLut", "multiScatteringLut"], useShaderStore: !0, shaderLanguage: u ? 1 : 0, extraInitializationsAsync: function () { return i(_this, void 0, void 0, function () { var e, i, r; return __generator(this, function (_a) {
468
468
  switch (_a.label) {
469
- case 0: return [4 /*yield*/, Promise.all(d ? [Promise.resolve().then(function () { return Ft; }), Promise.resolve().then(function () { return zt; })] : [Promise.resolve().then(function () { return qt; }), Promise.resolve().then(function () { return jt; })])];
469
+ case 0: return [4 /*yield*/, Promise.all(u ? [Promise.resolve().then(function () { return Wt; }), Promise.resolve().then(function () { return $t; })] : [Promise.resolve().then(function () { return Qt; }), Promise.resolve().then(function () { return ti; })])];
470
470
  case 1:
471
471
  _a.sent();
472
- e = (d ? t.ShaderStore.IncludesShadersStoreWGSL : t.ShaderStore.IncludesShadersStore).hdrFilteringFunctions;
473
- e = e.replace(/^CUSTOM_IRRADIANCE_FILTERING_INPUT\s*$/gm, ""), e = e.replace(/^CUSTOM_IRRADIANCE_FILTERING_FUNCTION\s*$/gm, d ? "var c = integrateForIrradiance(n, Ls, vec3f(0., filteringInfo.x, 0.));" : "vec3 c = integrateForIrradiance(n, Ls, vec3(0., filteringInfo.x, 0.));");
474
- i = d ? t.ShaderStore.ShadersStoreWGSL : t.ShaderStore.ShadersStore;
475
- n = i.diffuseSkyIrradiancePixelShader;
476
- n = n.replace("#include<hdrFilteringFunctions>", e), i.diffuseSkyIrradiancePixelShader = n;
472
+ e = (u ? t.ShaderStore.IncludesShadersStoreWGSL : t.ShaderStore.IncludesShadersStore).hdrFilteringFunctions;
473
+ e = e.replace(/^CUSTOM_IRRADIANCE_FILTERING_INPUT\s*$/gm, ""), e = e.replace(/^CUSTOM_IRRADIANCE_FILTERING_FUNCTION\s*$/gm, u ? "var c = integrateForIrradiance(n, Ls, vec3f(0., filteringInfo.x, 0.));" : "vec3 c = integrateForIrradiance(n, Ls, vec3(0., filteringInfo.x, 0.));");
474
+ i = u ? t.ShaderStore.ShadersStoreWGSL : t.ShaderStore.ShadersStore;
475
+ r = i.diffuseSkyIrradiancePixelShader;
476
+ r = r.replace("#include<hdrFilteringFunctions>", e), i.diffuseSkyIrradiancePixelShader = r;
477
477
  return [2 /*return*/];
478
478
  }
479
- }); }); } }), this._effectRenderer = new t.EffectRenderer(r, { indices: [0, 2, 1], positions: [-1, -1, -1, 3, 3, -1] }), n.environmentTexture = o, n.environmentTexture.irradianceTexture = o, n.environmentIntensity = 1, n.environmentTexture.isRenderTarget = !1;
479
+ }); }); } }), this._effectRenderer = new t.EffectRenderer(n, { indices: [0, 2, 1], positions: [-1, -1, -1, 3, 3, -1] }), r.environmentTexture = o, r.environmentTexture.irradianceTexture = o, r.environmentIntensity = 1, r.environmentTexture.isRenderTarget = !1;
480
480
  }
481
- Object.defineProperty(D.prototype, "isDirty", {
481
+ Object.defineProperty(O.prototype, "isDirty", {
482
482
  get: function () { return this._isDirty; },
483
483
  enumerable: false,
484
484
  configurable: true
485
485
  });
486
- Object.defineProperty(D.prototype, "isDisposed", {
486
+ Object.defineProperty(O.prototype, "isDisposed", {
487
487
  get: function () { return this._isDisposed; },
488
488
  enumerable: false,
489
489
  configurable: true
490
490
  });
491
- Object.defineProperty(D.prototype, "renderTarget", {
491
+ Object.defineProperty(O.prototype, "renderTarget", {
492
492
  get: function () { if (this._isDisposed || null === this._renderTarget)
493
493
  throw new Error; return this._renderTarget; },
494
494
  enumerable: false,
495
495
  configurable: true
496
496
  });
497
- Object.defineProperty(D.prototype, "hasLutData", {
497
+ Object.defineProperty(O.prototype, "hasLutData", {
498
498
  get: function () { return void 0 !== this._lutData[0]; },
499
499
  enumerable: false,
500
500
  configurable: true
501
501
  });
502
- D.prototype.getDiffuseSkyIrradianceToRef = function (e, i, n, r, a) { var s = this._atmosphere, o = s.additionalDiffuseSkyIrradiance, l = s.physicalProperties; if (void 0 === this._lutData[0] || i > l.atmosphereRadius)
503
- return a.r = o.r, a.g = o.g, a.b = o.b, a; (function (e, i, n, r) { var a = t.Clamp(.5 + .5 * n), s = t.Clamp((i - e.planetRadius) / e.atmosphereThickness); r.x = .984375 * a + .0078125, r.y = .9375 * s + .03125; })(l, i, t.Vector3Dot(e, n), M), I(M.x, M.y, 64, 16, this._lutData, b, null); var c = s.diffuseSkyIrradianceIntensity; return a.r = c * (r * b.r + o.r), a.g = c * (r * b.g + o.g), a.b = c * (r * b.b + o.b), a; };
504
- D.prototype.render = function () {
502
+ O.prototype.getDiffuseSkyIrradianceToRef = function (e, i, r, n, a) { var s = this._atmosphere, o = s.additionalDiffuseSkyIrradiance, l = s.physicalProperties; if (void 0 === this._lutData[0] || i > l.atmosphereRadius)
503
+ return a.r = o.r, a.g = o.g, a.b = o.b, a; (function (e, i, r, n) { var a = t.Clamp(.5 + .5 * r), s = t.Clamp((i - e.planetRadius) / e.atmosphereThickness); n.x = .984375 * a + .0078125, n.y = .9375 * s + .03125; })(l, i, t.Vector3Dot(e, r), w), M(w.x, w.y, 64, 16, this._lutData, b, null); var c = s.diffuseSkyIrradianceIntensity; return a.r = c * (n * b.r + o.r), a.g = c * (n * b.g + o.g), a.b = c * (n * b.b + o.b), a; };
504
+ O.prototype.render = function () {
505
505
  var _this = this;
506
506
  var e;
507
507
  var t = this._effectWrapper;
508
508
  if (!this._isDirty || !(null == t ? void 0 : t.isReady()) || !(null === (e = this._renderTarget) || void 0 === e ? void 0 : e.isReady()))
509
509
  return !1;
510
- var n = this._effectRenderer;
511
- n.saveStates();
512
- var r = this._atmosphere.scene.getEngine();
513
- r.bindFramebuffer(this.renderTarget.renderTarget, void 0, void 0, void 0, !0), n.setViewport(), n.applyEffectWrapper(t);
510
+ var r = this._effectRenderer;
511
+ r.saveStates();
512
+ var n = this._atmosphere.scene.getEngine();
513
+ n.bindFramebuffer(this.renderTarget.renderTarget, void 0, void 0, void 0, !0), r.setViewport(), r.applyEffectWrapper(t);
514
514
  var a = t.effect;
515
- return n.bindBuffers(a), a.setTexture("transmittanceLut", this._atmosphere.transmittanceLut.renderTarget), a.setTexture("multiScatteringLut", this._atmosphere.multiScatteringLutRenderTarget), this._atmosphere.bindUniformBufferToEffect(a), a.setFloat("depth", 0), n.draw(), n.restoreStates(), r.restoreDefaultFramebuffer(), this._isDirty = !1, this._needsReadPixels = !0, this._atmosphere.scene.onAfterRenderObservable.addOnce(function () { return i(_this, void 0, void 0, function () { return __generator(this, function (_a) {
515
+ return r.bindBuffers(a), a.setTexture("transmittanceLut", this._atmosphere.transmittanceLut.renderTarget), a.setTexture("multiScatteringLut", this._atmosphere.multiScatteringLutRenderTarget), this._atmosphere.bindUniformBufferToEffect(a), a.setFloat("depth", 0), r.draw(), r.restoreStates(), n.restoreDefaultFramebuffer(), this._isDirty = !1, this._needsReadPixels = !0, this._atmosphere.scene.onAfterRenderObservable.addOnce(function () { return i(_this, void 0, void 0, function () { return __generator(this, function (_a) {
516
516
  switch (_a.label) {
517
517
  case 0: return [4 /*yield*/, this.readPixelsAsync()];
518
518
  case 1:
@@ -521,7 +521,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
521
521
  }
522
522
  }); }); }), !0;
523
523
  };
524
- D.prototype.readPixelsAsync = function () { return i(this, void 0, void 0, function () { var e, i_2, n_2, e_25, e_26; return __generator(this, function (_a) {
524
+ O.prototype.readPixelsAsync = function () { return i(this, void 0, void 0, function () { var e, i_2, r_2, e_25, e_26; return __generator(this, function (_a) {
525
525
  switch (_a.label) {
526
526
  case 0:
527
527
  if (!this._needsReadPixels || this._isDisposed)
@@ -531,66 +531,66 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
531
531
  case 1:
532
532
  e = _a.sent();
533
533
  if (e && !this._isDisposed) {
534
- i_2 = e, n_2 = this._lutData = new Float32Array(i_2.length);
534
+ i_2 = e, r_2 = this._lutData = new Float32Array(i_2.length);
535
535
  if (i_2 instanceof Uint16Array)
536
536
  for (e_25 = 0; e_25 < i_2.length; e_25++)
537
- n_2[e_25] = t.FromHalfFloat(i_2[e_25]);
537
+ r_2[e_25] = t.FromHalfFloat(i_2[e_25]);
538
538
  else
539
539
  for (e_26 = 0; e_26 < i_2.length; e_26++)
540
- n_2[e_26] = i_2[e_26] / 255;
540
+ r_2[e_26] = i_2[e_26] / 255;
541
541
  }
542
542
  return [2 /*return*/];
543
543
  }
544
544
  }); }); };
545
- D.prototype.markDirty = function () { this._isDirty = !0; };
546
- D.prototype.dispose = function () { var e, t; this._renderTarget && (this._renderTarget.irradianceTexture = null, this._renderTarget.dispose()), this._renderTarget = null, null === (e = this._effectWrapper) || void 0 === e || e.dispose(), this._effectWrapper = null, null === (t = this._effectRenderer) || void 0 === t || t.dispose(), this._effectRenderer = null, this._isDisposed = !0; };
547
- return D;
545
+ O.prototype.markDirty = function () { this._isDirty = !0; };
546
+ O.prototype.dispose = function () { var e, t; this._renderTarget && (this._renderTarget.irradianceTexture = null, this._renderTarget.dispose()), this._renderTarget = null, null === (e = this._effectWrapper) || void 0 === e || e.dispose(), this._effectWrapper = null, null === (t = this._effectRenderer) || void 0 === t || t.dispose(), this._effectRenderer = null, this._isDisposed = !0; };
547
+ return O;
548
548
  }());
549
- var O = .001953125, N = .00390625, V = { x: Number.NaN, y: Number.NaN }, F = { r: Number.NaN, g: Number.NaN, b: Number.NaN }, U = { x: Number.NaN, y: Number.NaN, z: Number.NaN }, k = { r: Number.NaN, g: Number.NaN, b: Number.NaN, a: Number.NaN };
550
- var G = /** @class */ (function () {
551
- function G(e) {
549
+ var D = .001953125, N = .00390625, U = { x: Number.NaN, y: Number.NaN }, F = { r: Number.NaN, g: Number.NaN, b: Number.NaN }, V = { x: Number.NaN, y: Number.NaN, z: Number.NaN }, G = { r: Number.NaN, g: Number.NaN, b: Number.NaN, a: Number.NaN };
550
+ var k = /** @class */ (function () {
551
+ function k(e) {
552
552
  this.onUpdatedObservable = new t.Observable, this._lutData = new Float32Array(0), this._isDirty = !0, this._isDisposed = !1, this._needsReadPixels = !1, t.RegisterEnginesExtensionsEngineRenderTarget(), t.RegisterEnginesExtensionsEngineReadTexture(), this._atmosphere = e;
553
- var i = this._atmosphere.scene, n = i.getEngine(), r = "atmo-transmittance", a = this._renderTarget = new t.RenderTargetTexture(r, { width: 256, height: 64 }, i, { type: t.Constants.TEXTURETYPE_UNSIGNED_BYTE, samplingMode: t.Constants.TEXTURE_BILINEAR_SAMPLINGMODE, generateDepthBuffer: !1, gammaSpace: !1 });
553
+ var i = this._atmosphere.scene, r = i.getEngine(), n = "atmo-transmittance", a = this._renderTarget = new t.RenderTargetTexture(n, { width: 256, height: 64 }, i, { type: t.Constants.TEXTURETYPE_UNSIGNED_BYTE, samplingMode: t.Constants.TEXTURE_BILINEAR_SAMPLINGMODE, generateDepthBuffer: !1, gammaSpace: !1 });
554
554
  a.wrapU = t.Constants.TEXTURE_CLAMP_ADDRESSMODE, a.wrapV = t.Constants.TEXTURE_CLAMP_ADDRESSMODE, a.anisotropicFilteringLevel = 1, a.skipInitialClear = !0;
555
- var s = e.uniformBuffer, o = s.useUbo, l = n.isWebGPU && !t.EffectWrapper.ForceGLSL, c = l ? "atmosphere" : s.name;
556
- this._effectWrapper = new t.EffectWrapper({ engine: n, name: r, vertexShader: "fullscreenTriangle", fragmentShader: "transmittance", attributeNames: ["position"], uniformNames: __spreadArray(["depth"], __read(o ? [] : s.getUniformNames()), false), uniformBuffers: o ? [c] : [], defines: ["#define POSITION_VEC2"], useShaderStore: !0, shaderLanguage: l ? 1 : 0, extraInitializations: function (e, t) { t.push.apply(t, __spreadArray([], __read(l ? [Promise.resolve().then(function () { return Ft; }), Promise.resolve().then(function () { return Jt; })] : [Promise.resolve().then(function () { return qt; }), Promise.resolve().then(function () { return ni; })]), false)); } }), this._effectRenderer = new t.EffectRenderer(n, { indices: [0, 2, 1], positions: [-1, -1, -1, 3, 3, -1] });
555
+ var s = e.uniformBuffer, o = s.useUbo, l = r.isWebGPU && !t.EffectWrapper.ForceGLSL, c = l ? "atmosphere" : s.name;
556
+ this._effectWrapper = new t.EffectWrapper({ engine: r, name: n, vertexShader: "fullscreenTriangle", fragmentShader: "transmittance", attributeNames: ["position"], uniformNames: __spreadArray(["depth"], __read(o ? [] : s.getUniformNames()), false), uniformBuffers: o ? [c] : [], defines: ["#define POSITION_VEC2"], useShaderStore: !0, shaderLanguage: l ? 1 : 0, extraInitializations: function (e, t) { t.push.apply(t, __spreadArray([], __read(l ? [Promise.resolve().then(function () { return Wt; }), Promise.resolve().then(function () { return ai; })] : [Promise.resolve().then(function () { return Qt; }), Promise.resolve().then(function () { return ci; })]), false)); } }), this._effectRenderer = new t.EffectRenderer(r, { indices: [0, 2, 1], positions: [-1, -1, -1, 3, 3, -1] });
557
557
  }
558
- Object.defineProperty(G.prototype, "isDirty", {
558
+ Object.defineProperty(k.prototype, "isDirty", {
559
559
  get: function () { return this._isDirty; },
560
560
  enumerable: false,
561
561
  configurable: true
562
562
  });
563
- Object.defineProperty(G.prototype, "renderTarget", {
563
+ Object.defineProperty(k.prototype, "renderTarget", {
564
564
  get: function () { if (this._isDisposed || null === this._renderTarget)
565
565
  throw new Error; return this._renderTarget; },
566
566
  enumerable: false,
567
567
  configurable: true
568
568
  });
569
- Object.defineProperty(G.prototype, "hasLutData", {
569
+ Object.defineProperty(k.prototype, "hasLutData", {
570
570
  get: function () { return void 0 !== this._lutData[0]; },
571
571
  enumerable: false,
572
572
  configurable: true
573
573
  });
574
- G.prototype.getTransmittedColorToRef = function (e, i, n, r) { if (void 0 !== this._lutData[0]) {
575
- var a_1 = t.Vector3Dot(e, n);
576
- (function (e, i, n, r, a) { if (n > e.atmosphereRadius)
577
- return void (a.r = a.g = a.b = a.a = 1); (function (e, t, i, n) { var r = t * t, a = Math.sqrt(Math.max(0, r - e.planetRadiusSquared)), s = r * (i * i - 1) + e.atmosphereRadiusSquared, o = Math.max(0, -t * i + Math.sqrt(Math.max(0, s))), l = Math.max(0, e.atmosphereRadius - t), c = a + e.horizonDistanceToAtmosphereEdge, d = (o - l) / Math.max(1e-6, c - l), h = a / Math.max(1e-6, e.horizonDistanceToAtmosphereEdge); n.x = .99609375 * d + O, n.y = .984375 * h + .0078125; })(e, n, r, V), I(V.x, V.y, 256, 64, i, a, null); var s = t.Clamp(t.SmoothStep(1, 0, t.Clamp((V.x - .998046875) / N))); a.r *= s, a.g *= s, a.b *= s, a.a *= s; })(this._atmosphere.physicalProperties, this._lutData, i, a_1, k), r.r = k.r, r.g = k.g, r.b = k.b;
574
+ k.prototype.getTransmittedColorToRef = function (e, i, r, n) { if (void 0 !== this._lutData[0]) {
575
+ var a_1 = t.Vector3Dot(e, r);
576
+ (function (e, i, r, n, a) { if (r > e.atmosphereRadius)
577
+ return void (a.r = a.g = a.b = a.a = 1); (function (e, t, i, r) { var n = t * t, a = Math.sqrt(Math.max(0, n - e.planetRadiusSquared)), s = n * (i * i - 1) + e.atmosphereRadiusSquared, o = Math.max(0, -t * i + Math.sqrt(Math.max(0, s))), l = Math.max(0, e.atmosphereRadius - t), c = a + e.horizonDistanceToAtmosphereEdge, u = (o - l) / Math.max(1e-6, c - l), h = a / Math.max(1e-6, e.horizonDistanceToAtmosphereEdge); r.x = .99609375 * u + D, r.y = .984375 * h + .0078125; })(e, r, n, U), M(U.x, U.y, 256, 64, i, a, null); var s = t.Clamp(t.SmoothStep(1, 0, t.Clamp((U.x - .998046875) / N))); a.r *= s, a.g *= s, a.b *= s, a.a *= s; })(this._atmosphere.physicalProperties, this._lutData, i, a_1, G), n.r = G.r, n.g = G.g, n.b = G.b;
578
578
  }
579
579
  else
580
- r.r = r.g = r.b = 1; return r; };
581
- G.prototype.updateLightParameters = function (e, t, i) { var n = e.direction; U.x = -n.x, U.y = -n.y, U.z = -n.z, this.getTransmittedColorToRef(U, t, i, F), e.diffuse.copyFromFloats(F.r, F.g, F.b), e.specular.copyFromFloats(F.r, F.g, F.b); };
582
- G.prototype.render = function () {
580
+ n.r = n.g = n.b = 1; return n; };
581
+ k.prototype.updateLightParameters = function (e, t, i) { var r = e.direction; V.x = -r.x, V.y = -r.y, V.z = -r.z, this.getTransmittedColorToRef(V, t, i, F), e.diffuse.copyFromFloats(F.r, F.g, F.b), e.specular.copyFromFloats(F.r, F.g, F.b); };
582
+ k.prototype.render = function () {
583
583
  var _this = this;
584
584
  var e;
585
585
  var t = this._effectWrapper;
586
586
  if (!this._isDirty || !(null == t ? void 0 : t.isReady()) || !(null === (e = this._renderTarget) || void 0 === e ? void 0 : e.isReady()))
587
587
  return !1;
588
- var n = this._effectRenderer;
589
- n.saveStates();
590
- var r = this._atmosphere.scene.getEngine();
591
- r.bindFramebuffer(this.renderTarget.renderTarget, void 0, void 0, void 0, !0), n.setViewport(), n.applyEffectWrapper(t);
588
+ var r = this._effectRenderer;
589
+ r.saveStates();
590
+ var n = this._atmosphere.scene.getEngine();
591
+ n.bindFramebuffer(this.renderTarget.renderTarget, void 0, void 0, void 0, !0), r.setViewport(), r.applyEffectWrapper(t);
592
592
  var a = t.effect;
593
- return n.bindBuffers(a), this._atmosphere.bindUniformBufferToEffect(a), a.setFloat("depth", 0), n.draw(), n.restoreStates(), r.restoreDefaultFramebuffer(), this._isDirty = !1, this._needsReadPixels = !0, this._atmosphere.scene.onAfterRenderObservable.addOnce(function () { return i(_this, void 0, void 0, function () { return __generator(this, function (_a) {
593
+ return r.bindBuffers(a), this._atmosphere.bindUniformBufferToEffect(a), a.setFloat("depth", 0), r.draw(), r.restoreStates(), n.restoreDefaultFramebuffer(), this._isDirty = !1, this._needsReadPixels = !0, this._atmosphere.scene.onAfterRenderObservable.addOnce(function () { return i(_this, void 0, void 0, function () { return __generator(this, function (_a) {
594
594
  switch (_a.label) {
595
595
  case 0: return [4 /*yield*/, this.readPixelsAsync()];
596
596
  case 1:
@@ -599,7 +599,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
599
599
  }
600
600
  }); }); }), !0;
601
601
  };
602
- G.prototype.readPixelsAsync = function () { return i(this, void 0, void 0, function () { var e, i_3, n_3, e_27, e_28; return __generator(this, function (_a) {
602
+ k.prototype.readPixelsAsync = function () { return i(this, void 0, void 0, function () { var e, i_3, r_3, e_27, e_28; return __generator(this, function (_a) {
603
603
  switch (_a.label) {
604
604
  case 0:
605
605
  if (!this._needsReadPixels || this._isDisposed)
@@ -609,57 +609,57 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
609
609
  case 1:
610
610
  e = _a.sent();
611
611
  if (e && !this._isDisposed) {
612
- i_3 = e, n_3 = this._lutData = new Float32Array(i_3.length);
612
+ i_3 = e, r_3 = this._lutData = new Float32Array(i_3.length);
613
613
  if (i_3 instanceof Uint16Array)
614
614
  for (e_27 = 0; e_27 < i_3.length; e_27++)
615
- n_3[e_27] = t.FromHalfFloat(i_3[e_27]);
615
+ r_3[e_27] = t.FromHalfFloat(i_3[e_27]);
616
616
  else
617
617
  for (e_28 = 0; e_28 < i_3.length; e_28++)
618
- n_3[e_28] = i_3[e_28] / 255;
618
+ r_3[e_28] = i_3[e_28] / 255;
619
619
  this.onUpdatedObservable.notifyObservers();
620
620
  }
621
621
  return [2 /*return*/];
622
622
  }
623
623
  }); }); };
624
- G.prototype.markDirty = function () { this._isDirty = !0; };
625
- G.prototype.dispose = function () { var e, t, i; null === (e = this._renderTarget) || void 0 === e || e.dispose(), this._renderTarget = null, null === (t = this._effectWrapper) || void 0 === t || t.dispose(), this._effectWrapper = null, null === (i = this._effectRenderer) || void 0 === i || i.dispose(), this._effectRenderer = null, this._isDisposed = !0; };
626
- return G;
624
+ k.prototype.markDirty = function () { this._isDirty = !0; };
625
+ k.prototype.dispose = function () { var e, t, i; null === (e = this._renderTarget) || void 0 === e || e.dispose(), this._renderTarget = null, null === (t = this._effectWrapper) || void 0 === t || t.dispose(), this._effectWrapper = null, null === (i = this._effectRenderer) || void 0 === i || i.dispose(), this._effectRenderer = null, this._isDisposed = !0; };
626
+ return k;
627
627
  }());
628
628
  var z = "atmo-pbr";
629
629
  var B = 0;
630
- var H = function (e, i, n, r, a, s, o, l, c) {
630
+ var W = function (e, i, r, n, a, s, o, l, c) {
631
631
  if (l === void 0) { l = !1; }
632
- var d;
633
- var h = null !== (d = null == o ? void 0 : o.map(function (e) { return "#define ".concat(e); })) && void 0 !== d ? d : [];
634
- return new t.EffectWrapper({ engine: e, name: i, vertexShader: "fullscreenTriangle", fragmentShader: n, attributeNames: ["position"], uniformNames: r, uniformBuffers: s, samplerNames: a, defines: h, useShaderStore: !0, shaderLanguage: l ? 1 : 0, extraInitializations: c });
635
- }, W = function (e, i, n) { var r = i.useUbo, a = e.isWebGPU && !t.EffectWrapper.ForceGLSL, s = a ? "atmosphere" : i.name, o = ["#define POSITION_VEC2"]; return n.equals(t.Color3.BlackReadOnly) || o.push("#define USE_GROUND_ALBEDO"), new t.EffectWrapper({ engine: e, name: "atmo-multiScattering", vertexShader: "fullscreenTriangle", fragmentShader: "multiScattering", attributeNames: ["position"], uniformNames: __spreadArray(["depth"], __read(r ? [] : i.getUniformNames()), false), uniformBuffers: r ? [s] : [], samplerNames: ["transmittanceLut"], defines: o, useShaderStore: !0, shaderLanguage: a ? 1 : 0, extraInitializations: function (e, t) { t.push.apply(t, __spreadArray([], __read(a ? [Promise.resolve().then(function () { return Ft; }), Promise.resolve().then(function () { return oi; })] : [Promise.resolve().then(function () { return qt; }), Promise.resolve().then(function () { return hi; })]), false)); } }); }, q = function (e, i, n, r) { var a = n.getEngine().getCaps(), s = a.textureHalfFloatRender ? t.Constants.TEXTURETYPE_HALF_FLOAT : a.textureFloatRender ? t.Constants.TEXTURETYPE_FLOAT : t.Constants.TEXTURETYPE_UNSIGNED_BYTE, o = Object.assign({ generateMipMaps: !1, generateDepthBuffer: !1, generateStencilBuffer: !1, gammaSpace: !1, samplingMode: t.Constants.TEXTURE_BILINEAR_SAMPLINGMODE, type: s, format: t.Constants.TEXTUREFORMAT_RGBA }, r), l = new t.RenderTargetTexture(e, i, n, o); return l.wrapU = t.Constants.TEXTURE_CLAMP_ADDRESSMODE, l.wrapV = t.Constants.TEXTURE_CLAMP_ADDRESSMODE, l.anisotropicFilteringLevel = 1, l.skipInitialClear = !0, l; }, Z = function (e, i, n, r, a, s, o, l, c, d, h) {
632
+ var u;
633
+ var h = null !== (u = null == o ? void 0 : o.map(function (e) { return "#define ".concat(e); })) && void 0 !== u ? u : [];
634
+ return new t.EffectWrapper({ engine: e, name: i, vertexShader: "fullscreenTriangle", fragmentShader: r, attributeNames: ["position"], uniformNames: n, uniformBuffers: s, samplerNames: a, defines: h, useShaderStore: !0, shaderLanguage: l ? 1 : 0, extraInitializations: c });
635
+ }, H = function (e, i, r) { var n = i.useUbo, a = e.isWebGPU && !t.EffectWrapper.ForceGLSL, s = a ? "atmosphere" : i.name, o = ["#define POSITION_VEC2"]; return r.equals(t.Color3.BlackReadOnly) || o.push("#define USE_GROUND_ALBEDO"), new t.EffectWrapper({ engine: e, name: "atmo-multiScattering", vertexShader: "fullscreenTriangle", fragmentShader: "multiScattering", attributeNames: ["position"], uniformNames: __spreadArray(["depth"], __read(n ? [] : i.getUniformNames()), false), uniformBuffers: n ? [s] : [], samplerNames: ["transmittanceLut"], defines: o, useShaderStore: !0, shaderLanguage: a ? 1 : 0, extraInitializations: function (e, t) { t.push.apply(t, __spreadArray([], __read(a ? [Promise.resolve().then(function () { return Wt; }), Promise.resolve().then(function () { return mi; })] : [Promise.resolve().then(function () { return Qt; }), Promise.resolve().then(function () { return vi; })]), false)); } }); }, q = function (e, i, r, n) { var a = r.getEngine().getCaps(), s = a.textureHalfFloatRender ? t.Constants.TEXTURETYPE_HALF_FLOAT : a.textureFloatRender ? t.Constants.TEXTURETYPE_FLOAT : t.Constants.TEXTURETYPE_UNSIGNED_BYTE, o = Object.assign({ generateMipMaps: !1, generateDepthBuffer: !1, generateStencilBuffer: !1, gammaSpace: !1, samplingMode: t.Constants.TEXTURE_BILINEAR_SAMPLINGMODE, type: s, format: t.Constants.TEXTUREFORMAT_RGBA }, n), l = new t.RenderTargetTexture(e, i, r, o); return l.wrapU = t.Constants.TEXTURE_CLAMP_ADDRESSMODE, l.wrapV = t.Constants.TEXTURE_CLAMP_ADDRESSMODE, l.anisotropicFilteringLevel = 1, l.skipInitialClear = !0, l; }, Z = function (e, i, r, n, a, s, o, l, c, u, h) {
636
636
  if (s === void 0) { s = 0; }
637
637
  if (o === void 0) { o = t.Constants.ALPHA_DISABLE; }
638
638
  if (l === void 0) { l = !0; }
639
- if (d === void 0) { d = t.Constants.LEQUAL; }
639
+ if (u === void 0) { u = t.Constants.LEQUAL; }
640
640
  if (h === void 0) { h = !0; }
641
- if (null !== r && !r.isReady() || !(null == n ? void 0 : n.isReady()))
641
+ if (null !== n && !n.isReady() || !(null == r ? void 0 : r.isReady()))
642
642
  return;
643
643
  i.saveStates();
644
- var u = e.getDepthWrite();
644
+ var d = e.getDepthWrite();
645
645
  void 0 !== c && e.setDepthWrite(c);
646
646
  var m = e.getDepthFunction();
647
- e.setDepthFunction(d);
647
+ e.setDepthFunction(u);
648
648
  var p = e.getAlphaMode();
649
649
  e.setAlphaMode(o, !0);
650
650
  var f = e.depthCullingState.cull;
651
- i.setViewport(), i.applyEffectWrapper(n, l), e.depthCullingState.cull = !1;
652
- var g = n.effect;
653
- g.setFloat("depth", s), a(i, null == r ? void 0 : r.renderTarget, g, e), e.depthCullingState.cull = f, e.setAlphaMode(p, !0), void 0 !== u && e.setDepthWrite(u), m && e.setDepthFunction(m), i.restoreStates(), h && e.restoreDefaultFramebuffer();
654
- }, Y = function (e, i, n, r, a) { var s = i.useUbo, o = e.isWebGPU && !t.EffectWrapper.ForceGLSL, l = o ? "atmosphere" : i.name, c = ["POSITION_VEC2", "COMPUTE_WORLD_RAY"]; n && c.push("USE_SKY_VIEW_LUT"), r || c.push("OUTPUT_TO_SRGB"), a && c.push("APPLY_TRANSMITTANCE_BLENDING"); var d = n ? ["skyViewLut"] : ["transmittanceLut", "multiScatteringLut"]; return H(e, "atmo-skyCompositor", "compositeSky", __spreadArray(["depth"], __read(s ? [] : i.getUniformNames()), false), d, s ? [l] : [], c, o, function (e, t) { t.push.apply(t, __spreadArray([], __read(o ? [Promise.resolve().then(function () { return Ft; }), Promise.resolve().then(function () { return fi; })] : [Promise.resolve().then(function () { return qt; }), Promise.resolve().then(function () { return _i; })]), false)); }); }, $ = function (e, i, n, r, a, s, o, l) { var c = i.useUbo, d = e.isWebGPU && !t.EffectWrapper.ForceGLSL, h = d ? "atmosphere" : i.name, u = ["POSITION_VEC2", "COMPUTE_WORLD_RAY"]; n && u.push("USE_AERIAL_PERSPECTIVE_LUT"), r && u.push("USE_SKY_VIEW_LUT"), 1 !== o && u.push("APPLY_AERIAL_PERSPECTIVE_INTENSITY"), a || u.push("OUTPUT_TO_SRGB"), s && u.push("APPLY_TRANSMITTANCE_BLENDING"), 0 !== l && u.push("APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS"); var m = ["transmittanceLut", "multiScatteringLut", "depthTexture"]; return r && m.push("skyViewLut"), n && m.push("aerialPerspectiveLut"), H(e, "atmo-aerialPerspectiveCompositor", "compositeAerialPerspective", __spreadArray(["depth"], __read(c ? [] : i.getUniformNames()), false), m, c ? [h] : [], u, d, function (e, t) { t.push.apply(t, __spreadArray([], __read(d ? [Promise.resolve().then(function () { return Ft; }), Promise.resolve().then(function () { return Oi; })] : [Promise.resolve().then(function () { return qt; }), Promise.resolve().then(function () { return zi; })]), false)); }); }, j = function (e, i, n, r, a, s, o, l) { var c = i.useUbo, d = e.isWebGPU && !t.EffectWrapper.ForceGLSL, h = d ? "atmosphere" : i.name, u = ["POSITION_VEC2", "COMPUTE_WORLD_RAY"]; n && u.push("USE_SKY_VIEW_LUT"), 1 !== s && u.push("APPLY_AERIAL_PERSPECTIVE_INTENSITY"), r || u.push("OUTPUT_TO_SRGB"), l && u.push("HAS_DEPTH_TEXTURE"), a && u.push("APPLY_TRANSMITTANCE_BLENDING"), 0 !== o && u.push("APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS"); var m = ["transmittanceLut", "multiScatteringLut"]; return n && m.push("skyViewLut"), l && m.push("depthTexture"), H(e, "atmo-globeAtmosphereCompositor", "compositeGlobeAtmosphere", __spreadArray(["depth"], __read(c ? [] : i.getUniformNames()), false), m, c ? [h] : [], u, d, function (e, t) { t.push.apply(t, __spreadArray([], __read(d ? [Promise.resolve().then(function () { return Ft; }), Promise.resolve().then(function () { return qi; })] : [Promise.resolve().then(function () { return qt; }), Promise.resolve().then(function () { return ji; })]), false)); }); }, Q = 100, K = function (e) { return function (t, i) { var n = t.getMesh(), r = i.getMesh(), a = n.isHtmlMesh, s = r.isHtmlMesh; return a ? s && n.absolutePosition.z <= r.absolutePosition.z ? 1 : -1 : s ? 1 : e(t, i); }; };
655
- var X = /** @class */ (function () {
656
- function X(e, _a) {
657
- var _b = _a === void 0 ? {} : _a, _c = _b.parentContainerId, i = _c === void 0 ? null : _c, _d = _b._containerId, n = _d === void 0 ? "css-container" : _d, _f = _b.enableOverlayRender, r = _f === void 0 ? !0 : _f, _g = _b.defaultOpaqueRenderOrder, a = _g === void 0 ? t.RenderingGroup.PainterSortCompare : _g, _h = _b.defaultAlphaTestRenderOrder, s = _h === void 0 ? t.RenderingGroup.PainterSortCompare : _h, _j = _b.defaultTransparentRenderOrder, o = _j === void 0 ? t.RenderingGroup.defaultTransparentSortCompare : _j;
651
+ i.setViewport(), i.applyEffectWrapper(r, l), e.depthCullingState.cull = !1;
652
+ var g = r.effect;
653
+ g.setFloat("depth", s), a(i, null == n ? void 0 : n.renderTarget, g, e), e.depthCullingState.cull = f, e.setAlphaMode(p, !0), void 0 !== d && e.setDepthWrite(d), m && e.setDepthFunction(m), i.restoreStates(), h && e.restoreDefaultFramebuffer();
654
+ }, $ = function (e, i, r, n, a) { var s = i.useUbo, o = e.isWebGPU && !t.EffectWrapper.ForceGLSL, l = o ? "atmosphere" : i.name, c = ["POSITION_VEC2", "COMPUTE_WORLD_RAY"]; r && c.push("USE_SKY_VIEW_LUT"), n || c.push("OUTPUT_TO_SRGB"), a && c.push("APPLY_TRANSMITTANCE_BLENDING"); var u = r ? ["skyViewLut"] : ["transmittanceLut", "multiScatteringLut"]; return W(e, "atmo-skyCompositor", "compositeSky", __spreadArray(["depth"], __read(s ? [] : i.getUniformNames()), false), u, s ? [l] : [], c, o, function (e, t) { t.push.apply(t, __spreadArray([], __read(o ? [Promise.resolve().then(function () { return Wt; }), Promise.resolve().then(function () { return Ti; })] : [Promise.resolve().then(function () { return Qt; }), Promise.resolve().then(function () { return Ei; })]), false)); }); }, Y = function (e, i, r, n, a, s, o, l) { var c = i.useUbo, u = e.isWebGPU && !t.EffectWrapper.ForceGLSL, h = u ? "atmosphere" : i.name, d = ["POSITION_VEC2", "COMPUTE_WORLD_RAY"]; r && d.push("USE_AERIAL_PERSPECTIVE_LUT"), n && d.push("USE_SKY_VIEW_LUT"), 1 !== o && d.push("APPLY_AERIAL_PERSPECTIVE_INTENSITY"), a || d.push("OUTPUT_TO_SRGB"), s && d.push("APPLY_TRANSMITTANCE_BLENDING"), 0 !== l && d.push("APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS"); var m = ["transmittanceLut", "multiScatteringLut", "depthTexture"]; return n && m.push("skyViewLut"), r && m.push("aerialPerspectiveLut"), W(e, "atmo-aerialPerspectiveCompositor", "compositeAerialPerspective", __spreadArray(["depth"], __read(c ? [] : i.getUniformNames()), false), m, c ? [h] : [], d, u, function (e, t) { t.push.apply(t, __spreadArray([], __read(u ? [Promise.resolve().then(function () { return Wt; }), Promise.resolve().then(function () { return ki; })] : [Promise.resolve().then(function () { return Qt; }), Promise.resolve().then(function () { return $i; })]), false)); }); }, j = function (e, i, r, n, a, s, o, l) { var c = i.useUbo, u = e.isWebGPU && !t.EffectWrapper.ForceGLSL, h = u ? "atmosphere" : i.name, d = ["POSITION_VEC2", "COMPUTE_WORLD_RAY"]; r && d.push("USE_SKY_VIEW_LUT"), 1 !== s && d.push("APPLY_AERIAL_PERSPECTIVE_INTENSITY"), n || d.push("OUTPUT_TO_SRGB"), l && d.push("HAS_DEPTH_TEXTURE"), a && d.push("APPLY_TRANSMITTANCE_BLENDING"), 0 !== o && d.push("APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS"); var m = ["transmittanceLut", "multiScatteringLut"]; return r && m.push("skyViewLut"), l && m.push("depthTexture"), W(e, "atmo-globeAtmosphereCompositor", "compositeGlobeAtmosphere", __spreadArray(["depth"], __read(c ? [] : i.getUniformNames()), false), m, c ? [h] : [], d, u, function (e, t) { t.push.apply(t, __spreadArray([], __read(u ? [Promise.resolve().then(function () { return Wt; }), Promise.resolve().then(function () { return Qi; })] : [Promise.resolve().then(function () { return Qt; }), Promise.resolve().then(function () { return tr; })]), false)); }); }, X = 100, Q = function (e) { return function (t, i) { var r = t.getMesh(), n = i.getMesh(), a = r.isHtmlMesh, s = n.isHtmlMesh; return a ? s && r.absolutePosition.z <= n.absolutePosition.z ? 1 : -1 : s ? 1 : e(t, i); }; };
655
+ var K = /** @class */ (function () {
656
+ function K(e, _a) {
657
+ var _b = _a === void 0 ? {} : _a, _c = _b.parentContainerId, i = _c === void 0 ? null : _c, _d = _b._containerId, r = _d === void 0 ? "css-container" : _d, _f = _b.enableOverlayRender, n = _f === void 0 ? !0 : _f, _g = _b.defaultOpaqueRenderOrder, a = _g === void 0 ? t.RenderingGroup.PainterSortCompare : _g, _h = _b.defaultAlphaTestRenderOrder, s = _h === void 0 ? t.RenderingGroup.PainterSortCompare : _h, _j = _b.defaultTransparentRenderOrder, o = _j === void 0 ? t.RenderingGroup.defaultTransparentSortCompare : _j;
658
658
  var _this = this;
659
- this._cache = { cameraData: { fov: 0, position: new t.Vector3, style: "" }, htmlMeshData: new WeakMap }, this._width = 0, this._height = 0, this._heightHalf = 0, this._temp = { scaleTransform: new t.Vector3, rotationTransform: new t.Quaternion, positionTransform: new t.Vector3, objectMatrix: t.Matrix.Identity(), cameraWorldMatrix: t.Matrix.Identity(), cameraRotationMatrix: t.Matrix.Identity(), cameraWorldMatrixAsArray: new Array(16) }, this._lastDevicePixelRatio = window.devicePixelRatio, this._cameraMatrixUpdated = !0, this._previousCanvasDocumentPosition = { top: 0, left: 0 }, this._renderObserver = null, this._onCameraMatrixChanged = function (e) { _this._cameraWorldMatrix = e.getWorldMatrix(), _this._cameraMatrixUpdated = !0; }, "undefined" != typeof document && (this._containerId = n, this._init(e, i, r, a, s, o));
659
+ this._cache = { cameraData: { fov: 0, position: new t.Vector3, style: "" }, htmlMeshData: new WeakMap }, this._width = 0, this._height = 0, this._heightHalf = 0, this._temp = { scaleTransform: new t.Vector3, rotationTransform: new t.Quaternion, positionTransform: new t.Vector3, objectMatrix: t.Matrix.Identity(), cameraWorldMatrix: t.Matrix.Identity(), cameraRotationMatrix: t.Matrix.Identity(), cameraWorldMatrixAsArray: new Array(16) }, this._lastDevicePixelRatio = window.devicePixelRatio, this._cameraMatrixUpdated = !0, this._previousCanvasDocumentPosition = { top: 0, left: 0 }, this._renderObserver = null, this._onCameraMatrixChanged = function (e) { _this._cameraWorldMatrix = e.getWorldMatrix(), _this._cameraMatrixUpdated = !0; }, "undefined" != typeof document && (this._containerId = r, this._init(e, i, n, a, s, o));
660
660
  }
661
- X.prototype.dispose = function () { var e, t; this._renderObserver && (this._renderObserver.remove(), this._renderObserver = null), null === (e = this._overlayElements) || void 0 === e || e.container.remove(), this._overlayElements = null, null === (t = this._inSceneElements) || void 0 === t || t.container.remove(), this._inSceneElements = null; };
662
- X.prototype._init = function (e, t, i, n, r, a) {
661
+ K.prototype.dispose = function () { var e, t; this._renderObserver && (this._renderObserver.remove(), this._renderObserver = null), null === (e = this._overlayElements) || void 0 === e || e.container.remove(), this._overlayElements = null, null === (t = this._inSceneElements) || void 0 === t || t.container.remove(), this._inSceneElements = null; };
662
+ K.prototype._init = function (e, t, i, r, n, a) {
663
663
  var _this = this;
664
664
  var s;
665
665
  if ("undefined" == typeof document)
@@ -677,24 +677,24 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
677
677
  var c = this._engine.getRenderingCanvasClientRect();
678
678
  if (!c)
679
679
  throw new Error("Failed to get client rect for rendering canvas");
680
- var d, h;
680
+ var u, h;
681
681
  this._setSize(c.width, c.height), this._engine.onResizeObservable.add(function () { var e = _this._engine.getRenderingCanvasClientRect(); e && _this._setSize(e.width, e.height); });
682
- var u = function () { var t = e.activeCamera; t && (d = t.onProjectionMatrixChangedObservable.add(function () { _this._onCameraMatrixChanged(t); }), h = t.onViewMatrixChangedObservable.add(function () { _this._onCameraMatrixChanged(t); })); };
683
- u(), e.onActiveCameraChanged.add(function () { var t, i; d && (null === (t = e.activeCamera) || void 0 === t || t.onProjectionMatrixChangedObservable.remove(d)), h && (null === (i = e.activeCamera) || void 0 === i || i.onViewMatrixChangedObservable.remove(h)), u(); });
684
- var m = K(n), p = K(r), f = K(a);
682
+ var d = function () { var t = e.activeCamera; t && (u = t.onProjectionMatrixChangedObservable.add(function () { _this._onCameraMatrixChanged(t); }), h = t.onViewMatrixChangedObservable.add(function () { _this._onCameraMatrixChanged(t); })); };
683
+ d(), e.onActiveCameraChanged.add(function () { var t, i; u && (null === (t = e.activeCamera) || void 0 === t || t.onProjectionMatrixChangedObservable.remove(u)), h && (null === (i = e.activeCamera) || void 0 === i || i.onViewMatrixChangedObservable.remove(h)), d(); });
684
+ var m = Q(r), p = Q(n), f = Q(a);
685
685
  e.setRenderingOrder(0, m, p, f), this._renderObserver = e.onBeforeRenderObservable.add(function () { _this._render(e, e.activeCamera); });
686
686
  };
687
- X.prototype._createRenderLayerElements = function (e) { var t = document.getElementById(e); t && t.remove(); var i = document.createElement("div"); i.id = e, i.style.position = "absolute", i.style.width = "100%", i.style.height = "100%", i.style.zIndex = "-1"; var n = document.createElement("div"); n.style.overflow = "hidden"; var r = document.createElement("div"); return r.style.webkitTransformStyle = "preserve-3d", r.style.transformStyle = "preserve-3d", r.style.pointerEvents = "none", n.appendChild(r), i.appendChild(n), { container: i, domElement: n, cameraElement: r }; };
688
- X.prototype._getSize = function () { return { width: this._width, height: this._height }; };
689
- X.prototype._setSize = function (e, t) {
687
+ K.prototype._createRenderLayerElements = function (e) { var t = document.getElementById(e); t && t.remove(); var i = document.createElement("div"); i.id = e, i.style.position = "absolute", i.style.width = "100%", i.style.height = "100%", i.style.zIndex = "-1"; var r = document.createElement("div"); r.style.overflow = "hidden"; var n = document.createElement("div"); return n.style.webkitTransformStyle = "preserve-3d", n.style.transformStyle = "preserve-3d", n.style.pointerEvents = "none", r.appendChild(n), i.appendChild(r), { container: i, domElement: r, cameraElement: n }; };
688
+ K.prototype._getSize = function () { return { width: this._width, height: this._height }; };
689
+ K.prototype._setSize = function (e, t) {
690
690
  var e_29, _a;
691
691
  if (this._width = e, this._height = t, this._heightHalf = this._height / 2, !this._inSceneElements || !this._overlayElements)
692
692
  return;
693
693
  var i = [this._inSceneElements.domElement, this._overlayElements.domElement, this._inSceneElements.cameraElement, this._overlayElements.cameraElement];
694
694
  try {
695
695
  for (var i_5 = __values(i), i_5_1 = i_5.next(); !i_5_1.done; i_5_1 = i_5.next()) {
696
- var n_4 = i_5_1.value;
697
- n_4 && (n_4.style.width = "".concat(e, "px"), n_4.style.height = "".concat(t, "px"));
696
+ var r_4 = i_5_1.value;
697
+ r_4 && (r_4.style.width = "".concat(e, "px"), r_4.style.height = "".concat(t, "px"));
698
698
  }
699
699
  }
700
700
  catch (e_29_1) { e_29 = { error: e_29_1 }; }
@@ -705,29 +705,29 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
705
705
  finally { if (e_29) throw e_29.error; }
706
706
  }
707
707
  };
708
- X.prototype._getCameraCssMatrix = function (e) { var t = e.m; return "matrix3d(".concat(this._epsilon(t[0]), ",").concat(this._epsilon(-t[1]), ",").concat(this._epsilon(t[2]), ",").concat(this._epsilon(t[3]), ",").concat(this._epsilon(t[4]), ",").concat(this._epsilon(-t[5]), ",").concat(this._epsilon(t[6]), ",").concat(this._epsilon(t[7]), ",").concat(this._epsilon(t[8]), ",").concat(this._epsilon(-t[9]), ",").concat(this._epsilon(t[10]), ",").concat(this._epsilon(t[11]), ",").concat(this._epsilon(t[12]), ",").concat(this._epsilon(-t[13]), ",").concat(this._epsilon(t[14]), ",").concat(this._epsilon(t[15]), ")"); };
709
- X.prototype._getHtmlContentCssMatrix = function (e, t) { var i = e.m, n = t ? -1 : 1; return "matrix3d(".concat(this._epsilon(i[0]), ",").concat(this._epsilon(i[1]), ",").concat(this._epsilon(i[2] * -n), ",").concat(this._epsilon(i[3]), ",").concat(this._epsilon(-i[4]), ",").concat(this._epsilon(-i[5]), ",").concat(this._epsilon(i[6] * n), ",").concat(this._epsilon(-i[7]), ",").concat(this._epsilon(i[8] * -n), ",").concat(this._epsilon(i[9] * -n), ",").concat(this._epsilon(i[10]), ",").concat(this._epsilon(i[11] * n), ",").concat(this._epsilon(i[12] * n), ",").concat(this._epsilon(i[13] * n), ",").concat(this._epsilon(i[14] * n), ",").concat(this._epsilon(i[15]), ")"); };
710
- X.prototype._getTransformationMatrix = function (e, i) { var n; if (this._cameraWorldMatrix || (this._cameraWorldMatrix = null === (n = e.getScene().activeCamera) || void 0 === n ? void 0 : n.getWorldMatrix()), !this._cameraWorldMatrix)
711
- return t.Matrix.Identity(); var r = e.getWorldMatrix(); var a = 1, s = 1; e.sourceWidth && e.sourceHeight && (a = e.width / (e.sourceWidth / Q), s = e.height / (e.sourceHeight / Q)); var o = this._temp.scaleTransform, l = this._temp.rotationTransform, c = this._temp.positionTransform, d = this._temp.objectMatrix; r.decompose(o, l, c), o.x *= a, o.y *= s, t.Matrix.ComposeToRef(o, l, c, d); var h = i ? -1 : 1, u = e.getAbsolutePosition(); return d.setRowFromFloats(3, (-this._cameraWorldMatrix.m[12] + u.x) * Q * h, (-this._cameraWorldMatrix.m[13] + u.y) * Q * h, (this._cameraWorldMatrix.m[14] - u.z) * Q, this._cameraWorldMatrix.m[15] * X.PROJECTION_SCALE_FACTOR * Q), d.multiplyAtIndex(3, Q), d.multiplyAtIndex(7, Q), d.multiplyAtIndex(11, Q), d; };
712
- X.prototype._renderHtmlMesh = function (e, i) { var n, r; if (!e.element || !e.element.firstElementChild)
713
- return; var a = this._cache.htmlMeshData.get(e); a || (a = { style: "" }, this._cache.htmlMeshData.set(e, a)); var s = e._isCanvasOverlay ? null === (n = this._overlayElements) || void 0 === n ? void 0 : n.cameraElement : null === (r = this._inSceneElements) || void 0 === r ? void 0 : r.cameraElement; e.element.parentNode !== s && s.appendChild(e.element), e.requiresUpdate && this._updateBaseScaleFactor(e); var o = this._getTransformationMatrix(e, i); var l = "translate(-50%, -50%) ".concat(this._getHtmlContentCssMatrix(o, i)); l += i ? "matrix3d(".concat(e.billboardMode !== t.TransformNode.BILLBOARDMODE_NONE ? 1 : -1, ", 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1)") : "", a.style !== l && (e.element.style.webkitTransform = l, e.element.style.transform = l), e._markAsUpdated(); };
714
- X.prototype._render = function (e, i) {
708
+ K.prototype._getCameraCssMatrix = function (e) { var t = e.m; return "matrix3d(".concat(this._epsilon(t[0]), ",").concat(this._epsilon(-t[1]), ",").concat(this._epsilon(t[2]), ",").concat(this._epsilon(t[3]), ",").concat(this._epsilon(t[4]), ",").concat(this._epsilon(-t[5]), ",").concat(this._epsilon(t[6]), ",").concat(this._epsilon(t[7]), ",").concat(this._epsilon(t[8]), ",").concat(this._epsilon(-t[9]), ",").concat(this._epsilon(t[10]), ",").concat(this._epsilon(t[11]), ",").concat(this._epsilon(t[12]), ",").concat(this._epsilon(-t[13]), ",").concat(this._epsilon(t[14]), ",").concat(this._epsilon(t[15]), ")"); };
709
+ K.prototype._getHtmlContentCssMatrix = function (e, t) { var i = e.m, r = t ? -1 : 1; return "matrix3d(".concat(this._epsilon(i[0]), ",").concat(this._epsilon(i[1]), ",").concat(this._epsilon(i[2] * -r), ",").concat(this._epsilon(i[3]), ",").concat(this._epsilon(-i[4]), ",").concat(this._epsilon(-i[5]), ",").concat(this._epsilon(i[6] * r), ",").concat(this._epsilon(-i[7]), ",").concat(this._epsilon(i[8] * -r), ",").concat(this._epsilon(i[9] * -r), ",").concat(this._epsilon(i[10]), ",").concat(this._epsilon(i[11] * r), ",").concat(this._epsilon(i[12] * r), ",").concat(this._epsilon(i[13] * r), ",").concat(this._epsilon(i[14] * r), ",").concat(this._epsilon(i[15]), ")"); };
710
+ K.prototype._getTransformationMatrix = function (e, i) { var r; if (this._cameraWorldMatrix || (this._cameraWorldMatrix = null === (r = e.getScene().activeCamera) || void 0 === r ? void 0 : r.getWorldMatrix()), !this._cameraWorldMatrix)
711
+ return t.Matrix.Identity(); var n = e.getWorldMatrix(); var a = 1, s = 1; e.sourceWidth && e.sourceHeight && (a = e.width / (e.sourceWidth / X), s = e.height / (e.sourceHeight / X)); var o = this._temp.scaleTransform, l = this._temp.rotationTransform, c = this._temp.positionTransform, u = this._temp.objectMatrix; n.decompose(o, l, c), o.x *= a, o.y *= s, t.Matrix.ComposeToRef(o, l, c, u); var h = i ? -1 : 1, d = e.getAbsolutePosition(); return u.setRowFromFloats(3, (-this._cameraWorldMatrix.m[12] + d.x) * X * h, (-this._cameraWorldMatrix.m[13] + d.y) * X * h, (this._cameraWorldMatrix.m[14] - d.z) * X, this._cameraWorldMatrix.m[15] * K.PROJECTION_SCALE_FACTOR * X), u.multiplyAtIndex(3, X), u.multiplyAtIndex(7, X), u.multiplyAtIndex(11, X), u; };
712
+ K.prototype._renderHtmlMesh = function (e, i) { var r, n; if (!e.element || !e.element.firstElementChild)
713
+ return; var a = this._cache.htmlMeshData.get(e); a || (a = { style: "" }, this._cache.htmlMeshData.set(e, a)); var s = e._isCanvasOverlay ? null === (r = this._overlayElements) || void 0 === r ? void 0 : r.cameraElement : null === (n = this._inSceneElements) || void 0 === n ? void 0 : n.cameraElement; e.element.parentNode !== s && s.appendChild(e.element), e.requiresUpdate && this._updateBaseScaleFactor(e); var o = this._getTransformationMatrix(e, i); var l = "translate(-50%, -50%) ".concat(this._getHtmlContentCssMatrix(o, i)); l += i ? "matrix3d(".concat(e.billboardMode !== t.TransformNode.BILLBOARDMODE_NONE ? 1 : -1, ", 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1)") : "", a.style !== l && (e.element.style.webkitTransform = l, e.element.style.transform = l), e._markAsUpdated(); };
714
+ K.prototype._render = function (e, i) {
715
715
  var e_30, _a, e_31, _b, e_32, _c, e_33, _d;
716
- var n, r, a, s;
716
+ var r, n, a, s;
717
717
  var o = !1;
718
718
  var l = e.useRightHandedSystem;
719
719
  this._updateContainerPositionIfNeeded(), this._cameraMatrixUpdated && (this._cameraMatrixUpdated = !1, o = !0), i.position.x === this._cache.cameraData.position.x && i.position.y === this._cache.cameraData.position.y && i.position.z === this._cache.cameraData.position.z || (this._cache.cameraData.position.copyFrom(i.position), o = !0), window.devicePixelRatio !== this._lastDevicePixelRatio && (this._lastDevicePixelRatio = window.devicePixelRatio, t.Logger.Log("In render - dpr changed: ", this._lastDevicePixelRatio), o = !0);
720
720
  var c = e.meshes.filter(function (e) { return e.isHtmlMesh && (o || e.requiresUpdate); });
721
721
  if (o = o || c.length > 0, !o)
722
722
  return;
723
- var d = i.getProjectionMatrix().m[5] * this._heightHalf;
724
- if (this._cache.cameraData.fov !== d) {
725
- var e_37 = [null === (n = this._overlayElements) || void 0 === n ? void 0 : n.domElement, null === (r = this._inSceneElements) || void 0 === r ? void 0 : r.domElement];
723
+ var u = i.getProjectionMatrix().m[5] * this._heightHalf;
724
+ if (this._cache.cameraData.fov !== u) {
725
+ var e_37 = [null === (r = this._overlayElements) || void 0 === r ? void 0 : r.domElement, null === (n = this._inSceneElements) || void 0 === n ? void 0 : n.domElement];
726
726
  if (i.mode == t.Camera.PERSPECTIVE_CAMERA)
727
727
  try {
728
728
  for (var e_34 = __values(e_37), e_34_1 = e_34.next(); !e_34_1.done; e_34_1 = e_34.next()) {
729
729
  var t_4 = e_34_1.value;
730
- t_4 && (t_4.style.webkitPerspective = d + "px", t_4.style.perspective = d + "px");
730
+ t_4 && (t_4.style.webkitPerspective = u + "px", t_4.style.perspective = u + "px");
731
731
  }
732
732
  }
733
733
  catch (e_30_1) { e_30 = { error: e_30_1 }; }
@@ -751,17 +751,17 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
751
751
  }
752
752
  finally { if (e_31) throw e_31.error; }
753
753
  }
754
- this._cache.cameraData.fov = d;
754
+ this._cache.cameraData.fov = u;
755
755
  }
756
756
  null === i.parent && i.computeWorldMatrix();
757
757
  var h = this._temp.cameraWorldMatrix;
758
758
  h.copyFrom(i.getWorldMatrix());
759
- var u = this._temp.cameraRotationMatrix;
760
- h.getRotationMatrix().transposeToRef(u);
759
+ var d = this._temp.cameraRotationMatrix;
760
+ h.getRotationMatrix().transposeToRef(d);
761
761
  var m = this._temp.cameraWorldMatrixAsArray;
762
762
  h.copyToArray(m);
763
763
  var p = l ? 1 : -1;
764
- m[1] = u.m[1], m[2] = u.m[2] * p, m[4] = u.m[4] * p, m[6] = u.m[6] * p, m[8] = u.m[8] * p, m[9] = u.m[9] * p, t.Matrix.FromArrayToRef(m, 0, h);
764
+ m[1] = d.m[1], m[2] = d.m[2] * p, m[4] = d.m[4] * p, m[6] = d.m[6] * p, m[8] = d.m[8] * p, m[9] = d.m[9] * p, t.Matrix.FromArrayToRef(m, 0, h);
765
765
  var f = this._getCameraCssMatrix(h);
766
766
  if (this._cache.cameraData.style !== f) {
767
767
  var e_38 = [null === (a = this._inSceneElements) || void 0 === a ? void 0 : a.cameraElement, null === (s = this._overlayElements) || void 0 === s ? void 0 : s.cameraElement];
@@ -794,14 +794,14 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
794
794
  finally { if (e_33) throw e_33.error; }
795
795
  }
796
796
  };
797
- X.prototype._updateBaseScaleFactor = function (e) { var t = this._width, i = this._height; var n = (e.width || 1) / (e.height || 1); n > t / i ? t = i * n : i = t / n, e.setContentSizePx(t, i); };
798
- X.prototype._updateContainerPositionIfNeeded = function () {
797
+ K.prototype._updateBaseScaleFactor = function (e) { var t = this._width, i = this._height; var r = (e.width || 1) / (e.height || 1); r > t / i ? t = i * r : i = t / r, e.setContentSizePx(t, i); };
798
+ K.prototype._updateContainerPositionIfNeeded = function () {
799
799
  var e_40, _a;
800
800
  var e, i;
801
- var n = this._engine.getRenderingCanvasClientRect();
802
- if (!n)
801
+ var r = this._engine.getRenderingCanvasClientRect();
802
+ if (!r)
803
803
  return void t.Logger.Warn("Failed to update html mesh renderer position due to failure to get canvas rect. HtmlMesh instances may not render correctly");
804
- var r = window.scrollY, a = window.scrollX, s = n.top + r, o = n.left + a;
804
+ var n = window.scrollY, a = window.scrollX, s = r.top + n, o = r.left + a;
805
805
  if (this._previousCanvasDocumentPosition.top !== s || this._previousCanvasDocumentPosition.left !== o) {
806
806
  this._previousCanvasDocumentPosition.top = s, this._previousCanvasDocumentPosition.left = o;
807
807
  var t_8 = [null === (e = this._inSceneElements) || void 0 === e ? void 0 : e.container, null === (i = this._overlayElements) || void 0 === i ? void 0 : i.container];
@@ -810,8 +810,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
810
810
  var e_41 = t_7_1.value;
811
811
  if (!e_41)
812
812
  continue;
813
- var t_9 = e_41.offsetParent, i_6 = t_9.getBoundingClientRect(), n_5 = i_6.top + r, l_1 = i_6.left + a, c_2 = this._getAncestorMarginsAndPadding(t_9), d_1 = window.getComputedStyle(document.body), h_1 = parseInt(d_1.marginTop, 10), u_1 = parseInt(d_1.marginLeft, 10);
814
- e_41.style.top = "".concat(s - n_5 - c_2.marginTop + c_2.paddingTop + h_1, "px"), e_41.style.left = "".concat(o - l_1 - c_2.marginLeft + c_2.paddingLeft + u_1, "px");
813
+ var t_9 = e_41.offsetParent, i_6 = t_9.getBoundingClientRect(), r_5 = i_6.top + n, l_1 = i_6.left + a, c_2 = this._getAncestorMarginsAndPadding(t_9), u_1 = window.getComputedStyle(document.body), h_1 = parseInt(u_1.marginTop, 10), d_1 = parseInt(u_1.marginLeft, 10);
814
+ e_41.style.top = "".concat(s - r_5 - c_2.marginTop + c_2.paddingTop + h_1, "px"), e_41.style.left = "".concat(o - l_1 - c_2.marginLeft + c_2.paddingLeft + d_1, "px");
815
815
  }
816
816
  }
817
817
  catch (e_40_1) { e_40 = { error: e_40_1 }; }
@@ -823,26 +823,26 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
823
823
  }
824
824
  }
825
825
  };
826
- X.prototype._epsilon = function (e) { return Math.abs(e) < 1e-10 ? 0 : e; };
827
- X.prototype._getAncestorMarginsAndPadding = function (e) { var t = 0, i = 0, n = 0, r = 0; for (; e && e !== document.body && e !== document.documentElement;) {
826
+ K.prototype._epsilon = function (e) { return Math.abs(e) < 1e-10 ? 0 : e; };
827
+ K.prototype._getAncestorMarginsAndPadding = function (e) { var t = 0, i = 0, r = 0, n = 0; for (; e && e !== document.body && e !== document.documentElement;) {
828
828
  var a_2 = window.getComputedStyle(e);
829
- t += parseInt(a_2.marginTop, 10), i += parseInt(a_2.marginLeft, 10), n += parseInt(a_2.paddingTop, 10), r += parseInt(a_2.paddingLeft, 10), e = e.offsetParent;
830
- } return { marginTop: t, marginLeft: i, paddingTop: n, paddingLeft: r }; };
831
- return X;
829
+ t += parseInt(a_2.marginTop, 10), i += parseInt(a_2.marginLeft, 10), r += parseInt(a_2.paddingTop, 10), n += parseInt(a_2.paddingLeft, 10), e = e.offsetParent;
830
+ } return { marginTop: t, marginLeft: i, paddingTop: r, paddingLeft: n }; };
831
+ return K;
832
832
  }());
833
- X.PROJECTION_SCALE_FACTOR = 1e-5;
833
+ K.PROJECTION_SCALE_FACTOR = 1e-5;
834
834
  var J = [];
835
835
  var ee = new Map;
836
836
  var te = [], ie = null;
837
- var ne = function (e) { ce("In pointerEventsCapture.requestRelease - Pointer events release requested for ".concat(e)), e && e !== ie ? re(e) ? ee.delete(e) : (ce("In pointerEventsCapture.requestRelease - Received release request ".concat(e, " but no matching capture request was received")), te.includes(e) || te.push(e)) : ae(); }, re = function (e) { var t = !1; return J = J.filter(function (i) { return i !== e || (t = !0, ce("In pointerEventsCapture.cancelRequest - Canceling pointer events capture request ".concat(e)), !1); }), t; }, ae = function () { var e = le(); ce("In pointerEventsCapture.transferPointerEventsOwnership - Transferrring pointer events from ".concat(ie, " to ").concat(e)), se(), e && oe(e); }, se = function () { var e; ce("In pointerEventsCapture.doRelease - Releasing pointer events from ".concat(ie)), ie && (null === (e = ee.get(ie)) || void 0 === e || e.release(), ee.delete(ie), ie = null); }, oe = function (e) { var t; e && (null === (t = ee.get(e)) || void 0 === t || t.capture()), ie = e, ce("In pointerEventsCapture.doCapture - Pointer events now captured by ".concat(e)); }, le = function () { return J.length > 0 ? J.shift() : null; }, ce = function (e) { ("undefined" == typeof window || window["pointer-events-capture-debug"]) && t.Tools.Log("".concat(performance.now(), " - game.scene.pointerEvents - ").concat(e, "\ncurrentOwner: ").concat(ie, "\nqueue: ").concat(J, "\nunmatched: ").concat(te)); };
838
- var de = null, he = 0;
839
- var ue = new WeakMap, me = function (e) { "undefined" != typeof document && (0 === he && (document.addEventListener("pointermove", ge), document.addEventListener("touchstart", ge), de = null != de ? de : e, t.Logger.Log("PointerEventsCaptureBehavior: Starting observation of pointer move events."), de.onDisposeObservable.add(pe)), he++); }, pe = function () { document.removeEventListener("pointermove", ge), document.removeEventListener("touchstart", ge), de = null, t.Logger.Log("PointerEventsCaptureBehavior: Stopping observation of pointer move events."), he = 0; }, fe = function () { "undefined" != typeof document && de && (he--, he <= 0 && pe()); }, ge = function (e) { if (!de)
840
- return; var t = de.getEngine().getRenderingCanvasClientRect(); if (!t)
841
- return; var _a = "touches" in e ? e.touches[0] : e, i = _a.clientX, n = _a.clientY, r = i - t.left, a = n - t.top; var s; var o = de.pick(r, a, function (e) { var t = ue.get(e); return e.isEnabled() && void 0 !== t && t._captureOnPointerEnter; }); var l; l = o.hit ? o.pickedMesh : null; var c = parseInt(ie || ""); l && l.uniqueId === c || (!c || l && l.uniqueId === c || ne(ie), l && (s = ue.get(l), s.capturePointerEvents())); };
837
+ var re = function (e) { ce("In pointerEventsCapture.requestRelease - Pointer events release requested for ".concat(e)), e && e !== ie ? ne(e) ? ee.delete(e) : (ce("In pointerEventsCapture.requestRelease - Received release request ".concat(e, " but no matching capture request was received")), te.includes(e) || te.push(e)) : ae(); }, ne = function (e) { var t = !1; return J = J.filter(function (i) { return i !== e || (t = !0, ce("In pointerEventsCapture.cancelRequest - Canceling pointer events capture request ".concat(e)), !1); }), t; }, ae = function () { var e = le(); ce("In pointerEventsCapture.transferPointerEventsOwnership - Transferrring pointer events from ".concat(ie, " to ").concat(e)), se(), e && oe(e); }, se = function () { var e; ce("In pointerEventsCapture.doRelease - Releasing pointer events from ".concat(ie)), ie && (null === (e = ee.get(ie)) || void 0 === e || e.release(), ee.delete(ie), ie = null); }, oe = function (e) { var t; e && (null === (t = ee.get(e)) || void 0 === t || t.capture()), ie = e, ce("In pointerEventsCapture.doCapture - Pointer events now captured by ".concat(e)); }, le = function () { return J.length > 0 ? J.shift() : null; }, ce = function (e) { ("undefined" == typeof window || window["pointer-events-capture-debug"]) && t.Tools.Log("".concat(performance.now(), " - game.scene.pointerEvents - ").concat(e, "\ncurrentOwner: ").concat(ie, "\nqueue: ").concat(J, "\nunmatched: ").concat(te)); };
838
+ var ue = null, he = 0;
839
+ var de = new WeakMap, me = function (e) { "undefined" != typeof document && (0 === he && (document.addEventListener("pointermove", ge), document.addEventListener("touchstart", ge), ue = null != ue ? ue : e, t.Logger.Log("PointerEventsCaptureBehavior: Starting observation of pointer move events."), ue.onDisposeObservable.add(pe)), he++); }, pe = function () { document.removeEventListener("pointermove", ge), document.removeEventListener("touchstart", ge), ue = null, t.Logger.Log("PointerEventsCaptureBehavior: Stopping observation of pointer move events."), he = 0; }, fe = function () { "undefined" != typeof document && ue && (he--, he <= 0 && pe()); }, ge = function (e) { if (!ue)
840
+ return; var t = ue.getEngine().getRenderingCanvasClientRect(); if (!t)
841
+ return; var _a = "touches" in e ? e.touches[0] : e, i = _a.clientX, r = _a.clientY, n = i - t.left, a = r - t.top; var s; var o = ue.pick(n, a, function (e) { var t = de.get(e); return e.isEnabled() && void 0 !== t && t._captureOnPointerEnter; }); var l; l = o.hit ? o.pickedMesh : null; var c = parseInt(ie || ""); l && l.uniqueId === c || (!c || l && l.uniqueId === c || re(ie), l && (s = de.get(l), s.capturePointerEvents())); };
842
842
  var ve = /** @class */ (function () {
843
843
  function ve(e, i, _a) {
844
- var _b = _a === void 0 ? {} : _a, _c = _b.captureOnPointerEnter, n = _c === void 0 ? !0 : _c;
845
- this._captureCallback = e, this._releaseCallback = i, this.name = "PointerEventsCaptureBehavior", this._attachedMesh = null, this._captureOnPointerEnter = n, "undefined" == typeof document && t.Logger.Warn("Creating an instance of PointerEventsCaptureBehavior outside of a browser. The behavior will not work.");
844
+ var _b = _a === void 0 ? {} : _a, _c = _b.captureOnPointerEnter, r = _c === void 0 ? !0 : _c;
845
+ this._captureCallback = e, this._releaseCallback = i, this.name = "PointerEventsCaptureBehavior", this._attachedMesh = null, this._captureOnPointerEnter = r, "undefined" == typeof document && t.Logger.Warn("Creating an instance of PointerEventsCaptureBehavior outside of a browser. The behavior will not work.");
846
846
  }
847
847
  Object.defineProperty(ve.prototype, "attachedMesh", {
848
848
  get: function () { return this._attachedMesh; },
@@ -861,81 +861,81 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
861
861
  configurable: true
862
862
  });
863
863
  ve.prototype.init = function () { };
864
- ve.prototype.attach = function (e) { this.attachedMesh = e, ue.set(e, this), this._captureOnPointerEnter && me(e.getScene()); };
865
- ve.prototype.detach = function () { this.attachedMesh && (ue.delete(this.attachedMesh), this._captureOnPointerEnter && fe(), this.attachedMesh = null); };
864
+ ve.prototype.attach = function (e) { this.attachedMesh = e, de.set(e, this), this._captureOnPointerEnter && me(e.getScene()); };
865
+ ve.prototype.detach = function () { this.attachedMesh && (de.delete(this.attachedMesh), this._captureOnPointerEnter && fe(), this.attachedMesh = null); };
866
866
  ve.prototype.dispose = function () { this.detach(); };
867
- ve.prototype.releasePointerEvents = function () { this.attachedMesh && ne(this.attachedMesh.uniqueId.toString()); };
867
+ ve.prototype.releasePointerEvents = function () { this.attachedMesh && re(this.attachedMesh.uniqueId.toString()); };
868
868
  ve.prototype.capturePointerEvents = function () { var e, t, i; this.attachedMesh && (e = this.attachedMesh.uniqueId.toString(), t = this._captureCallback, i = this._releaseCallback, ce("In pointerEventsCapture.requestCapture - Pointer events capture requested for ".concat(e)), (function (e) { var t = !1; return te = te.filter(function (i) { return i !== e || (t = !0, !1); }), t; })(e) ? ce("In pointerEventsCapture.requestCapture - Capture request matched previous release request ".concat(e, ". Cancelling capture request")) : (e !== ie && (function (e, t, i) { ce("In pointerEventsCapture.enqueueCaptureRequest - Enqueueing capture request for ".concat(e)), J.includes(e) || (J.push(e), ee.set(e, { capture: t, release: i })); })(e, t, i), ie || ae())); };
869
869
  return ve;
870
870
  }());
871
- var Se = { CONTAIN: { wrapElement: function (e) { var t = document.createElement("div"); t.style.display = "flex", t.style.justifyContent = "center", t.style.alignItems = "center"; var i = document.createElement("div"); return i.style.visibility = "hidden", i.appendChild(e), t.appendChild(i), t; }, updateSize: function (e, t, i) { var n = e.firstElementChild; e.style.width = "".concat(t, "px"), e.style.height = "".concat(i, "px"); var _a = __read([n.offsetWidth, n.offsetHeight], 2), r = _a[0], a = _a[1], s = Math.min(t / r, i / a); n.style.transform = "scale(".concat(s, ")"), n.style.visibility = "visible"; } }, COVER: { wrapElement: function (e) { var t = document.createElement("div"); t.style.display = "flex", t.style.justifyContent = "center", t.style.alignItems = "center", t.style.overflow = "hidden"; var i = document.createElement("div"); return i.style.visibility = "hidden", i.appendChild(e), t.appendChild(i), t; }, updateSize: function (e, t, i) { var n = e.firstElementChild; e.style.width = "".concat(t, "px"), e.style.height = "".concat(i, "px"); var _a = __read([n.offsetWidth, n.offsetHeight], 2), r = _a[0], a = _a[1], s = Math.max(t / r, i / a); n.style.transform = "scale(".concat(s, ")"), n.style.visibility = "visible"; } }, STRETCH: { wrapElement: function (e) { var t = document.createElement("div"); t.style.display = "flex", t.style.justifyContent = "center", t.style.alignItems = "center"; var i = document.createElement("div"); return i.style.visibility = "hidden", i.appendChild(e), t.appendChild(i), t; }, updateSize: function (e, t, i) { var n = e.firstElementChild; e.style.width = "".concat(t, "px"), e.style.height = "".concat(i, "px"); var _a = __read([n.offsetWidth, n.offsetHeight], 2), r = _a[0], a = _a[1]; n.style.transform = "scale(".concat(t / r, ", ").concat(i / a, ")"), n.style.visibility = "visible"; } }, NONE: { wrapElement: function (e) { return e; }, updateSize: function (e, t, i) { e && (e.style.width = "".concat(t, "px"), e.style.height = "".concat(i, "px")); } } };
872
- var _e = /** @class */ (function (_super) {
873
- __extends(_e, _super);
874
- function _e(e, i, _a) {
875
- var _b = _a === void 0 ? {} : _a, _c = _b.captureOnPointerEnter, n = _c === void 0 ? !0 : _c, _d = _b.isCanvasOverlay, r = _d === void 0 ? !1 : _d, _f = _b.fitStrategy, a = _f === void 0 ? Se.NONE : _f;
871
+ var _e = { CONTAIN: { wrapElement: function (e) { var t = document.createElement("div"); t.style.display = "flex", t.style.justifyContent = "center", t.style.alignItems = "center"; var i = document.createElement("div"); return i.style.visibility = "hidden", i.appendChild(e), t.appendChild(i), t; }, updateSize: function (e, t, i) { var r = e.firstElementChild; e.style.width = "".concat(t, "px"), e.style.height = "".concat(i, "px"); var _a = __read([r.offsetWidth, r.offsetHeight], 2), n = _a[0], a = _a[1], s = Math.min(t / n, i / a); r.style.transform = "scale(".concat(s, ")"), r.style.visibility = "visible"; } }, COVER: { wrapElement: function (e) { var t = document.createElement("div"); t.style.display = "flex", t.style.justifyContent = "center", t.style.alignItems = "center", t.style.overflow = "hidden"; var i = document.createElement("div"); return i.style.visibility = "hidden", i.appendChild(e), t.appendChild(i), t; }, updateSize: function (e, t, i) { var r = e.firstElementChild; e.style.width = "".concat(t, "px"), e.style.height = "".concat(i, "px"); var _a = __read([r.offsetWidth, r.offsetHeight], 2), n = _a[0], a = _a[1], s = Math.max(t / n, i / a); r.style.transform = "scale(".concat(s, ")"), r.style.visibility = "visible"; } }, STRETCH: { wrapElement: function (e) { var t = document.createElement("div"); t.style.display = "flex", t.style.justifyContent = "center", t.style.alignItems = "center"; var i = document.createElement("div"); return i.style.visibility = "hidden", i.appendChild(e), t.appendChild(i), t; }, updateSize: function (e, t, i) { var r = e.firstElementChild; e.style.width = "".concat(t, "px"), e.style.height = "".concat(i, "px"); var _a = __read([r.offsetWidth, r.offsetHeight], 2), n = _a[0], a = _a[1]; r.style.transform = "scale(".concat(t / n, ", ").concat(i / a, ")"), r.style.visibility = "visible"; } }, NONE: { wrapElement: function (e) { return e; }, updateSize: function (e, t, i) { e && (e.style.width = "".concat(t, "px"), e.style.height = "".concat(i, "px")); } } };
872
+ var Se = /** @class */ (function (_super) {
873
+ __extends(Se, _super);
874
+ function Se(e, i, _a) {
875
+ var _b = _a === void 0 ? {} : _a, _c = _b.captureOnPointerEnter, r = _c === void 0 ? !0 : _c, _d = _b.isCanvasOverlay, n = _d === void 0 ? !1 : _d, _f = _b.fitStrategy, a = _f === void 0 ? _e.NONE : _f;
876
876
  var _this = this;
877
- _this = _super.call(this, i, e) || this, _this._enabled = !1, _this._ready = !1, _this._isCanvasOverlay = !1, _this._requiresUpdate = !0, _this._inverseScaleMatrix = null, _this._captureOnPointerEnter = !0, _this._pointerEventCaptureBehavior = null, _this._sourceWidth = null, _this._sourceHeight = null, _this._fitStrategy = Se.NONE, "undefined" != typeof document ? (_this._fitStrategy = a, _this._isCanvasOverlay = r, _this._createMask(), _this._element = _this._createElement(), _this.setEnabled(!0), _this._captureOnPointerEnter = n, _this._pointerEventCaptureBehavior = new ve(_this.capturePointerEvents.bind(_this), _this.releasePointerEvents.bind(_this), { captureOnPointerEnter: _this._captureOnPointerEnter }), _this.addBehavior(_this._pointerEventCaptureBehavior)) : t.Logger.Warn("Creating an instance of an HtmlMesh with id ".concat(i, " outside of a browser. The mesh will not be visible."));
877
+ _this = _super.call(this, i, e) || this, _this._enabled = !1, _this._ready = !1, _this._isCanvasOverlay = !1, _this._requiresUpdate = !0, _this._inverseScaleMatrix = null, _this._captureOnPointerEnter = !0, _this._pointerEventCaptureBehavior = null, _this._sourceWidth = null, _this._sourceHeight = null, _this._fitStrategy = _e.NONE, "undefined" != typeof document ? (_this._fitStrategy = a, _this._isCanvasOverlay = n, _this._createMask(), _this._element = _this._createElement(), _this.setEnabled(!0), _this._captureOnPointerEnter = r, _this._pointerEventCaptureBehavior = new ve(_this.capturePointerEvents.bind(_this), _this.releasePointerEvents.bind(_this), { captureOnPointerEnter: _this._captureOnPointerEnter }), _this.addBehavior(_this._pointerEventCaptureBehavior)) : t.Logger.Warn("Creating an instance of an HtmlMesh with id ".concat(i, " outside of a browser. The mesh will not be visible."));
878
878
  return _this;
879
879
  }
880
- Object.defineProperty(_e.prototype, "isHtmlMesh", {
880
+ Object.defineProperty(Se.prototype, "isHtmlMesh", {
881
881
  get: function () { return !0; },
882
882
  enumerable: false,
883
883
  configurable: true
884
884
  });
885
- Object.defineProperty(_e.prototype, "sourceWidth", {
885
+ Object.defineProperty(Se.prototype, "sourceWidth", {
886
886
  get: function () { return this._sourceWidth; },
887
887
  enumerable: false,
888
888
  configurable: true
889
889
  });
890
- Object.defineProperty(_e.prototype, "sourceHeight", {
890
+ Object.defineProperty(Se.prototype, "sourceHeight", {
891
891
  get: function () { return this._sourceHeight; },
892
892
  enumerable: false,
893
893
  configurable: true
894
894
  });
895
- Object.defineProperty(_e.prototype, "width", {
895
+ Object.defineProperty(Se.prototype, "width", {
896
896
  get: function () { return this._width; },
897
897
  enumerable: false,
898
898
  configurable: true
899
899
  });
900
- Object.defineProperty(_e.prototype, "height", {
900
+ Object.defineProperty(Se.prototype, "height", {
901
901
  get: function () { return this._height; },
902
902
  enumerable: false,
903
903
  configurable: true
904
904
  });
905
- Object.defineProperty(_e.prototype, "element", {
905
+ Object.defineProperty(Se.prototype, "element", {
906
906
  get: function () { return this._element; },
907
907
  enumerable: false,
908
908
  configurable: true
909
909
  });
910
- Object.defineProperty(_e.prototype, "requiresUpdate", {
910
+ Object.defineProperty(Se.prototype, "requiresUpdate", {
911
911
  get: function () { return this._requiresUpdate; },
912
912
  enumerable: false,
913
913
  configurable: true
914
914
  });
915
- Object.defineProperty(_e.prototype, "captureOnPointerEnter", {
915
+ Object.defineProperty(Se.prototype, "captureOnPointerEnter", {
916
916
  set: function (e) { this._captureOnPointerEnter = e, this._pointerEventCaptureBehavior && (this._pointerEventCaptureBehavior.captureOnPointerEnter = e); },
917
917
  enumerable: false,
918
918
  configurable: true
919
919
  });
920
- _e.prototype.dispose = function () { var e; _super.prototype.dispose.call(this), null === (e = this._element) || void 0 === e || e.remove(), this._element = void 0, this._pointerEventCaptureBehavior && (this._pointerEventCaptureBehavior.dispose(), this._pointerEventCaptureBehavior = null); };
921
- _e.prototype._markAsUpdated = function () { this._requiresUpdate = !1; };
922
- _e.prototype.setContent = function (e, t, i) { this._setAsReady(!1), this._sourceWidth = null, this._sourceHeight = null, this._element && (this._width = t, this._height = i, this._requiresUpdate = !0, this.scaling.setAll(1), e && (this._element.appendChild(this._fitStrategy.wrapElement(e)), this._updateScaleIfNecessary()), this.sourceWidth && this.sourceHeight && this._setAsReady(!0)); };
923
- _e.prototype.setEnabled = function (e) { this._enabled = e, e && !this._ready || this._doSetEnabled(e); };
924
- _e.prototype.setContentSizePx = function (e, t) { this._sourceWidth = e, this._sourceHeight = t, this._element && this._element.firstElementChild && (this._fitStrategy.updateSize(this._element.firstElementChild, e, t), this._updateScaleIfNecessary(), this.width && this.height && this._setAsReady(!0)); };
925
- _e.prototype._setAsReady = function (e) { this._ready = e, e ? this._doSetEnabled(this._enabled) : this._doSetEnabled(!1); };
926
- _e.prototype._doSetEnabled = function (e) {
920
+ Se.prototype.dispose = function () { var e; _super.prototype.dispose.call(this), null === (e = this._element) || void 0 === e || e.remove(), this._element = void 0, this._pointerEventCaptureBehavior && (this._pointerEventCaptureBehavior.dispose(), this._pointerEventCaptureBehavior = null); };
921
+ Se.prototype._markAsUpdated = function () { this._requiresUpdate = !1; };
922
+ Se.prototype.setContent = function (e, t, i) { this._setAsReady(!1), this._sourceWidth = null, this._sourceHeight = null, this._element && (this._width = t, this._height = i, this._requiresUpdate = !0, this.scaling.setAll(1), e && (this._element.appendChild(this._fitStrategy.wrapElement(e)), this._updateScaleIfNecessary()), this.sourceWidth && this.sourceHeight && this._setAsReady(!0)); };
923
+ Se.prototype.setEnabled = function (e) { this._enabled = e, e && !this._ready || this._doSetEnabled(e); };
924
+ Se.prototype.setContentSizePx = function (e, t) { this._sourceWidth = e, this._sourceHeight = t, this._element && this._element.firstElementChild && (this._fitStrategy.updateSize(this._element.firstElementChild, e, t), this._updateScaleIfNecessary(), this.width && this.height && this._setAsReady(!0)); };
925
+ Se.prototype._setAsReady = function (e) { this._ready = e, e ? this._doSetEnabled(this._enabled) : this._doSetEnabled(!1); };
926
+ Se.prototype._doSetEnabled = function (e) {
927
927
  var _this = this;
928
928
  var t;
929
929
  this._element && (e && !this._worldMatrixUpdateObserver ? this._worldMatrixUpdateObserver = this.onAfterWorldMatrixUpdateObservable.add(function () { _this._requiresUpdate = !0; }) : e || (null === (t = this._worldMatrixUpdateObserver) || void 0 === t || t.remove(), this._worldMatrixUpdateObserver = null), this._element.style.display = e ? "" : "none", this._setElementzIndex(-1e4 * this.position.z), _super.prototype.setEnabled.call(this, e));
930
930
  };
931
- _e.prototype._updateScaleIfNecessary = function () { this.scaling.setAll(1), this._inverseScaleMatrix && (this.bakeTransformIntoVertices(this._inverseScaleMatrix), this._inverseScaleMatrix = null); var e = this._width || 1, i = this._height || 1, n = t.Matrix.Scaling(e, i, 1); this.bakeTransformIntoVertices(n), this._inverseScaleMatrix = new t.Matrix, n.invertToRef(this._inverseScaleMatrix); };
932
- _e.prototype._createMask = function () { t.CreatePlaneVertexData({ width: 1, height: 1 }).applyToMesh(this); var e = this.getScene(); this.checkCollisions = !0; var i = new t.StandardMaterial("".concat(this.id, "-mat"), e); this._isCanvasOverlay || (i.backFaceCulling = !1, i.disableColorWrite = !0, i.disableLighting = !0), this.material = i, this.material.freeze(); };
933
- _e.prototype._setElementzIndex = function (e) { this._element && (this._element.style.zIndex = "".concat(e)); };
934
- _e.prototype.capturePointerEvents = function () { this._element && (this._element.style.pointerEvents = "auto", document.getElementsByTagName("body")[0].style.pointerEvents = "none"); };
935
- _e.prototype.releasePointerEvents = function () { this._element && (document.getElementsByTagName("body")[0].style.pointerEvents = "auto", this._element.style.pointerEvents = "none"); };
936
- _e.prototype._createElement = function () { if ("undefined" == typeof document)
931
+ Se.prototype._updateScaleIfNecessary = function () { this.scaling.setAll(1), this._inverseScaleMatrix && (this.bakeTransformIntoVertices(this._inverseScaleMatrix), this._inverseScaleMatrix = null); var e = this._width || 1, i = this._height || 1, r = t.Matrix.Scaling(e, i, 1); this.bakeTransformIntoVertices(r), this._inverseScaleMatrix = new t.Matrix, r.invertToRef(this._inverseScaleMatrix); };
932
+ Se.prototype._createMask = function () { t.CreatePlaneVertexData({ width: 1, height: 1 }).applyToMesh(this); var e = this.getScene(); this.checkCollisions = !0; var i = new t.StandardMaterial("".concat(this.id, "-mat"), e); this._isCanvasOverlay || (i.backFaceCulling = !1, i.disableColorWrite = !0, i.disableLighting = !0), this.material = i, this.material.freeze(); };
933
+ Se.prototype._setElementzIndex = function (e) { this._element && (this._element.style.zIndex = "".concat(e)); };
934
+ Se.prototype.capturePointerEvents = function () { this._element && (this._element.style.pointerEvents = "auto", document.getElementsByTagName("body")[0].style.pointerEvents = "none"); };
935
+ Se.prototype.releasePointerEvents = function () { this._element && (document.getElementsByTagName("body")[0].style.pointerEvents = "auto", this._element.style.pointerEvents = "none"); };
936
+ Se.prototype._createElement = function () { if ("undefined" == typeof document)
937
937
  return; var e = document.createElement("div"); return e.id = this.id, e.style.backgroundColor = this._isCanvasOverlay ? "transparent" : "#000", e.style.zIndex = "1", e.style.position = "absolute", e.style.pointerEvents = "none", e.style.backfaceVisibility = "hidden", e; };
938
- return _e;
938
+ return Se;
939
939
  }(t.Mesh));
940
940
  var ye;
941
941
  !function (e) { e[e.SPACE = 32] = "SPACE", e[e.TOFU = 65532] = "TOFU"; }(ye || (ye = {}));
@@ -943,8 +943,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
943
943
  var Ae = /** @class */ (function () {
944
944
  function Ae(e, t, i) {
945
945
  this.text = e, this.fontAsset = t, this.options = Object.assign(Object.assign({}, Te), i);
946
- var _a = this.options.customLayoutEngine ? this.options.customLayoutEngine(e, this.options) : this._computeMetrics(e), n = _a.paragraph, r = _a.lines, a = _a.glyphs, s = _a.width, o = _a.height;
947
- this.paragraph = n, this.lines = r, this.glyphs = a, this.width = s, this.height = o;
946
+ var _a = this.options.customLayoutEngine ? this.options.customLayoutEngine(e, this.options) : this._computeMetrics(e), r = _a.paragraph, n = _a.lines, a = _a.glyphs, s = _a.width, o = _a.height;
947
+ this.paragraph = r, this.lines = n, this.glyphs = a, this.width = s, this.height = o;
948
948
  }
949
949
  Object.defineProperty(Ae.prototype, "lineHeight", {
950
950
  get: function () { return this.fontAsset._font.common.lineHeight * this.options.lineHeight; },
@@ -954,11 +954,11 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
954
954
  Ae.prototype._computeMetrics = function (e) {
955
955
  var e_42, _a;
956
956
  var _this = this;
957
- var t = this._collapse(e), i = this._breakLines(t).map(function (e) { return e.trim(); }), n = [];
957
+ var t = this._collapse(e), i = this._breakLines(t).map(function (e) { return e.trim(); }), r = [];
958
958
  try {
959
959
  for (var i_7 = __values(i), i_7_1 = i_7.next(); !i_7_1.done; i_7_1 = i_7.next()) {
960
960
  var e_43 = i_7_1.value;
961
- n.push.apply(n, __spreadArray([], __read(this._wrap(e_43, n.length)), false));
961
+ r.push.apply(r, __spreadArray([], __read(this._wrap(e_43, r.length)), false));
962
962
  }
963
963
  }
964
964
  catch (e_42_1) { e_42 = { error: e_42_1 }; }
@@ -968,18 +968,18 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
968
968
  }
969
969
  finally { if (e_42) throw e_42.error; }
970
970
  }
971
- var r = Math.max.apply(Math, __spreadArray([], __read(n.map(function (e) { return e.width; })), false)), a = this.lineHeight * n.length;
972
- ("left" !== this.options.textAlign || this.options.translate) && n.forEach(function (e) {
971
+ var n = Math.max.apply(Math, __spreadArray([], __read(r.map(function (e) { return e.width; })), false)), a = this.lineHeight * r.length;
972
+ ("left" !== this.options.textAlign || this.options.translate) && r.forEach(function (e) {
973
973
  var e_44, _a;
974
974
  var t = (function () { switch (_this.options.textAlign) {
975
- case "right": return r - e.width;
976
- case "center": return (r - e.width) / 2;
975
+ case "right": return n - e.width;
976
+ case "center": return (n - e.width) / 2;
977
977
  default: return 0;
978
- } })(), i = _this.options.translate ? _this.options.translate.x * r : 0, n = _this.options.translate ? _this.options.translate.y * a : 0;
978
+ } })(), i = _this.options.translate ? _this.options.translate.x * n : 0, r = _this.options.translate ? _this.options.translate.y * a : 0;
979
979
  try {
980
980
  for (var _b = __values(e.glyphs), _c = _b.next(); !_c.done; _c = _b.next()) {
981
- var r_1 = _c.value;
982
- r_1.x += t, r_1.x += i, r_1.y += n;
981
+ var n_1 = _c.value;
982
+ n_1.x += t, n_1.x += i, n_1.y += r;
983
983
  }
984
984
  }
985
985
  catch (e_44_1) { e_44 = { error: e_44_1 }; }
@@ -990,71 +990,71 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
990
990
  finally { if (e_44) throw e_44.error; }
991
991
  }
992
992
  });
993
- var s = n.flatMap(function (e) { return e.glyphs; });
994
- return { paragraph: i.join("\n"), lines: n, glyphs: s, width: r, height: a };
993
+ var s = r.flatMap(function (e) { return e.glyphs; });
994
+ return { paragraph: i.join("\n"), lines: r, glyphs: s, width: n, height: a };
995
995
  };
996
996
  Ae.prototype._breakLines = function (e) { return e.split("\n"); };
997
997
  Ae.prototype._collapse = function (e) { return e.replace(/\t/g, " ".repeat(this.options.tabSize)).replace(/ +/g, " "); };
998
998
  Ae.prototype._wrap = function (e, t) {
999
999
  if (t === void 0) { t = 0; }
1000
1000
  var i = new Array;
1001
- var n, r = t, a = new Array, s = 0, o = 0, l = 0, c = l;
1002
- var d = function () { i.push({ text: e.slice(l, c), glyphs: a, start: l, end: c, width: o }); };
1001
+ var r, n = t, a = new Array, s = 0, o = 0, l = 0, c = l;
1002
+ var u = function () { i.push({ text: e.slice(l, c), glyphs: a, start: l, end: c, width: o }); };
1003
1003
  for (; c < e.length;) {
1004
- var t_10 = c, i_8 = e.charCodeAt(t_10), h_2 = this.fontAsset._getChar(i_8), u_2 = h_2.width;
1005
- s += n ? this.fontAsset._getKerning(n.id, h_2.id) : 0;
1006
- var m_1 = s + u_2, p_1 = h_2.xadvance + this.options.letterSpacing, f_1 = s + p_1, g_1 = f_1 > this.options.maxWidth || m_1 > this.options.maxWidth;
1007
- g_1 && (d(), r++, n = void 0, s = 0, o = 0, l = c, c = l + 1, a = []);
1008
- var v_1 = s, S_1 = r * this.lineHeight;
1009
- a.push({ char: h_2, line: r, position: a.length, x: v_1, y: S_1 }), g_1 ? s = p_1 : (n = h_2, s = f_1, o = m_1, c++);
1004
+ var t_10 = c, i_8 = e.charCodeAt(t_10), h_2 = this.fontAsset._getChar(i_8), d_2 = h_2.width;
1005
+ s += r ? this.fontAsset._getKerning(r.id, h_2.id) : 0;
1006
+ var m_1 = s + d_2, p_1 = h_2.xadvance + this.options.letterSpacing, f_1 = s + p_1, g_1 = f_1 > this.options.maxWidth || m_1 > this.options.maxWidth;
1007
+ g_1 && (u(), n++, r = void 0, s = 0, o = 0, l = c, c = l + 1, a = []);
1008
+ var v_1 = s, _1 = n * this.lineHeight;
1009
+ a.push({ char: h_2, line: n, position: a.length, x: v_1, y: _1 }), g_1 ? s = p_1 : (r = h_2, s = f_1, o = m_1, c++);
1010
1010
  }
1011
- return a.length > 0 && d(), i;
1011
+ return a.length > 0 && u(), i;
1012
1012
  };
1013
1013
  return Ae;
1014
1014
  }());
1015
- var Pe = /** @class */ (function () {
1016
- function Pe(e, i, n) {
1015
+ var Le = /** @class */ (function () {
1016
+ function Le(e, i, r) {
1017
1017
  if (i === void 0) { i = 0; }
1018
- this._useVAO = !1, this._vertexBuffers = {}, this._charMatrices = new Array, this._charUvs = new Array, this._isDirty = !0, this._baseLine = 0, this._scalingMatrix = new t.ThinMatrix, this._fontScaleMatrix = new t.ThinMatrix, this._offsetMatrix = new t.ThinMatrix, this._translationMatrix = new t.ThinMatrix, this._baseMatrix = new t.ThinMatrix, this._scaledMatrix = new t.ThinMatrix, this._localMatrix = new t.ThinMatrix, this._finalMatrix = new t.ThinMatrix, this._lineMatrix = new t.ThinMatrix, this._parentWorldMatrix = new t.ThinMatrix, this.color = { r: 1, g: 1, b: 1, a: 1 }, this.strokeColor = { r: 1, g: 1, b: 1, a: 1 }, this.strokeInsetWidth = 0, this.strokeOutsetWidth = 0, this.thicknessControl = 0, this._parent = null, this._transformMatrix = new t.ThinMatrix, this.isBillboard = !1, this.isBillboardScreenProjected = !1, this.ignoreDepthBuffer = !1, this.writeToDepthBuffer = !1, this._engine = e, this._shaderLanguage = i, this._font = n, this._baseLine = n._font.common.lineHeight * n.scale, this._useVAO = e.getCaps().vertexArrayObject && !e.disableVertexArrayObjects;
1019
- var r = new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]);
1020
- this._spriteBuffer = new t.Buffer(e, r, !1, 2), this._vertexBuffers.offsets = this._spriteBuffer.createVertexBuffer("offsets", 0, 2), this._resizeBuffers(128);
1018
+ this._useVAO = !1, this._vertexBuffers = {}, this._charMatrices = new Array, this._charUvs = new Array, this._isDirty = !0, this._baseLine = 0, this._scalingMatrix = new t.ThinMatrix, this._fontScaleMatrix = new t.ThinMatrix, this._offsetMatrix = new t.ThinMatrix, this._translationMatrix = new t.ThinMatrix, this._baseMatrix = new t.ThinMatrix, this._scaledMatrix = new t.ThinMatrix, this._localMatrix = new t.ThinMatrix, this._finalMatrix = new t.ThinMatrix, this._lineMatrix = new t.ThinMatrix, this._parentWorldMatrix = new t.ThinMatrix, this.color = { r: 1, g: 1, b: 1, a: 1 }, this.strokeColor = { r: 1, g: 1, b: 1, a: 1 }, this.strokeInsetWidth = 0, this.strokeOutsetWidth = 0, this.thicknessControl = 0, this._parent = null, this._transformMatrix = new t.ThinMatrix, this.isBillboard = !1, this.isBillboardScreenProjected = !1, this.ignoreDepthBuffer = !1, this.writeToDepthBuffer = !1, this._engine = e, this._shaderLanguage = i, this._font = r, this._baseLine = r._font.common.lineHeight * r.scale, this._useVAO = e.getCaps().vertexArrayObject && !e.disableVertexArrayObjects;
1019
+ var n = new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]);
1020
+ this._spriteBuffer = new t.Buffer(e, n, !1, 2), this._vertexBuffers.offsets = this._spriteBuffer.createVertexBuffer("offsets", 0, 2), this._resizeBuffers(128);
1021
1021
  }
1022
- Object.defineProperty(Pe.prototype, "parent", {
1022
+ Object.defineProperty(Le.prototype, "parent", {
1023
1023
  get: function () { return this._parent; },
1024
1024
  set: function (e) { this._parent = e; },
1025
1025
  enumerable: false,
1026
1026
  configurable: true
1027
1027
  });
1028
- Object.defineProperty(Pe.prototype, "transformMatrix", {
1028
+ Object.defineProperty(Le.prototype, "transformMatrix", {
1029
1029
  get: function () { return this._transformMatrix; },
1030
1030
  set: function (e) { this._transformMatrix = e; },
1031
1031
  enumerable: false,
1032
1032
  configurable: true
1033
1033
  });
1034
- Object.defineProperty(Pe.prototype, "characterCount", {
1034
+ Object.defineProperty(Le.prototype, "characterCount", {
1035
1035
  get: function () { return this._charMatrices.length / 16; },
1036
1036
  enumerable: false,
1037
1037
  configurable: true
1038
1038
  });
1039
- Pe.prototype._resizeBuffers = function (e) { this._worldBuffer && (this._worldBuffer.dispose(), this._worldBuffer = null), this._uvBuffer && (this._uvBuffer.dispose(), this._uvBuffer = null), this._worldBuffer = new t.Buffer(this._engine, new Float32Array(16 * e), !0, 16), this._vertexBuffers.world0 = this._worldBuffer.createVertexBuffer("world0", 0, 4, 16, !0), this._vertexBuffers.world1 = this._worldBuffer.createVertexBuffer("world1", 4, 4, 16, !0), this._vertexBuffers.world2 = this._worldBuffer.createVertexBuffer("world2", 8, 4, 16, !0), this._vertexBuffers.world3 = this._worldBuffer.createVertexBuffer("world3", 12, 4, 16, !0), this._uvBuffer = new t.Buffer(this._engine, new Float32Array(4 * e), !0, 4), this._vertexBuffers.uvs = this._uvBuffer.createVertexBuffer("uvs", 0, 4, 4, !0); };
1040
- Pe.prototype._setShaders = function (e, i) { var n; null === (n = this._drawWrapperBase) || void 0 === n || n.dispose(), this._drawWrapperBase = new t.DrawWrapper(this._engine), this._drawWrapperBase.drawContext && (this._drawWrapperBase.drawContext.useInstancing = !0), this._drawWrapperBase.effect = this._engine.createEffect({ vertexSource: e, fragmentSource: i }, ["offsets", "world0", "world1", "world2", "world3", "uvs"], ["parentWorld", "view", "projection", "uColor", "thickness", "uStrokeColor", "uStrokeInsetWidth", "uStrokeOutsetWidth", "mode", "transform", "uDepthWrite"], ["fontAtlas"], "", void 0, void 0, void 0, void 0, this._shaderLanguage), this._drawWrapperBase.effect._refCount++; };
1041
- Pe.prototype.addParagraph = function (e, i, n) {
1039
+ Le.prototype._resizeBuffers = function (e) { this._worldBuffer && (this._worldBuffer.dispose(), this._worldBuffer = null), this._uvBuffer && (this._uvBuffer.dispose(), this._uvBuffer = null), this._worldBuffer = new t.Buffer(this._engine, new Float32Array(16 * e), !0, 16), this._vertexBuffers.world0 = this._worldBuffer.createVertexBuffer("world0", 0, 4, 16, !0), this._vertexBuffers.world1 = this._worldBuffer.createVertexBuffer("world1", 4, 4, 16, !0), this._vertexBuffers.world2 = this._worldBuffer.createVertexBuffer("world2", 8, 4, 16, !0), this._vertexBuffers.world3 = this._worldBuffer.createVertexBuffer("world3", 12, 4, 16, !0), this._uvBuffer = new t.Buffer(this._engine, new Float32Array(4 * e), !0, 4), this._vertexBuffers.uvs = this._uvBuffer.createVertexBuffer("uvs", 0, 4, 4, !0); };
1040
+ Le.prototype._setShaders = function (e, i) { var r; null === (r = this._drawWrapperBase) || void 0 === r || r.dispose(), this._drawWrapperBase = new t.DrawWrapper(this._engine), this._drawWrapperBase.drawContext && (this._drawWrapperBase.drawContext.useInstancing = !0), this._drawWrapperBase.effect = this._engine.createEffect({ vertexSource: e, fragmentSource: i }, ["offsets", "world0", "world1", "world2", "world3", "uvs"], ["parentWorld", "view", "projection", "uColor", "thickness", "uStrokeColor", "uStrokeInsetWidth", "uStrokeOutsetWidth", "mode", "transform", "uDepthWrite"], ["fontAtlas"], "", void 0, void 0, void 0, void 0, this._shaderLanguage), this._drawWrapperBase.effect._refCount++; };
1041
+ Le.prototype.addParagraph = function (e, i, r) {
1042
1042
  var _this = this;
1043
- var r = new Ae(e, this._font, i), a = this._font.scale, s = this._font._font.common.scaleW, o = this._font._font.common.scaleH, l = r.glyphs.filter(function (e) { return e.char.page >= 0; });
1044
- var c = n;
1043
+ var n = new Ae(e, this._font, i), a = this._font.scale, s = this._font._font.common.scaleW, o = this._font._font.common.scaleH, l = n.glyphs.filter(function (e) { return e.char.page >= 0; });
1044
+ var c = r;
1045
1045
  if (!c) {
1046
- var e_45 = r.lineHeight * a, i_9 = r.lines.length * e_45 / 2;
1046
+ var e_45 = n.lineHeight * a, i_9 = n.lines.length * e_45 / 2;
1047
1047
  t.TranslationMatrixToRef(0, this._baseLine - i_9, 0, this._lineMatrix), c = this._lineMatrix;
1048
1048
  }
1049
1049
  t.ScalingMatrixToRef(a, a, 1, this._fontScaleMatrix), t.TranslationMatrixToRef(.5, -.5, 0, this._offsetMatrix);
1050
- var d = this._charUvs.length, h = this._charMatrices.length;
1051
- l.forEach(function (e, i) { _this._charUvs[d + 4 * i + 0] = e.char.x / s, _this._charUvs[d + 4 * i + 1] = e.char.y / o, _this._charUvs[d + 4 * i + 2] = e.char.width / s, _this._charUvs[d + 4 * i + 3] = e.char.height / o; var n = e.x + e.char.xoffset, r = 1 - (e.y + e.char.yoffset); t.ScalingMatrixToRef(e.char.width, e.char.height, 1, _this._scalingMatrix), t.MultiplyMatricesToRef(_this._offsetMatrix, _this._scalingMatrix, _this._baseMatrix), t.TranslationMatrixToRef(n * a, r * a, 0, _this._translationMatrix), t.MultiplyMatricesToRef(_this._baseMatrix, _this._fontScaleMatrix, _this._scaledMatrix), t.MultiplyMatricesToRef(_this._scaledMatrix, _this._translationMatrix, _this._localMatrix), t.MultiplyMatricesToRef(_this._localMatrix, c, _this._finalMatrix), t.CopyMatrixToArray(_this._finalMatrix, _this._charMatrices, h + 16 * i); }), this._isDirty = !0, this._baseLine -= r.lineHeight * a * r.lines.length;
1050
+ var u = this._charUvs.length, h = this._charMatrices.length;
1051
+ l.forEach(function (e, i) { _this._charUvs[u + 4 * i + 0] = e.char.x / s, _this._charUvs[u + 4 * i + 1] = e.char.y / o, _this._charUvs[u + 4 * i + 2] = e.char.width / s, _this._charUvs[u + 4 * i + 3] = e.char.height / o; var r = e.x + e.char.xoffset, n = 1 - (e.y + e.char.yoffset); t.ScalingMatrixToRef(e.char.width, e.char.height, 1, _this._scalingMatrix), t.MultiplyMatricesToRef(_this._offsetMatrix, _this._scalingMatrix, _this._baseMatrix), t.TranslationMatrixToRef(r * a, n * a, 0, _this._translationMatrix), t.MultiplyMatricesToRef(_this._baseMatrix, _this._fontScaleMatrix, _this._scaledMatrix), t.MultiplyMatricesToRef(_this._scaledMatrix, _this._translationMatrix, _this._localMatrix), t.MultiplyMatricesToRef(_this._localMatrix, c, _this._finalMatrix), t.CopyMatrixToArray(_this._finalMatrix, _this._charMatrices, h + 16 * i); }), this._isDirty = !0, this._baseLine -= n.lineHeight * a * n.lines.length;
1052
1052
  };
1053
- Pe.prototype.clearParagraphs = function () { this._charMatrices.length = 0, this._charUvs.length = 0, this._baseLine = 0, this._isDirty = !0; };
1054
- Pe.prototype.render = function (e, i) { var n = this._drawWrapperBase, r = n.effect; if (!r.isReady())
1055
- return; var a = this._engine; a.setState(!1), a.enableEffect(n), this.ignoreDepthBuffer && a.setDepthBuffer(!1), this._parent ? t.CopyMatrixToRef(this._parent.getWorldMatrix(), this._parentWorldMatrix) : t.IdentityMatrixToRef(this._parentWorldMatrix), r.setInt("mode", this.isBillboard ? this.isBillboardScreenProjected ? 2 : 1 : 0), r.setMatrix("parentWorld", this._parentWorldMatrix), r.setMatrix("view", e), r.setMatrix("projection", i), r.setMatrix("transform", this.transformMatrix), r.setTexture("fontAtlas", this._font.textures[0]), r.setDirectColor4("uColor", this.color), r.setDirectColor4("uStrokeColor", this.strokeColor), r.setFloat("thickness", .9 * this.thicknessControl), r.setFloat("uStrokeInsetWidth", this.strokeInsetWidth), r.setFloat("uStrokeOutsetWidth", this.strokeOutsetWidth); var s = this.writeToDepthBuffer && !this.ignoreDepthBuffer; r.setFloat("uDepthWrite", s ? 1 : 0); var o = this._charMatrices.length / 16; this._isDirty && (this._isDirty = !1, this._worldBuffer.getBuffer().capacity / 4 < 16 * o && this._resizeBuffers(o), this._worldBuffer.update(this._charMatrices), this._uvBuffer.update(this._charUvs)), this._useVAO ? (this._vertexArrayObject || (this._vertexArrayObject = a.recordVertexArrayObject(this._vertexBuffers, null, r)), a.bindVertexArrayObject(this._vertexArrayObject, null)) : a.bindBuffers(this._vertexBuffers, null, r); var l = a, c = s && l.currentSampleCount > 1, d = l.getAlphaToCoverage(); c && l.setAlphaToCoverage(!0), a.setAlphaMode(c ? t.Constants.ALPHA_REPLACE_COLOR : t.Constants.ALPHA_COMBINE, s), s && a.setDepthWrite(!0), a.drawArraysType(t.Constants.MATERIAL_TriangleStripDrawMode, 0, 4, o), c && l.setAlphaToCoverage(d), a.unbindInstanceAttributes(), a.setAlphaMode(t.Constants.ALPHA_DISABLE), this.ignoreDepthBuffer && a.setDepthBuffer(!0); };
1056
- Pe.prototype.dispose = function () { this._worldBuffer && (this._worldBuffer.dispose(), this._worldBuffer = null), this._uvBuffer && (this._uvBuffer.dispose(), this._uvBuffer = null), this._spriteBuffer && (this._spriteBuffer.dispose(), this._spriteBuffer = null), this._vertexArrayObject && (this._engine.releaseVertexArrayObject(this._vertexArrayObject), this._vertexArrayObject = null); };
1057
- Pe.CreateTextRendererAsync = function (e, t) { return i(this, void 0, void 0, function () { var e_46, e_47, i, n, r, _a, a; return __generator(this, function (_b) {
1053
+ Le.prototype.clearParagraphs = function () { this._charMatrices.length = 0, this._charUvs.length = 0, this._baseLine = 0, this._isDirty = !0; };
1054
+ Le.prototype.render = function (e, i) { var r = this._drawWrapperBase, n = r.effect; if (!n.isReady())
1055
+ return; var a = this._engine; a.setState(!1), a.enableEffect(r), this.ignoreDepthBuffer && a.setDepthBuffer(!1), this._parent ? t.CopyMatrixToRef(this._parent.getWorldMatrix(), this._parentWorldMatrix) : t.IdentityMatrixToRef(this._parentWorldMatrix), n.setInt("mode", this.isBillboard ? this.isBillboardScreenProjected ? 2 : 1 : 0), n.setMatrix("parentWorld", this._parentWorldMatrix), n.setMatrix("view", e), n.setMatrix("projection", i), n.setMatrix("transform", this.transformMatrix), n.setTexture("fontAtlas", this._font.textures[0]), n.setDirectColor4("uColor", this.color), n.setDirectColor4("uStrokeColor", this.strokeColor), n.setFloat("thickness", .9 * this.thicknessControl), n.setFloat("uStrokeInsetWidth", this.strokeInsetWidth), n.setFloat("uStrokeOutsetWidth", this.strokeOutsetWidth); var s = this.writeToDepthBuffer && !this.ignoreDepthBuffer; n.setFloat("uDepthWrite", s ? 1 : 0); var o = this._charMatrices.length / 16; this._isDirty && (this._isDirty = !1, this._worldBuffer.getBuffer().capacity / 4 < 16 * o && this._resizeBuffers(o), this._worldBuffer.update(this._charMatrices), this._uvBuffer.update(this._charUvs)), this._useVAO ? (this._vertexArrayObject || (this._vertexArrayObject = a.recordVertexArrayObject(this._vertexBuffers, null, n)), a.bindVertexArrayObject(this._vertexArrayObject, null)) : a.bindBuffers(this._vertexBuffers, null, n); var l = a, c = s && l.currentSampleCount > 1, u = l.getAlphaToCoverage(); c && l.setAlphaToCoverage(!0), a.setAlphaMode(c ? t.Constants.ALPHA_REPLACE_COLOR : t.Constants.ALPHA_COMBINE, s), s && a.setDepthWrite(!0), a.drawArraysType(t.Constants.MATERIAL_TriangleStripDrawMode, 0, 4, o), c && l.setAlphaToCoverage(u), a.unbindInstanceAttributes(), a.setAlphaMode(t.Constants.ALPHA_DISABLE), this.ignoreDepthBuffer && a.setDepthBuffer(!0); };
1056
+ Le.prototype.dispose = function () { this._worldBuffer && (this._worldBuffer.dispose(), this._worldBuffer = null), this._uvBuffer && (this._uvBuffer.dispose(), this._uvBuffer = null), this._spriteBuffer && (this._spriteBuffer.dispose(), this._spriteBuffer = null), this._vertexArrayObject && (this._engine.releaseVertexArrayObject(this._vertexArrayObject), this._vertexArrayObject = null); };
1057
+ Le.CreateTextRendererAsync = function (e, t) { return i(this, void 0, void 0, function () { var e_46, e_47, i, r, n, _a, a; return __generator(this, function (_b) {
1058
1058
  switch (_b.label) {
1059
1059
  case 0:
1060
1060
  if (!t.isWebGPU) return [3 /*break*/, 2];
@@ -1071,310 +1071,729 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
1071
1071
  case 4:
1072
1072
  if (!t.getCaps().instancedArrays || !t._features.supportSpriteInstancing)
1073
1073
  throw new Error("Instanced arrays are required for MSDF text rendering.");
1074
- r = 0;
1074
+ n = 0;
1075
1075
  if (!t.isWebGPU) return [3 /*break*/, 7];
1076
- r = 1;
1076
+ n = 1;
1077
1077
  return [4 /*yield*/, Promise.resolve().then(function () { return Ne; })];
1078
1078
  case 5:
1079
1079
  i = (_b.sent()).msdfVertexShaderWGSL.shader;
1080
- return [4 /*yield*/, Promise.resolve().then(function () { return ke; })];
1080
+ return [4 /*yield*/, Promise.resolve().then(function () { return Ge; })];
1081
1081
  case 6:
1082
- _a = (n = (_b.sent()).msdfPixelShaderWGSL.shader);
1082
+ _a = (r = (_b.sent()).msdfPixelShaderWGSL.shader);
1083
1083
  return [3 /*break*/, 10];
1084
1084
  case 7: return [4 /*yield*/, Promise.resolve().then(function () { return Ce; })];
1085
1085
  case 8:
1086
1086
  i = (_b.sent()).msdfVertexShader.shader;
1087
- return [4 /*yield*/, Promise.resolve().then(function () { return Me; })];
1087
+ return [4 /*yield*/, Promise.resolve().then(function () { return we; })];
1088
1088
  case 9:
1089
- _a = (n = (_b.sent()).msdfPixelShader.shader);
1089
+ _a = (r = (_b.sent()).msdfPixelShader.shader);
1090
1090
  _b.label = 10;
1091
1091
  case 10:
1092
1092
  _a;
1093
- a = new Pe(t, r, e);
1094
- return [2 /*return*/, (a._setShaders(i, n), a)];
1093
+ a = new Le(t, n, e);
1094
+ return [2 /*return*/, (a._setShaders(i, r), a)];
1095
1095
  }
1096
1096
  }); }); };
1097
- return Pe;
1097
+ return Le;
1098
1098
  }());
1099
- var Le = "msdfVertexShader", Re = "#define BILLBOARD 1\n#define BILLBOARDSCREENPROJECTED 2\nattribute vec2 offsets;attribute vec4 world0;attribute vec4 world1;attribute vec4 world2;attribute vec4 world3;attribute vec4 uvs;uniform mat4 transform;uniform mat4 parentWorld;uniform mat4 view;uniform mat4 projection;uniform vec3 center;uniform int mode;varying vec2 atlasUV;void main(void) {mat4 world=mat4(world0,world1,world2,world3);vec4 worldPos=transform*(world*vec4(offsets.xy-vec2(0.5,0.5),0.,1.0));if (mode>=BILLBOARD) {vec3 viewPos=(view*parentWorld*vec4(0.,0.,0.,1.0)).xyz; \nif (mode==BILLBOARDSCREENPROJECTED) {viewPos.x/=viewPos.z;viewPos.y/=viewPos.z;viewPos.z=1.0;}\ngl_Position=projection*vec4(viewPos+worldPos.xyz,1.0); } else {vec3 viewPos=(view*parentWorld*worldPos).xyz; \ngl_Position=projection*vec4(viewPos,1.0); }\natlasUV=vec2(uvs.x+offsets.x*uvs.z,uvs.y+(1.0-offsets.y)*uvs.w);}";
1100
- t.ShaderStore.ShadersStore[Le] || (t.ShaderStore.ShadersStore[Le] = Re);
1101
- var Ee = { name: Le, shader: Re };
1102
- var Ce = { __proto__: null, msdfVertexShader: Ee };
1103
- var xe = "msdfPixelShader", Ie = "#extension GL_OES_standard_derivatives : enable\nprecision highp float;uniform sampler2D fontAtlas;uniform vec4 uColor;uniform vec4 uStrokeColor;uniform float uStrokeInsetWidth;uniform float uStrokeOutsetWidth;uniform float thickness;uniform float uDepthWrite;varying vec2 atlasUV;float median(vec3 msdf) {return max(min(msdf.r,msdf.g),min(max(msdf.r,msdf.g),msdf.b));}\nvoid main(void)\n{vec3 s=texture2D(fontAtlas,atlasUV).rgb;float sigDist=median(s)-0.5+thickness;float alpha=clamp(sigDist/fwidth(sigDist)+0.5,0.0,1.0);float sigDistOutset=sigDist+uStrokeOutsetWidth*0.5;float sigDistInset=sigDist-uStrokeInsetWidth*0.5;float outset=clamp(sigDistOutset/fwidth(sigDistOutset)+0.5,0.0,1.0);float inset=1.0-clamp(sigDistInset/fwidth(sigDistInset)+0.5,0.0,1.0);float border=outset*inset;if (uDepthWrite>0.5 && max(alpha,border)<=0.0) {discard;}\nvec4 filledFragColor=vec4(uColor.rgb,alpha*uColor.a);vec4 strokedFragColor=vec4(uStrokeColor.rgb,border*uStrokeColor.a);gl_FragColor=mix(filledFragColor,strokedFragColor,border);}";
1104
- t.ShaderStore.ShadersStore[xe] || (t.ShaderStore.ShadersStore[xe] = Ie);
1105
- var we = { name: xe, shader: Ie };
1106
- var Me = { __proto__: null, msdfPixelShader: we };
1107
- var be = "msdfVertexShader", De = "#define BILLBOARD 1\n#define BILLBOARDSCREENPROJECTED 2\nattribute offsets: vec2f;attribute world0: vec4f;attribute world1: vec4f;attribute world2: vec4f;attribute world3: vec4f;attribute uvs: vec4f;uniform transform: mat4x4f;uniform parentWorld: mat4x4f;uniform view: mat4x4f;uniform projection: mat4x4f;uniform mode: u32;varying atlasUV: vec2f;@vertex\nfn main(input: VertexInputs)->FragmentInputs {let world=mat4x4<f32>(input.world0,input.world1,input.world2,input.world3);let localOffset=vec4<f32>(input.offsets-vec2<f32>(0.5,0.5),0.0,1.0);let worldPos=uniforms.transform*world*localOffset;if (uniforms.mode>=BILLBOARD) { \nvar viewPos=(uniforms.view*uniforms.parentWorld*vec4f(0.,0.,0.,1.0)).xyz;if (uniforms.mode==BILLBOARDSCREENPROJECTED) {viewPos=vec3f(viewPos.x/viewPos.z,viewPos.y/viewPos.z,1.0);} \nvertexOutputs.position=uniforms.projection*vec4<f32>(viewPos+worldPos.xyz,1.0);} else { \nlet viewPos=(uniforms.view*uniforms.parentWorld*worldPos).xyz;vertexOutputs.position=uniforms.projection*vec4<f32>(viewPos,1.0);}\nvertexOutputs.atlasUV=vec2<f32>(\ninput.uvs.x+input.offsets.x*input.uvs.z,\ninput.uvs.y+(1.0-input.offsets.y)*input.uvs.w\n);}";
1108
- t.ShaderStore.ShadersStoreWGSL[be] || (t.ShaderStore.ShadersStoreWGSL[be] = De);
1109
- var Oe = { name: be, shader: De };
1110
- var Ne = { __proto__: null, msdfVertexShaderWGSL: Oe };
1111
- var Ve = "msdfPixelShader", Fe = "var fontAtlas: texture_2d<f32>;var fontAtlasSampler: sampler;uniform uColor: vec4f;uniform thickness: f32;uniform uStrokeColor: vec4f;uniform uStrokeInsetWidth: f32;uniform uStrokeOutsetWidth: f32;uniform uDepthWrite: f32;varying atlasUV: vec2f;fn median(msdf: vec3<f32>)->f32 {let a=min(msdf.r,msdf.g);let b=max(msdf.r,msdf.g);return max(a,min(b,msdf.b));}\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {let s=textureSample(fontAtlas,fontAtlasSampler,input.atlasUV).rgb;let sigDist=median(s)-0.5+uniforms.thickness;let afwidth=length(vec2<f32>(dpdx(sigDist),dpdy(sigDist)));let alpha=clamp(sigDist/afwidth+0.5,0.0,1.0);let sigDistOutset=sigDist+uniforms.uStrokeOutsetWidth*0.5;let sigDistInset=sigDist-uniforms.uStrokeInsetWidth*0.5;let afwidthOutset=length(vec2<f32>(dpdx(sigDistOutset),dpdy(sigDistOutset)));let afwidthInset=length(vec2<f32>(dpdx(sigDistInset),dpdy(sigDistInset)));let outset=clamp(sigDistOutset/afwidthOutset+0.5,0.0,1.0);let inset=1.0-clamp(sigDistInset/afwidthInset+0.5,0.0,1.0);let border=outset*inset;if (uniforms.uDepthWrite>0.5 && max(alpha,border)<=0.0) {discard;}\nlet filledFragColor=vec4<f32>(uniforms.uColor.rgb,alpha*uniforms.uColor.a);let strokedFragColor=vec4<f32>(uniforms.uStrokeColor.rgb,border*uniforms.uStrokeColor.a);fragmentOutputs.color=mix(filledFragColor,strokedFragColor,border);}";
1112
- t.ShaderStore.ShadersStoreWGSL[Ve] || (t.ShaderStore.ShadersStoreWGSL[Ve] = Fe);
1113
- var Ue = { name: Ve, shader: Fe };
1114
- var ke = { __proto__: null, msdfPixelShaderWGSL: Ue };
1115
- function Ge() { if (!ze)
1116
- throw new Error("Recast is not initialized. Please call InitRecast first."); return ze; }
1117
- var ze, Be = null;
1118
- function He(e, t, i) {
1099
+ var Pe = "msdfVertexShader", Ee = "#define BILLBOARD 1\n#define BILLBOARDSCREENPROJECTED 2\nattribute vec2 offsets;attribute vec4 world0;attribute vec4 world1;attribute vec4 world2;attribute vec4 world3;attribute vec4 uvs;uniform mat4 transform;uniform mat4 parentWorld;uniform mat4 view;uniform mat4 projection;uniform vec3 center;uniform int mode;varying vec2 atlasUV;void main(void) {mat4 world=mat4(world0,world1,world2,world3);vec4 worldPos=transform*(world*vec4(offsets.xy-vec2(0.5,0.5),0.,1.0));if (mode>=BILLBOARD) {vec3 viewPos=(view*parentWorld*vec4(0.,0.,0.,1.0)).xyz; \nif (mode==BILLBOARDSCREENPROJECTED) {viewPos.x/=viewPos.z;viewPos.y/=viewPos.z;viewPos.z=1.0;}\ngl_Position=projection*vec4(viewPos+worldPos.xyz,1.0); } else {vec3 viewPos=(view*parentWorld*worldPos).xyz; \ngl_Position=projection*vec4(viewPos,1.0); }\natlasUV=vec2(uvs.x+offsets.x*uvs.z,uvs.y+(1.0-offsets.y)*uvs.w);}";
1100
+ t.ShaderStore.ShadersStore[Pe] || (t.ShaderStore.ShadersStore[Pe] = Ee);
1101
+ var Re = { name: Pe, shader: Ee };
1102
+ var Ce = { __proto__: null, msdfVertexShader: Re };
1103
+ var xe = "msdfPixelShader", Me = "#extension GL_OES_standard_derivatives : enable\nprecision highp float;uniform sampler2D fontAtlas;uniform vec4 uColor;uniform vec4 uStrokeColor;uniform float uStrokeInsetWidth;uniform float uStrokeOutsetWidth;uniform float thickness;uniform float uDepthWrite;varying vec2 atlasUV;float median(vec3 msdf) {return max(min(msdf.r,msdf.g),min(max(msdf.r,msdf.g),msdf.b));}\nvoid main(void)\n{vec3 s=texture2D(fontAtlas,atlasUV).rgb;float sigDist=median(s)-0.5+thickness;float alpha=clamp(sigDist/fwidth(sigDist)+0.5,0.0,1.0);float sigDistOutset=sigDist+uStrokeOutsetWidth*0.5;float sigDistInset=sigDist-uStrokeInsetWidth*0.5;float outset=clamp(sigDistOutset/fwidth(sigDistOutset)+0.5,0.0,1.0);float inset=1.0-clamp(sigDistInset/fwidth(sigDistInset)+0.5,0.0,1.0);float border=outset*inset;if (uDepthWrite>0.5 && max(alpha,border)<=0.0) {discard;}\nvec4 filledFragColor=vec4(uColor.rgb,alpha*uColor.a);vec4 strokedFragColor=vec4(uStrokeColor.rgb,border*uStrokeColor.a);gl_FragColor=mix(filledFragColor,strokedFragColor,border);}";
1104
+ t.ShaderStore.ShadersStore[xe] || (t.ShaderStore.ShadersStore[xe] = Me);
1105
+ var Ie = { name: xe, shader: Me };
1106
+ var we = { __proto__: null, msdfPixelShader: Ie };
1107
+ var be = "msdfVertexShader", Oe = "#define BILLBOARD 1\n#define BILLBOARDSCREENPROJECTED 2\nattribute offsets: vec2f;attribute world0: vec4f;attribute world1: vec4f;attribute world2: vec4f;attribute world3: vec4f;attribute uvs: vec4f;uniform transform: mat4x4f;uniform parentWorld: mat4x4f;uniform view: mat4x4f;uniform projection: mat4x4f;uniform mode: u32;varying atlasUV: vec2f;@vertex\nfn main(input: VertexInputs)->FragmentInputs {let world=mat4x4<f32>(input.world0,input.world1,input.world2,input.world3);let localOffset=vec4<f32>(input.offsets-vec2<f32>(0.5,0.5),0.0,1.0);let worldPos=uniforms.transform*world*localOffset;if (uniforms.mode>=BILLBOARD) { \nvar viewPos=(uniforms.view*uniforms.parentWorld*vec4f(0.,0.,0.,1.0)).xyz;if (uniforms.mode==BILLBOARDSCREENPROJECTED) {viewPos=vec3f(viewPos.x/viewPos.z,viewPos.y/viewPos.z,1.0);} \nvertexOutputs.position=uniforms.projection*vec4<f32>(viewPos+worldPos.xyz,1.0);} else { \nlet viewPos=(uniforms.view*uniforms.parentWorld*worldPos).xyz;vertexOutputs.position=uniforms.projection*vec4<f32>(viewPos,1.0);}\nvertexOutputs.atlasUV=vec2<f32>(\ninput.uvs.x+input.offsets.x*input.uvs.z,\ninput.uvs.y+(1.0-input.offsets.y)*input.uvs.w\n);}";
1108
+ t.ShaderStore.ShadersStoreWGSL[be] || (t.ShaderStore.ShadersStoreWGSL[be] = Oe);
1109
+ var De = { name: be, shader: Oe };
1110
+ var Ne = { __proto__: null, msdfVertexShaderWGSL: De };
1111
+ var Ue = "msdfPixelShader", Fe = "var fontAtlas: texture_2d<f32>;var fontAtlasSampler: sampler;uniform uColor: vec4f;uniform thickness: f32;uniform uStrokeColor: vec4f;uniform uStrokeInsetWidth: f32;uniform uStrokeOutsetWidth: f32;uniform uDepthWrite: f32;varying atlasUV: vec2f;fn median(msdf: vec3<f32>)->f32 {let a=min(msdf.r,msdf.g);let b=max(msdf.r,msdf.g);return max(a,min(b,msdf.b));}\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {let s=textureSample(fontAtlas,fontAtlasSampler,input.atlasUV).rgb;let sigDist=median(s)-0.5+uniforms.thickness;let afwidth=length(vec2<f32>(dpdx(sigDist),dpdy(sigDist)));let alpha=clamp(sigDist/afwidth+0.5,0.0,1.0);let sigDistOutset=sigDist+uniforms.uStrokeOutsetWidth*0.5;let sigDistInset=sigDist-uniforms.uStrokeInsetWidth*0.5;let afwidthOutset=length(vec2<f32>(dpdx(sigDistOutset),dpdy(sigDistOutset)));let afwidthInset=length(vec2<f32>(dpdx(sigDistInset),dpdy(sigDistInset)));let outset=clamp(sigDistOutset/afwidthOutset+0.5,0.0,1.0);let inset=1.0-clamp(sigDistInset/afwidthInset+0.5,0.0,1.0);let border=outset*inset;if (uniforms.uDepthWrite>0.5 && max(alpha,border)<=0.0) {discard;}\nlet filledFragColor=vec4<f32>(uniforms.uColor.rgb,alpha*uniforms.uColor.a);let strokedFragColor=vec4<f32>(uniforms.uStrokeColor.rgb,border*uniforms.uStrokeColor.a);fragmentOutputs.color=mix(filledFragColor,strokedFragColor,border);}";
1112
+ t.ShaderStore.ShadersStoreWGSL[Ue] || (t.ShaderStore.ShadersStoreWGSL[Ue] = Fe);
1113
+ var Ve = { name: Ue, shader: Fe };
1114
+ var Ge = { __proto__: null, msdfPixelShaderWGSL: Ve };
1115
+ var ke = ["multiTextureCompositeAlphaBlend", "multiTextureCompositeAlphaMax", "multiTextureCompositeAdd", "multiTextureCompositeMultiply", "multiTextureCompositeSubtract", "multiTextureCompositeScreen"], ze = ["ALPHA_BLEND", "ALPHA_MAX", "ADD", "MULTIPLY", "SUBTRACT", "SCREEN"];
1116
+ var Be = !1;
1117
+ function We() { Be || (Be = !0, t.RegisterEnginesExtensionsEngineTexture2DArrayImageSource(), t.RegisterEnginesWebGPUExtensionsEngineTexture2DArrayImageSource()); }
1118
+ var He = /** @class */ (function (_super) {
1119
+ __extends(He, _super);
1120
+ function He(r, n, a, s) {
1121
+ var _this = this;
1122
+ var o, l, c, u, h, d, m, p, f, g, v, _, S;
1123
+ _this = _super.call(this, a) || this, _this.onLoadObservable = new t.Observable, _this._pollTimer = null, _this._pollInFlight = !1, _this._disposed = !1, _this._mipSuppressCount = 0, We();
1124
+ var y = !1, T = !1;
1125
+ try {
1126
+ var A_1 = a.getEngine();
1127
+ if (!A_1 || !A_1.isWebGPU && A_1.webGLVersion < 2)
1128
+ throw new Error("MultiTexture requires WebGL2 (TEXTURE_2D_ARRAY + sampler2DArray) or WebGPU. This context is WebGL1 or unavailable. Create the engine with WebGL2 enabled, e.g. new Engine(canvas, { webglVersion: 2 }).");
1129
+ if (!Number.isInteger(s.width) || s.width <= 0 || !Number.isInteger(s.height) || s.height <= 0)
1130
+ throw new Error("MultiTexture: width and height must be positive integers.");
1131
+ var L_1 = A_1.getCaps().texture2DArrayMaxLayerCount;
1132
+ if (void 0 !== s.maxLayers && (!Number.isInteger(s.maxLayers) || s.maxLayers < 1))
1133
+ throw new Error("MultiTexture: maxLayers must be a positive integer (got ".concat(s.maxLayers, ")."));
1134
+ if (void 0 === s.maxLayers && 0 === n.length)
1135
+ throw new Error("MultiTexture: urls is empty; pass options.maxLayers (positive integer, <= device limit ".concat(L_1, ") to define the array depth."));
1136
+ if (void 0 !== s.maxLayers && s.maxLayers < n.length)
1137
+ throw new Error("MultiTexture: maxLayers (".concat(s.maxLayers, ") must be >= urls.length (").concat(n.length, ")."));
1138
+ var P_1 = null !== (o = s.blendMode) && void 0 !== o ? o : e.MultiBlendMode.ALPHA_BLEND, E_1 = null !== (l = s.maxLayers) && void 0 !== l ? l : n.length;
1139
+ if (E_1 > L_1)
1140
+ throw new Error("MultiTexture: array depth ".concat(E_1, " exceeds the device limit texture2DArrayMaxLayerCount (").concat(L_1, "). Pass a smaller maxLayers (or fewer urls) or use a device with a higher limit."));
1141
+ var R_1 = Math.max(1, Math.round(s.width * (null !== (c = s.rttScale) && void 0 !== c ? c : 1))), C_1 = Math.max(1, Math.round(s.height * (null !== (u = s.rttScale) && void 0 !== u ? u : 1))), x_1 = null !== (h = s.generateMipMaps) && void 0 !== h && h, M_1 = A_1.isWebGPU ? 1 : 0, I_1 = { shaderLanguage: M_1, extraInitializationsAsync: function () { return i(_this, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
1142
+ switch (_b.label) {
1143
+ case 0:
1144
+ if (!(1 === M_1)) return [3 /*break*/, 2];
1145
+ return [4 /*yield*/, Promise.all([Promise.resolve().then(function () { return dr; }), Promise.resolve().then(function () { return fr; }), Promise.resolve().then(function () { return _r; }), Promise.resolve().then(function () { return Tr; }), Promise.resolve().then(function () { return Pr; }), Promise.resolve().then(function () { return Cr; })])];
1146
+ case 1:
1147
+ _a = _b.sent();
1148
+ return [3 /*break*/, 4];
1149
+ case 2: return [4 /*yield*/, Promise.all([Promise.resolve().then(function () { return Ir; }), Promise.resolve().then(function () { return Or; }), Promise.resolve().then(function () { return Ur; }), Promise.resolve().then(function () { return Gr; }), Promise.resolve().then(function () { return Br; }), Promise.resolve().then(function () { return qr; })])];
1150
+ case 3:
1151
+ _a = _b.sent();
1152
+ _b.label = 4;
1153
+ case 4:
1154
+ _a;
1155
+ return [2 /*return*/];
1156
+ }
1157
+ }); }); } };
1158
+ _this._compositeInternal = new t.ProceduralTexture(r, { width: R_1, height: C_1 }, ke[P_1], a, Object.assign(Object.assign({}, I_1), { skipSceneRegistration: !0 }), !1, !1, t.Constants.TEXTURETYPE_UNSIGNED_BYTE), y = !0, _this.name = r, _this.isRenderTarget = !0, _this._mtOptions = Object.assign(Object.assign({}, s), { maxLayers: E_1, blendMode: P_1, generateMipMaps: x_1, samplingMode: null !== (d = s.samplingMode) && void 0 !== d ? d : t.Texture.TRILINEAR_SAMPLINGMODE, premultiplyAlpha: null !== (m = s.premultiplyAlpha) && void 0 !== m && m, fit: null !== (p = s.fit) && void 0 !== p ? p : "resize", rttScale: null !== (f = s.rttScale) && void 0 !== f ? f : 1, watch: null !== (g = s.watch) && void 0 !== g && g, pollInterval: null !== (v = s.pollInterval) && void 0 !== v ? v : 2e3 }), _this._maxLayers = E_1, _this._deviceMaxLayerCap = L_1, _this._blendMode = P_1, _this._arrayTexture = new t.RawTexture2DArray(null, s.width, s.height, E_1, t.Constants.TEXTUREFORMAT_RGBA, a, x_1, !1, null !== (_ = s.samplingMode) && void 0 !== _ ? _ : t.Texture.TRILINEAR_SAMPLINGMODE, t.Constants.TEXTURETYPE_UNSIGNED_BYTE), _this._arrayTexture.name = "".concat(_this.name, "_2DArray"), T = !0, _this._layers = n.map(function (e) { return _this._createLayerEntry(e); }), _this._layerCount = _this._layers.length, _this.urls = n.slice(), _this.pixels = new Array(_this._layerCount).fill(null), _this.composite.defines = _this._buildDefines(ze[P_1]), _this.composite.setTexture("uLayers", _this._arrayTexture), _this.composite.setInt("uLayerCount", _this._layerCount);
1159
+ var w_1 = null;
1160
+ if ("undefined" != typeof OffscreenCanvas ? w_1 = new OffscreenCanvas(s.width, s.height) : "undefined" != typeof document && (w_1 = document.createElement("canvas"), w_1.width = s.width, w_1.height = s.height), !w_1)
1161
+ throw new Error("MultiTexture: no 2D canvas surface available (requires DOM or OffscreenCanvas).");
1162
+ _this._canvas = w_1, _this._ctx = null !== (S = w_1.getContext("2d", { willReadFrequently: !0 })) && void 0 !== S ? S : null, _this._initialize();
1163
+ }
1164
+ catch (e) {
1165
+ if (y)
1166
+ try {
1167
+ _this._compositeInternal.dispose();
1168
+ }
1169
+ catch (e) { }
1170
+ if (T)
1171
+ try {
1172
+ _this._arrayTexture.dispose();
1173
+ }
1174
+ catch (e) { }
1175
+ if (a.textures) {
1176
+ var e_48 = a.textures.indexOf(_this);
1177
+ e_48 >= 0 && (a.textures.splice(e_48, 1), a.onTextureRemovedObservable.notifyObservers(_this));
1178
+ }
1179
+ throw e;
1180
+ }
1181
+ return _this;
1182
+ }
1183
+ Object.defineProperty(He.prototype, "composite", {
1184
+ get: function () { return this._compositeInternal; },
1185
+ enumerable: false,
1186
+ configurable: true
1187
+ });
1188
+ Object.defineProperty(He.prototype, "layerCount", {
1189
+ get: function () { return this._layerCount; },
1190
+ enumerable: false,
1191
+ configurable: true
1192
+ });
1193
+ Object.defineProperty(He.prototype, "arrayTexture", {
1194
+ get: function () { return this._arrayTexture; },
1195
+ enumerable: false,
1196
+ configurable: true
1197
+ });
1198
+ He.prototype.getInternalTexture = function () { return this.composite.getInternalTexture(); };
1199
+ He.prototype.isReady = function () { return this.composite.isReady(); };
1200
+ He.prototype._renderComposite = function () {
1201
+ var _this = this;
1202
+ this.composite.isReady(), this.composite.executeWhenReady(function () { _this._disposed || _this.composite.render(); });
1203
+ };
1204
+ He.prototype.getSize = function () { return this.composite.getSize(); };
1205
+ He.prototype.getBaseSize = function () { return this.composite.getBaseSize(); };
1206
+ Object.defineProperty(He.prototype, "samplingMode", {
1207
+ get: function () { return this.composite.samplingMode; },
1208
+ enumerable: false,
1209
+ configurable: true
1210
+ });
1211
+ He.prototype.updateSamplingMode = function (e, t) {
1212
+ if (t === void 0) { t = !1; }
1213
+ this.composite.updateSamplingMode(e, t);
1214
+ };
1215
+ He.prototype.readPixels = function (e, t, i, r, n, a, s, o, l) { return this.composite.readPixels(e, t, i, r, n, a, s, o, l); };
1216
+ He.prototype._readPixelsSync = function (e, t, i, r, n) { return this.composite._readPixelsSync(e, t, i, r, n); };
1217
+ Object.defineProperty(He.prototype, "textureFormat", {
1218
+ get: function () { return this.composite.textureFormat; },
1219
+ enumerable: false,
1220
+ configurable: true
1221
+ });
1222
+ Object.defineProperty(He.prototype, "textureType", {
1223
+ get: function () { return this.composite.textureType; },
1224
+ enumerable: false,
1225
+ configurable: true
1226
+ });
1227
+ Object.defineProperty(He.prototype, "blendMode", {
1228
+ get: function () { return this._blendMode; },
1229
+ set: function (e) { e !== this._blendMode && (this._blendMode = e, this.composite.setFragment(ke[e]), this.composite.defines = this._buildDefines(ze[e]), this._renderComposite()); },
1230
+ enumerable: false,
1231
+ configurable: true
1232
+ });
1233
+ He.prototype.updateLayerAsync = function (e, t) { return i(this, void 0, void 0, function () { var i; return __generator(this, function (_a) {
1234
+ switch (_a.label) {
1235
+ case 0:
1236
+ if (!Number.isInteger(e) || e < 0 || e >= this._layerCount)
1237
+ throw new RangeError("MultiTexture: layer index ".concat(e, " out of range [0, ").concat(this._layerCount, ")."));
1238
+ i = this._layers[e];
1239
+ i.url = t, i.etag = null, i.lastModified = null, i.warnedLoadFailure = !1, this.urls[e] = t;
1240
+ return [4 /*yield*/, this._loadEntryOrThrow(i)];
1241
+ case 1:
1242
+ _a.sent();
1243
+ return [2 /*return*/];
1244
+ }
1245
+ }); }); };
1246
+ He.prototype.addLayerAsync = function (e) { return i(this, void 0, void 0, function () { var t, i; return __generator(this, function (_a) {
1247
+ switch (_a.label) {
1248
+ case 0:
1249
+ t = this._layerCount;
1250
+ this._suppressArrayMips();
1251
+ try {
1252
+ t >= this._maxLayers && this._growArray(), i = this._pushLayerEntry(e), this.composite.setInt("uLayerCount", this._layerCount);
1253
+ }
1254
+ catch (e) {
1255
+ throw this._generateArrayMips(), this._reportError(e), e;
1256
+ }
1257
+ _a.label = 1;
1258
+ case 1:
1259
+ _a.trys.push([1, , 3, 4]);
1260
+ return [4 /*yield*/, this._loadEntryOrThrow(i)];
1261
+ case 2:
1262
+ _a.sent();
1263
+ return [3 /*break*/, 4];
1264
+ case 3:
1265
+ this._generateArrayMips();
1266
+ return [7 /*endfinally*/];
1267
+ case 4: return [2 /*return*/, t];
1268
+ }
1269
+ }); }); };
1270
+ He.prototype.insertLayerAsync = function (e, t) { return i(this, void 0, void 0, function () { var i, t_11; return __generator(this, function (_a) {
1271
+ switch (_a.label) {
1272
+ case 0:
1273
+ if (!Number.isInteger(e) || e < 0 || e > this._layerCount)
1274
+ throw new RangeError("MultiTexture: layer index ".concat(e, " out of range [0, ").concat(this._layerCount, "]."));
1275
+ this._suppressArrayMips();
1276
+ try {
1277
+ this._layerCount + 1 > this._maxLayers && this._growArray(), i = this._createLayerEntry(t), this._layers.splice(e, 0, i), this.pixels.splice(e, 0, null), this.urls.splice(e, 0, t), this._layerCount++;
1278
+ for (t_11 = this._layerCount - 1; t_11 > e; t_11--)
1279
+ this._reuploadSlot(t_11);
1280
+ this.composite.setInt("uLayerCount", this._layerCount), this._renderComposite();
1281
+ }
1282
+ catch (e) {
1283
+ throw this._generateArrayMips(), this._reportError(e), e;
1284
+ }
1285
+ _a.label = 1;
1286
+ case 1:
1287
+ _a.trys.push([1, , 3, 4]);
1288
+ return [4 /*yield*/, this._loadEntryOrThrow(i)];
1289
+ case 2:
1290
+ _a.sent();
1291
+ return [3 /*break*/, 4];
1292
+ case 3:
1293
+ this._generateArrayMips();
1294
+ return [7 /*endfinally*/];
1295
+ case 4: return [2 /*return*/, e];
1296
+ }
1297
+ }); }); };
1298
+ He.prototype.removeLayerAsync = function (e) { return i(this, void 0, void 0, function () { var t, t_12; return __generator(this, function (_a) {
1299
+ if (!Number.isInteger(e) || e < 0 || e >= this._layerCount)
1300
+ throw new RangeError("MultiTexture: layer index ".concat(e, " out of range [0, ").concat(this._layerCount, ")."));
1301
+ t = this._layers.splice(e, 1)[0];
1302
+ this.pixels.splice(e, 1), this.urls.splice(e, 1), t.bitmap && t.bitmap.close(), this._layerCount--, this._suppressArrayMips();
1303
+ try {
1304
+ for (t_12 = e; t_12 < this._layerCount; t_12++)
1305
+ this._reuploadSlot(t_12);
1306
+ this._clearLayerSlot(this._arrayTexture, this._layerCount), this.composite.setInt("uLayerCount", this._layerCount), this._renderComposite();
1307
+ }
1308
+ finally {
1309
+ this._generateArrayMips();
1310
+ }
1311
+ return [2 /*return*/];
1312
+ }); }); };
1313
+ He.prototype.dispose = function () { if (!this._disposed) {
1314
+ this._disposed = !0, null !== this._pollTimer && (clearInterval(this._pollTimer), this._pollTimer = null);
1315
+ for (var e_49 = 0; e_49 < this._layers.length; e_49++) {
1316
+ var t_13 = this._layers[e_49];
1317
+ t_13.bitmap && (t_13.bitmap.close(), t_13.bitmap = null);
1318
+ }
1319
+ for (var e_50 = 0; e_50 < this.pixels.length; e_50++)
1320
+ this.pixels[e_50] = null;
1321
+ this._layers.length = 0, this._canvas = null, this._ctx = null, this._arrayTexture.dispose(), this.composite.dispose(), _super.prototype.dispose.call(this);
1322
+ } };
1323
+ He.prototype.clone = function () { var e = new He(this.name, this.urls.slice(), this.getScene(), { width: this._mtOptions.width, height: this._mtOptions.height, maxLayers: this._maxLayers, blendMode: this._blendMode, generateMipMaps: this._mtOptions.generateMipMaps, samplingMode: this._mtOptions.samplingMode, premultiplyAlpha: this._mtOptions.premultiplyAlpha, fit: this._mtOptions.fit, rttScale: this._mtOptions.rttScale, watch: this._mtOptions.watch, pollInterval: this._mtOptions.pollInterval }); return e.hasAlpha = this.hasAlpha, e.level = this.level, e.coordinatesMode = this.coordinatesMode, e; };
1324
+ He.prototype.serialize = function (e) {
1325
+ if (e === void 0) { e = !1; }
1326
+ throw new Error("MultiTexture: serialize() is not supported. The scene loader has no MultiTexture parser (urls, capacity, blend mode and watch options cannot round-trip). Use clone() for an in-memory copy, or persist your urls/options to rebuild it.");
1327
+ };
1328
+ He.prototype._buildDefines = function (e) { return "#define MULTITEXTURE_MAXLAYERS " + this._deviceMaxLayerCap + "\n#define MULTITEXTURE_WIDTH " + this._mtOptions.width + "\n#define MULTITEXTURE_HEIGHT " + this._mtOptions.height + "\n#define MULTITEXTURE_BLEND_" + e + (this._mtOptions.premultiplyAlpha ? "\n#define MULTITEXTURE_PREMULTIPLY" : ""); };
1329
+ He.prototype._bitmapOptions = function () { var e = { premultiplyAlpha: this._mtOptions.premultiplyAlpha ? "premultiply" : "none" }; return "resize" === this._mtOptions.fit && this._mtOptions.premultiplyAlpha && (e.resizeWidth = this._mtOptions.width, e.resizeHeight = this._mtOptions.height, e.resizeQuality = "high"), e; };
1330
+ He.prototype._reportError = function (e) { var i, r, n; var a = String(null !== (i = null == e ? void 0 : e.message) && void 0 !== i ? i : e); t.Logger.Error(a), null === (n = (r = this._mtOptions).onError) || void 0 === n || n.call(r, a, e); };
1331
+ He.prototype._createLayerEntry = function (e) { return { url: e, etag: null, lastModified: null, bitmap: null, loaded: !1, generation: 0, warnedLoadFailure: !1 }; };
1332
+ He.prototype._loadEntryOrThrow = function (e) { return i(this, void 0, void 0, function () { var e_51; return __generator(this, function (_a) {
1333
+ switch (_a.label) {
1334
+ case 0:
1335
+ _a.trys.push([0, 2, , 3]);
1336
+ return [4 /*yield*/, this._loadEntry(e)];
1337
+ case 1:
1338
+ _a.sent();
1339
+ return [3 /*break*/, 3];
1340
+ case 2:
1341
+ e_51 = _a.sent();
1342
+ throw this._reportError(e_51), e_51;
1343
+ case 3: return [2 /*return*/];
1344
+ }
1345
+ }); }); };
1346
+ He.prototype._loadEntryAndReport = function (e) { return i(this, void 0, void 0, function () { var e_52; return __generator(this, function (_a) {
1347
+ switch (_a.label) {
1348
+ case 0:
1349
+ _a.trys.push([0, 2, , 3]);
1350
+ return [4 /*yield*/, this._loadEntry(e)];
1351
+ case 1:
1352
+ _a.sent();
1353
+ return [3 /*break*/, 3];
1354
+ case 2:
1355
+ e_52 = _a.sent();
1356
+ this._reportError(e_52);
1357
+ return [3 /*break*/, 3];
1358
+ case 3: return [2 /*return*/];
1359
+ }
1360
+ }); }); };
1361
+ He.prototype._warnWatchFailure = function (e, i) { var r, n; if (e.warnedLoadFailure)
1362
+ return; var a = this._layers.indexOf(e); if (-1 === a)
1363
+ return; e.warnedLoadFailure = !0; var s = "MultiTexture: watched layer ".concat(a, " (").concat(e.url, ") ").concat(i); t.Logger.Error(s), null === (n = (r = this._mtOptions).onError) || void 0 === n || n.call(r, s); };
1364
+ He.prototype._uploadToLayer = function (e, i, r) { if (this._mtOptions.premultiplyAlpha)
1365
+ return void t.UploadImageToTexture2DArrayLayer(e, r, i, { premultiplyAlpha: !0 }); var n = this._canvas, a = this._ctx; n && a && (r.width !== this._mtOptions.width || r.height !== this._mtOptions.height) ? (a.clearRect(0, 0, this._mtOptions.width, this._mtOptions.height), a.drawImage(r, 0, 0, this._mtOptions.width, this._mtOptions.height), t.UploadImageToTexture2DArrayLayer(e, n, i, { premultiplyAlpha: !1 })) : t.UploadImageToTexture2DArrayLayer(e, r, i, { premultiplyAlpha: !1 }); };
1366
+ He.prototype._reuploadSlot = function (e, t) {
1367
+ if (t === void 0) { t = this._arrayTexture; }
1368
+ var i = this._layers[e].bitmap;
1369
+ null !== i ? this._uploadToLayer(t, e, i) : this._clearLayerSlot(t, e);
1370
+ };
1371
+ He.prototype._clearLayerSlot = function (e, i) { this._canvas && this._ctx && (this._ctx.clearRect(0, 0, this._mtOptions.width, this._mtOptions.height), t.UploadImageToTexture2DArrayLayer(e, this._canvas, i, { premultiplyAlpha: !1 })); };
1372
+ He.prototype._loadEntry = function (e) { return i(this, void 0, void 0, function () { var t, i, r, n, a, s, o, t_14, r_6, n_2; return __generator(this, function (_a) {
1373
+ switch (_a.label) {
1374
+ case 0:
1375
+ if (this._disposed)
1376
+ return [2 /*return*/];
1377
+ t = ++e.generation, i = e.url;
1378
+ return [4 /*yield*/, fetch(i)];
1379
+ case 1:
1380
+ r = _a.sent();
1381
+ if (!r.ok)
1382
+ throw new Error("MultiTexture: failed to fetch ".concat(i, ": ").concat(r.status, " ").concat(r.statusText));
1383
+ n = r.headers.get("etag"), a = r.headers.get("last-modified");
1384
+ return [4 /*yield*/, r.blob()];
1385
+ case 2:
1386
+ s = _a.sent();
1387
+ return [4 /*yield*/, createImageBitmap(s, this._bitmapOptions())];
1388
+ case 3:
1389
+ o = _a.sent();
1390
+ if ("strict" === this._mtOptions.fit) {
1391
+ t_14 = o.width, r_6 = o.height;
1392
+ if (t_14 !== this._mtOptions.width || r_6 !== this._mtOptions.height) {
1393
+ o.close();
1394
+ n_2 = this._layers.indexOf(e);
1395
+ throw new Error("MultiTexture: layer ".concat(n_2, " (").concat(i, ") is ").concat(t_14, "x").concat(r_6, ", expected ").concat(this._mtOptions.width, "x").concat(this._mtOptions.height, ". Use fit: \"resize\" to auto-scale."));
1396
+ }
1397
+ }
1398
+ this._uploadBitmap(e, o, { etag: n, lastModified: a, generation: t });
1399
+ return [2 /*return*/];
1400
+ }
1401
+ }); }); };
1402
+ He.prototype._uploadBitmap = function (e, t, i) { if (this._disposed)
1403
+ return void t.close(); var r = this._layers.indexOf(e); -1 !== r && e.generation === i.generation ? (this._uploadToLayer(this._arrayTexture, r, t), this._canvas && this._ctx ? (this._ctx.clearRect(0, 0, this._mtOptions.width, this._mtOptions.height), this._ctx.drawImage(t, 0, 0, this._mtOptions.width, this._mtOptions.height), this.pixels[r] = this._ctx.getImageData(0, 0, this._mtOptions.width, this._mtOptions.height).data.slice()) : this.pixels[r] = null, null !== e.bitmap && e.bitmap.close(), e.bitmap = t, e.loaded = !0, e.etag = i.etag, e.lastModified = i.lastModified, e.warnedLoadFailure = !1, this._renderComposite()) : t.close(); };
1404
+ He.prototype._initialize = function () { return i(this, void 0, void 0, function () {
1405
+ var e, t, r_7, n_3, a_3, s_1, o_1, e_54, e_53;
1406
+ var _this = this;
1407
+ return __generator(this, function (_a) {
1408
+ switch (_a.label) {
1409
+ case 0:
1410
+ _a.trys.push([0, 2, 3, 4]);
1411
+ if (this._disposed)
1412
+ return [2 /*return*/];
1413
+ this._suppressArrayMips();
1414
+ r_7 = this._layers.slice();
1415
+ n_3 = 0;
1416
+ a_3 = r_7.length, s_1 = function () { return i(_this, void 0, void 0, function () { var e; return __generator(this, function (_a) {
1417
+ switch (_a.label) {
1418
+ case 0:
1419
+ if (!((e = n_3++) < a_3)) return [3 /*break*/, 3];
1420
+ return [4 /*yield*/, this._loadEntryAndReport(r_7[e])];
1421
+ case 1:
1422
+ _a.sent();
1423
+ _a.label = 2;
1424
+ case 2: return [3 /*break*/, 0];
1425
+ case 3: return [2 /*return*/];
1426
+ }
1427
+ }); }); }, o_1 = [];
1428
+ for (e_54 = 0; e_54 < 4; e_54++)
1429
+ o_1.push(s_1());
1430
+ return [4 /*yield*/, Promise.all(o_1)];
1431
+ case 1:
1432
+ _a.sent(), this._disposed || (this.onLoadObservable.notifyObservers(this), null === (t = (e = this._mtOptions).onLoad) || void 0 === t || t.call(e), this._renderComposite()), this._mtOptions.watch && this._startPolling();
1433
+ return [3 /*break*/, 4];
1434
+ case 2:
1435
+ e_53 = _a.sent();
1436
+ this._reportError(e_53);
1437
+ return [3 /*break*/, 4];
1438
+ case 3:
1439
+ this._generateArrayMips();
1440
+ return [7 /*endfinally*/];
1441
+ case 4: return [2 /*return*/];
1442
+ }
1443
+ });
1444
+ }); };
1445
+ He.prototype._pushLayerEntry = function (e) { var t = this._createLayerEntry(e); return this._layers.push(t), this.pixels.push(null), this.urls.push(e), this._layerCount++, t; };
1446
+ He.prototype._growArray = function () { var e, i, r; var n = this.getScene(), a = 2 * this._maxLayers; if (a > this._deviceMaxLayerCap)
1447
+ throw new RangeError("MultiTexture: cannot grow the array from depth ".concat(this._maxLayers, " to ").concat(a, ": the device limit texture2DArrayMaxLayerCount is ").concat(this._deviceMaxLayerCap, ". Remove a layer, or recreate the MultiTexture with a larger options.maxLayers (<= ").concat(this._deviceMaxLayerCap, ") to allow more growth headroom.")); var s = new t.RawTexture2DArray(null, this._mtOptions.width, this._mtOptions.height, a, t.Constants.TEXTUREFORMAT_RGBA, n, null !== (e = this._mtOptions.generateMipMaps) && void 0 !== e && e, !1, null !== (i = this._mtOptions.samplingMode) && void 0 !== i ? i : t.Texture.TRILINEAR_SAMPLINGMODE, t.Constants.TEXTURETYPE_UNSIGNED_BYTE), o = s.getInternalTexture(); null !== (r = this._mtOptions.generateMipMaps) && void 0 !== r && r && o && (o.generateMipMaps = !1); for (var e_55 = 0; e_55 < this._layerCount; e_55++)
1448
+ this._reuploadSlot(e_55, s); this._arrayTexture.dispose(), this._arrayTexture = s, this.composite.setTexture("uLayers", s), this._maxLayers = a, this._renderComposite(); };
1449
+ He.prototype._suppressArrayMips = function () { var e; if (null === (e = this._mtOptions.generateMipMaps) || void 0 === e || !e || this._disposed)
1450
+ return; var t = this._arrayTexture.getInternalTexture(); t && (t.generateMipMaps = !1), this._mipSuppressCount++; };
1451
+ He.prototype._generateArrayMips = function () { var e; if (this._mipSuppressCount > 0 && this._mipSuppressCount--, this._mipSuppressCount > 0 || null === (e = this._mtOptions.generateMipMaps) || void 0 === e || !e || this._disposed)
1452
+ return; var t = this._arrayTexture.getInternalTexture(); t && (t.generateMipMaps = !0, this.getScene().getEngine().generateMipmaps(t)); };
1453
+ He.prototype._startPolling = function () {
1454
+ var _this = this;
1455
+ null !== this._pollTimer || this._disposed || (this._pollTimer = setInterval(function () { _this._poll(); }, this._mtOptions.pollInterval));
1456
+ };
1457
+ He.prototype._poll = function () { return i(this, void 0, void 0, function () {
1458
+ var e, t, r, n, a, e_56;
1459
+ var _this = this;
1460
+ return __generator(this, function (_a) {
1461
+ switch (_a.label) {
1462
+ case 0:
1463
+ if (this._pollInFlight)
1464
+ return [2 /*return*/];
1465
+ if (this._pollInFlight = !0, this._disposed)
1466
+ return [2 /*return*/, void (this._pollInFlight = !1)];
1467
+ if ("undefined" != typeof document && "hidden" === document.visibilityState)
1468
+ return [2 /*return*/, void (this._pollInFlight = !1)];
1469
+ e = this._layers.slice();
1470
+ t = 0;
1471
+ r = e.length, n = function () { return i(_this, void 0, void 0, function () { var i, n, t_15, e_57, e_59, r_8, n_4, _a, e_58; return __generator(this, function (_b) {
1472
+ switch (_b.label) {
1473
+ case 0:
1474
+ if (!((n = t++) < r)) return [3 /*break*/, 12];
1475
+ t_15 = e[n];
1476
+ _b.label = 1;
1477
+ case 1:
1478
+ _b.trys.push([1, 10, , 11]);
1479
+ if (!(null === t_15.etag && null === t_15.lastModified)) return [3 /*break*/, 6];
1480
+ _b.label = 2;
1481
+ case 2:
1482
+ _b.trys.push([2, 4, , 5]);
1483
+ return [4 /*yield*/, this._loadEntry(t_15)];
1484
+ case 3:
1485
+ _b.sent();
1486
+ return [3 /*break*/, 5];
1487
+ case 4:
1488
+ e_57 = _b.sent();
1489
+ this._warnWatchFailure(t_15, "failed to load: ".concat(String(null !== (i = null == e_57 ? void 0 : e_57.message) && void 0 !== i ? i : e_57)));
1490
+ return [3 /*break*/, 5];
1491
+ case 5: return [3 /*break*/, 11];
1492
+ case 6: return [4 /*yield*/, fetch(t_15.url, { method: "HEAD" })];
1493
+ case 7:
1494
+ e_59 = _b.sent();
1495
+ if (404 === e_59.status) {
1496
+ this._warnWatchFailure(t_15, "returned 404.");
1497
+ return [3 /*break*/, 11];
1498
+ }
1499
+ if (!e_59.ok)
1500
+ return [3 /*break*/, 11];
1501
+ r_8 = e_59.headers.get("etag"), n_4 = e_59.headers.get("last-modified");
1502
+ if (null === r_8 && null === n_4)
1503
+ return [3 /*break*/, 11];
1504
+ _a = (null !== r_8 && r_8 !== t_15.etag || null !== n_4 && n_4 !== t_15.lastModified);
1505
+ if (!_a) return [3 /*break*/, 9];
1506
+ return [4 /*yield*/, this._loadEntryAndReport(t_15)];
1507
+ case 8:
1508
+ _a = (_b.sent());
1509
+ _b.label = 9;
1510
+ case 9:
1511
+ _a;
1512
+ return [3 /*break*/, 11];
1513
+ case 10:
1514
+ e_58 = _b.sent();
1515
+ return [3 /*break*/, 11];
1516
+ case 11: return [3 /*break*/, 0];
1517
+ case 12: return [2 /*return*/];
1518
+ }
1519
+ }); }); }, a = [];
1520
+ for (e_56 = 0; e_56 < 4; e_56++)
1521
+ a.push(n());
1522
+ return [4 /*yield*/, Promise.all(a)];
1523
+ case 1:
1524
+ _a.sent(), this._pollInFlight = !1;
1525
+ return [2 /*return*/];
1526
+ }
1527
+ });
1528
+ }); };
1529
+ return He;
1530
+ }(t.BaseTexture));
1531
+ var qe;
1532
+ function Ze() { if (!$e)
1533
+ throw new Error("Recast is not initialized. Please call InitRecast first."); return $e; }
1534
+ var $e;
1535
+ e.MultiBlendMode = void 0, (qe = e.MultiBlendMode || (e.MultiBlendMode = {}))[qe.ALPHA_BLEND = 0] = "ALPHA_BLEND", qe[qe.ALPHA_MAX = 1] = "ALPHA_MAX", qe[qe.ADD = 2] = "ADD", qe[qe.MULTIPLY = 3] = "MULTIPLY", qe[qe.SUBTRACT = 4] = "SUBTRACT", qe[qe.SCREEN = 5] = "SCREEN";
1536
+ var Ye = null;
1537
+ function je(e, t, i) {
1119
1538
  if (e === void 0) { e = []; }
1120
1539
  if (t === void 0) { t = 0; }
1121
1540
  if (i === void 0) { i = 1; }
1122
- return new (Ge().TileCacheMeshProcess)(function (n, r, a) { for (var e_48 = 0; e_48 < n.polyCount(); ++e_48)
1123
- r.set(e_48, t), a.set(e_48, i); e.length > 0 && n.setOffMeshConnections(e); });
1541
+ return new (Ze().TileCacheMeshProcess)(function (r, n, a) { for (var e_60 = 0; e_60 < r.polyCount(); ++e_60)
1542
+ n.set(e_60, t), a.set(e_60, i); e.length > 0 && r.setOffMeshConnections(e); });
1124
1543
  }
1125
- function We(e, t) { var i = !1; for (; !i;)
1544
+ function Xe(e, t) { var i = !1; for (; !i;)
1126
1545
  i = t.update(e).upToDate; }
1127
- function qe(e) { return $e(e); }
1128
- function Ze(e) { var t; return Object.assign(Object.assign({}, qe(e)), { tileSize: null !== (t = e.tileSize) && void 0 !== t ? t : 32 }); }
1129
- function Ye(e) { var i, n; var r = Object.assign(Object.assign({}, Ze(e)), { expectedLayersPerTile: null !== (i = e.expectedLayersPerTile) && void 0 !== i ? i : 1, maxObstacles: null !== (n = e.maxObstacles) && void 0 !== n ? n : 128 }); return e.tileCacheMeshProcess ? r.tileCacheMeshProcess = e.tileCacheMeshProcess : e.offMeshConnections && (t.Logger.Warn("offMeshConnections are required but no tileCacheMeshProcess is set. Using fallback DefaultTileCacheMeshProcess."), r.tileCacheMeshProcess = He(e.offMeshConnections)), r; }
1130
- function $e(e) { return Object.fromEntries(Object.entries(e).filter(function (_a) {
1546
+ function Qe(e) { return et(e); }
1547
+ function Ke(e) { var t; return Object.assign(Object.assign({}, Qe(e)), { tileSize: null !== (t = e.tileSize) && void 0 !== t ? t : 32 }); }
1548
+ function Je(e) { var i, r; var n = Object.assign(Object.assign({}, Ke(e)), { expectedLayersPerTile: null !== (i = e.expectedLayersPerTile) && void 0 !== i ? i : 1, maxObstacles: null !== (r = e.maxObstacles) && void 0 !== r ? r : 128 }); return e.tileCacheMeshProcess ? n.tileCacheMeshProcess = e.tileCacheMeshProcess : e.offMeshConnections && (t.Logger.Warn("offMeshConnections are required but no tileCacheMeshProcess is set. Using fallback DefaultTileCacheMeshProcess."), n.tileCacheMeshProcess = je(e.offMeshConnections)), n; }
1549
+ function et(e) { return Object.fromEntries(Object.entries(e).filter(function (_a) {
1131
1550
  var _b = __read(_a, 2), e = _b[0], t = _b[1];
1132
1551
  return void 0 !== t;
1133
1552
  })); }
1134
- function je(e) { return Object.fromEntries(Object.entries(e).filter(function (_a) {
1553
+ function tt(e) { return Object.fromEntries(Object.entries(e).filter(function (_a) {
1135
1554
  var _b = __read(_a, 2), e = _b[0], t = _b[1];
1136
1555
  return void 0 !== t;
1137
1556
  })); }
1138
- var Qe = /** @class */ (function () {
1139
- function Qe(e, i, n, r) {
1557
+ var it = /** @class */ (function () {
1558
+ function it(e, i, r, n) {
1140
1559
  var _this = this;
1141
1560
  if (this._transforms = [], this._agents = [], this._reachRadii = [], this._agentDestinationArmed = new Array, this._agentDestination = new Array, this._onBeforeAnimationsObserver = null, this.onReachTargetObservable = new t.Observable, this._navigationPlugin = e, !e.navMesh)
1142
1561
  throw new Error("There is no NavMesh generated.");
1143
- this._recastCrowd = new (Ge().Crowd)(e.navMesh, { maxAgents: i, maxAgentRadius: n }), this._scene = r, this._engine = r.getEngine(), this._onBeforeAnimationsObserver = r.onBeforeAnimationsObservable.add(function () { _this.update(.001 * _this._engine.getDeltaTime() * e.timeFactor); });
1562
+ this._recastCrowd = new (Ze().Crowd)(e.navMesh, { maxAgents: i, maxAgentRadius: r }), this._scene = n, this._engine = n.getEngine(), this._onBeforeAnimationsObserver = n.onBeforeAnimationsObservable.add(function () { _this.update(.001 * _this._engine.getDeltaTime() * e.timeFactor); });
1144
1563
  }
1145
- Object.defineProperty(Qe.prototype, "navigationPlugin", {
1564
+ Object.defineProperty(it.prototype, "navigationPlugin", {
1146
1565
  get: function () { return this._navigationPlugin; },
1147
1566
  enumerable: false,
1148
1567
  configurable: true
1149
1568
  });
1150
- Object.defineProperty(Qe.prototype, "recastCrowd", {
1569
+ Object.defineProperty(it.prototype, "recastCrowd", {
1151
1570
  get: function () { return this._recastCrowd; },
1152
1571
  enumerable: false,
1153
1572
  configurable: true
1154
1573
  });
1155
- Object.defineProperty(Qe.prototype, "transforms", {
1574
+ Object.defineProperty(it.prototype, "transforms", {
1156
1575
  get: function () { return this._transforms; },
1157
1576
  enumerable: false,
1158
1577
  configurable: true
1159
1578
  });
1160
- Object.defineProperty(Qe.prototype, "agents", {
1579
+ Object.defineProperty(it.prototype, "agents", {
1161
1580
  get: function () { return Object.freeze(this._agents); },
1162
1581
  enumerable: false,
1163
1582
  configurable: true
1164
1583
  });
1165
- Object.defineProperty(Qe.prototype, "reachRadii", {
1584
+ Object.defineProperty(it.prototype, "reachRadii", {
1166
1585
  get: function () { return Object.freeze(this._reachRadii); },
1167
1586
  enumerable: false,
1168
1587
  configurable: true
1169
1588
  });
1170
- Qe.prototype.addAgent = function (e, i, n) { var r = je(i), a = this._recastCrowd.addAgent({ x: e.x, y: e.y, z: e.z }, r); return this._transforms.push(n), this._agents.push(a.agentIndex), this._reachRadii.push(i.reachRadius ? i.reachRadius : i.radius), this._agentDestinationArmed.push(!1), this._agentDestination.push(new t.Vector3(0, 0, 0)), a.agentIndex; };
1171
- Qe.prototype.getAgentPosition = function (e) { var i, n; var r = null !== (n = null === (i = this._recastCrowd.getAgent(e)) || void 0 === i ? void 0 : i.position()) && void 0 !== n ? n : t.Vector3.ZeroReadOnly; return new t.Vector3(r.x, r.y, r.z); };
1172
- Qe.prototype.getAgentPositionToRef = function (e, i) { var n, r; var a = null !== (r = null === (n = this._recastCrowd.getAgent(e)) || void 0 === n ? void 0 : n.position()) && void 0 !== r ? r : t.Vector3.ZeroReadOnly; i.set(a.x, a.y, a.z); };
1173
- Qe.prototype.getAgentVelocity = function (e) { var i, n; var r = null !== (n = null === (i = this._recastCrowd.getAgent(e)) || void 0 === i ? void 0 : i.velocity()) && void 0 !== n ? n : t.Vector3.ZeroReadOnly; return new t.Vector3(r.x, r.y, r.z); };
1174
- Qe.prototype.getAgentVelocityToRef = function (e, i) { var n, r; var a = null !== (r = null === (n = this._recastCrowd.getAgent(e)) || void 0 === n ? void 0 : n.velocity()) && void 0 !== r ? r : t.Vector3.ZeroReadOnly; i.set(a.x, a.y, a.z); };
1175
- Qe.prototype.getAgentNextTargetPath = function (e) { var i, n; var r = null !== (n = null === (i = this._recastCrowd.getAgent(e)) || void 0 === i ? void 0 : i.nextTargetInPath()) && void 0 !== n ? n : t.Vector3.ZeroReadOnly; return new t.Vector3(r.x, r.y, r.z); };
1176
- Qe.prototype.getAgentNextTargetPathToRef = function (e, i) { var n, r; var a = null !== (r = null === (n = this._recastCrowd.getAgent(e)) || void 0 === n ? void 0 : n.nextTargetInPath()) && void 0 !== r ? r : t.Vector3.ZeroReadOnly; i.set(a.x, a.y, a.z); };
1177
- Qe.prototype.getAgentState = function (e) { var t, i; return null !== (i = null === (t = this._recastCrowd.getAgent(e)) || void 0 === t ? void 0 : t.state()) && void 0 !== i ? i : 0; };
1178
- Qe.prototype.overOffmeshConnection = function (e) { var t, i; return null !== (i = null === (t = this._recastCrowd.getAgent(e)) || void 0 === t ? void 0 : t.overOffMeshConnection()) && void 0 !== i && i; };
1179
- Qe.prototype.agentGoto = function (e, t) { var i; null === (i = this._recastCrowd.getAgent(e)) || void 0 === i || i.requestMoveTarget(t); var n = this._agents.indexOf(e); n > -1 && (this._agentDestinationArmed[n] = !0, this._agentDestination[n].set(t.x, t.y, t.z)); };
1180
- Qe.prototype.agentTeleport = function (e, t) { var i; null === (i = this._recastCrowd.getAgent(e)) || void 0 === i || i.teleport(t); };
1181
- Qe.prototype.updateAgentParameters = function (e, t) { var i = this._recastCrowd.getAgent(e); if (!i)
1182
- return; var n = i.parameters(); n && (void 0 !== t.radius && (n.radius = t.radius), void 0 !== t.height && (n.height = t.height), void 0 !== t.maxAcceleration && (n.maxAcceleration = t.maxAcceleration), void 0 !== t.maxSpeed && (n.maxSpeed = t.maxSpeed), void 0 !== t.collisionQueryRange && (n.collisionQueryRange = t.collisionQueryRange), void 0 !== t.pathOptimizationRange && (n.pathOptimizationRange = t.pathOptimizationRange), void 0 !== t.separationWeight && (n.separationWeight = t.separationWeight), i.updateParameters(n)); };
1183
- Qe.prototype.removeAgent = function (e) { this._recastCrowd.removeAgent(e); var t = this._agents.indexOf(e); t > -1 && (this._agents.splice(t, 1), this._transforms.splice(t, 1), this._reachRadii.splice(t, 1), this._agentDestinationArmed.splice(t, 1), this._agentDestination.splice(t, 1)); };
1184
- Qe.prototype.getAgents = function () { return this._agents; };
1185
- Qe.prototype.update = function (e) { if (e <= t.Epsilon)
1186
- return; var i = this._navigationPlugin.getTimeStep(), n = this._navigationPlugin.getMaximumSubStepCount(); if (i <= t.Epsilon)
1589
+ it.prototype.addAgent = function (e, i, r) { var n = tt(i), a = this._recastCrowd.addAgent({ x: e.x, y: e.y, z: e.z }, n); return this._transforms.push(r), this._agents.push(a.agentIndex), this._reachRadii.push(i.reachRadius ? i.reachRadius : i.radius), this._agentDestinationArmed.push(!1), this._agentDestination.push(new t.Vector3(0, 0, 0)), a.agentIndex; };
1590
+ it.prototype.getAgentPosition = function (e) { var i, r; var n = null !== (r = null === (i = this._recastCrowd.getAgent(e)) || void 0 === i ? void 0 : i.position()) && void 0 !== r ? r : t.Vector3.ZeroReadOnly; return new t.Vector3(n.x, n.y, n.z); };
1591
+ it.prototype.getAgentPositionToRef = function (e, i) { var r, n; var a = null !== (n = null === (r = this._recastCrowd.getAgent(e)) || void 0 === r ? void 0 : r.position()) && void 0 !== n ? n : t.Vector3.ZeroReadOnly; i.set(a.x, a.y, a.z); };
1592
+ it.prototype.getAgentVelocity = function (e) { var i, r; var n = null !== (r = null === (i = this._recastCrowd.getAgent(e)) || void 0 === i ? void 0 : i.velocity()) && void 0 !== r ? r : t.Vector3.ZeroReadOnly; return new t.Vector3(n.x, n.y, n.z); };
1593
+ it.prototype.getAgentVelocityToRef = function (e, i) { var r, n; var a = null !== (n = null === (r = this._recastCrowd.getAgent(e)) || void 0 === r ? void 0 : r.velocity()) && void 0 !== n ? n : t.Vector3.ZeroReadOnly; i.set(a.x, a.y, a.z); };
1594
+ it.prototype.getAgentNextTargetPath = function (e) { var i, r; var n = null !== (r = null === (i = this._recastCrowd.getAgent(e)) || void 0 === i ? void 0 : i.nextTargetInPath()) && void 0 !== r ? r : t.Vector3.ZeroReadOnly; return new t.Vector3(n.x, n.y, n.z); };
1595
+ it.prototype.getAgentNextTargetPathToRef = function (e, i) { var r, n; var a = null !== (n = null === (r = this._recastCrowd.getAgent(e)) || void 0 === r ? void 0 : r.nextTargetInPath()) && void 0 !== n ? n : t.Vector3.ZeroReadOnly; i.set(a.x, a.y, a.z); };
1596
+ it.prototype.getAgentState = function (e) { var t, i; return null !== (i = null === (t = this._recastCrowd.getAgent(e)) || void 0 === t ? void 0 : t.state()) && void 0 !== i ? i : 0; };
1597
+ it.prototype.overOffmeshConnection = function (e) { var t, i; return null !== (i = null === (t = this._recastCrowd.getAgent(e)) || void 0 === t ? void 0 : t.overOffMeshConnection()) && void 0 !== i && i; };
1598
+ it.prototype.agentGoto = function (e, t) { var i; null === (i = this._recastCrowd.getAgent(e)) || void 0 === i || i.requestMoveTarget(t); var r = this._agents.indexOf(e); r > -1 && (this._agentDestinationArmed[r] = !0, this._agentDestination[r].set(t.x, t.y, t.z)); };
1599
+ it.prototype.agentTeleport = function (e, t) { var i; null === (i = this._recastCrowd.getAgent(e)) || void 0 === i || i.teleport(t); };
1600
+ it.prototype.updateAgentParameters = function (e, t) { var i = this._recastCrowd.getAgent(e); if (!i)
1601
+ return; var r = i.parameters(); r && (void 0 !== t.radius && (r.radius = t.radius), void 0 !== t.height && (r.height = t.height), void 0 !== t.maxAcceleration && (r.maxAcceleration = t.maxAcceleration), void 0 !== t.maxSpeed && (r.maxSpeed = t.maxSpeed), void 0 !== t.collisionQueryRange && (r.collisionQueryRange = t.collisionQueryRange), void 0 !== t.pathOptimizationRange && (r.pathOptimizationRange = t.pathOptimizationRange), void 0 !== t.separationWeight && (r.separationWeight = t.separationWeight), i.updateParameters(r)); };
1602
+ it.prototype.removeAgent = function (e) { this._recastCrowd.removeAgent(e); var t = this._agents.indexOf(e); t > -1 && (this._agents.splice(t, 1), this._transforms.splice(t, 1), this._reachRadii.splice(t, 1), this._agentDestinationArmed.splice(t, 1), this._agentDestination.splice(t, 1)); };
1603
+ it.prototype.getAgents = function () { return this._agents; };
1604
+ it.prototype.update = function (e) { if (e <= t.Epsilon)
1605
+ return; var i = this._navigationPlugin.getTimeStep(), r = this._navigationPlugin.getMaximumSubStepCount(); if (i <= t.Epsilon)
1187
1606
  this._recastCrowd.update(e);
1188
1607
  else {
1189
- var t_11 = Math.floor(e / i);
1190
- n && t_11 > n && (t_11 = n), t_11 < 1 && (t_11 = 1);
1191
- var r_2 = e / t_11;
1192
- for (var e_49 = 0; e_49 < t_11; e_49++)
1193
- this._recastCrowd.update(r_2);
1194
- } for (var e_50 = 0; e_50 < this._agents.length; e_50++) {
1195
- var t_12 = this._agents[e_50], i_10 = this.getAgentPosition(t_12);
1196
- if (this._transforms[e_50].position = i_10, this._agentDestinationArmed[e_50]) {
1197
- var n_6 = i_10.x - this._agentDestination[e_50].x, r_3 = i_10.z - this._agentDestination[e_50].z, a_3 = this._reachRadii[e_50], s_1 = this._agentDestination[e_50].y - this._reachRadii[e_50], o_1 = this._agentDestination[e_50].y + this._reachRadii[e_50], l_2 = n_6 * n_6 + r_3 * r_3;
1198
- i_10.y > s_1 && i_10.y < o_1 && l_2 < a_3 * a_3 && (this._agentDestinationArmed[e_50] = !1, this.onReachTargetObservable.notifyObservers({ agentIndex: t_12, destination: this._agentDestination[e_50] }));
1608
+ var t_16 = Math.floor(e / i);
1609
+ r && t_16 > r && (t_16 = r), t_16 < 1 && (t_16 = 1);
1610
+ var n_5 = e / t_16;
1611
+ for (var e_61 = 0; e_61 < t_16; e_61++)
1612
+ this._recastCrowd.update(n_5);
1613
+ } for (var e_62 = 0; e_62 < this._agents.length; e_62++) {
1614
+ var t_17 = this._agents[e_62], i_10 = this.getAgentPosition(t_17);
1615
+ if (this._transforms[e_62].position = i_10, this._agentDestinationArmed[e_62]) {
1616
+ var r_9 = i_10.x - this._agentDestination[e_62].x, n_6 = i_10.z - this._agentDestination[e_62].z, a_4 = this._reachRadii[e_62], s_2 = this._agentDestination[e_62].y - this._reachRadii[e_62], o_2 = this._agentDestination[e_62].y + this._reachRadii[e_62], l_2 = r_9 * r_9 + n_6 * n_6;
1617
+ i_10.y > s_2 && i_10.y < o_2 && l_2 < a_4 * a_4 && (this._agentDestinationArmed[e_62] = !1, this.onReachTargetObservable.notifyObservers({ agentIndex: t_17, destination: this._agentDestination[e_62] }));
1199
1618
  }
1200
1619
  } };
1201
- Qe.prototype.setDefaultQueryExtent = function (e) { this._navigationPlugin.setDefaultQueryExtent(e); };
1202
- Qe.prototype.getDefaultQueryExtent = function () { var e = this._navigationPlugin.getDefaultQueryExtent(); return new t.Vector3(e.x, e.y, e.z); };
1203
- Qe.prototype.getDefaultQueryExtentToRef = function (e) { var t = this._navigationPlugin.getDefaultQueryExtent(); e.set(t.x, t.y, t.z); };
1204
- Qe.prototype.getCorners = function (e) { var i; var n = null === (i = this._recastCrowd.getAgent(e)) || void 0 === i ? void 0 : i.corners(); if (!n)
1205
- return []; var r = []; for (var e_51 = 0; e_51 < n.length; e_51++)
1206
- r.push(new t.Vector3(n[e_51].x, n[e_51].y, n[e_51].z)); return r; };
1207
- Qe.prototype.dispose = function () { this._recastCrowd.destroy(), this._onBeforeAnimationsObserver && (this._scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver), this._onBeforeAnimationsObserver = null), this.onReachTargetObservable.clear(); };
1208
- return Qe;
1620
+ it.prototype.setDefaultQueryExtent = function (e) { this._navigationPlugin.setDefaultQueryExtent(e); };
1621
+ it.prototype.getDefaultQueryExtent = function () { var e = this._navigationPlugin.getDefaultQueryExtent(); return new t.Vector3(e.x, e.y, e.z); };
1622
+ it.prototype.getDefaultQueryExtentToRef = function (e) { var t = this._navigationPlugin.getDefaultQueryExtent(); e.set(t.x, t.y, t.z); };
1623
+ it.prototype.getCorners = function (e) { var i; var r = null === (i = this._recastCrowd.getAgent(e)) || void 0 === i ? void 0 : i.corners(); if (!r)
1624
+ return []; var n = []; for (var e_63 = 0; e_63 < r.length; e_63++)
1625
+ n.push(new t.Vector3(r[e_63].x, r[e_63].y, r[e_63].z)); return n; };
1626
+ it.prototype.dispose = function () { this._recastCrowd.destroy(), this._onBeforeAnimationsObserver && (this._scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver), this._onBeforeAnimationsObserver = null), this.onReachTargetObservable.clear(); };
1627
+ return it;
1209
1628
  }());
1210
- function Ke(e) { var i = []; if (e.success) {
1211
- var n_7 = e.path.length;
1212
- for (var r_4 = 0; r_4 < n_7; r_4++) {
1213
- var n_8 = e.path[r_4];
1214
- i.push(new t.Vector3(n_8.x, n_8.y, n_8.z));
1629
+ function rt(e) { var i = []; if (e.success) {
1630
+ var r_10 = e.path.length;
1631
+ for (var n_7 = 0; n_7 < r_10; n_7++) {
1632
+ var r_11 = e.path[n_7];
1633
+ i.push(new t.Vector3(r_11.x, r_11.y, r_11.z));
1215
1634
  }
1216
1635
  }
1217
1636
  else
1218
1637
  t.Logger.Warn("Unable to convert navigation path point, because navPath generation has failed."); return i; }
1219
- var Xe = new t.Vector3, Je = new t.Vector3;
1220
- function et(e, i, n, r, a) { return Ke(function (e, i, n, r, a) { var s, o, l, c, d, h; var u = Ge(), m = null !== (s = null == a ? void 0 : a.filter) && void 0 !== s ? s : i.defaultFilter, p = null !== (o = null == a ? void 0 : a.halfExtents) && void 0 !== o ? o : i.defaultQueryHalfExtents, f = null !== (l = null == a ? void 0 : a.maxSmoothPathPoints) && void 0 !== l ? l : 2048, g = null !== (c = null == a ? void 0 : a.maxPathPolys) && void 0 !== c ? c : 256, v = null !== (d = null == a ? void 0 : a.stepSize) && void 0 !== d ? d : .5, S = null !== (h = null == a ? void 0 : a.slop) && void 0 !== h ? h : .01, _ = i.findNearestPoly(n, { filter: m, halfExtents: p }); if (!_.success)
1221
- return { success: !1, error: { type: "START_NEAREST_POLY_FAILED", status: _.status }, path: [] }; var y = i.findNearestPoly(r, { filter: m, halfExtents: p }); if (!y.success)
1222
- return { success: !1, error: { type: "END_NEAREST_POLY_FAILED", status: y.status }, path: [] }; var T = _.nearestRef, A = y.nearestRef, P = i.findPath(T, A, n, r, { filter: m, maxPathPolys: g }); if (!P.success)
1223
- return { success: !1, error: { type: "FIND_PATH_FAILED", status: P.status }, path: [] }; if (P.polys.size <= 0)
1224
- return { success: !1, error: { type: "NO_POLYGON_PATH_FOUND" }, path: [] }; var L = P.polys.get(P.polys.size - 1); var R = r; if (L !== A) {
1225
- var e_52 = i.closestPointOnPoly(L, r);
1226
- if (!e_52.success)
1227
- return { success: !1, error: { type: "NO_CLOSEST_POINT_ON_LAST_POLYGON_FOUND", status: e_52.status }, path: [] };
1228
- R = e_52.closestPoint;
1229
- } var E = new t.Vector3(n.x, n.y, n.z), C = new t.Vector3(R.x, R.y, R.z), x = Array.from(P.polys.getHeapView()), I = []; for (I.push(E.clone()); x.length > 0 && I.length < f;) {
1230
- var n_9 = tt(i, E, C, S, x, u);
1231
- if (!n_9.success)
1638
+ var nt = new t.Vector3, at = new t.Vector3;
1639
+ function st(e, i, r, n, a) { return rt(function (e, i, r, n, a) { var s, o, l, c, u, h; var d = Ze(), m = null !== (s = null == a ? void 0 : a.filter) && void 0 !== s ? s : i.defaultFilter, p = null !== (o = null == a ? void 0 : a.halfExtents) && void 0 !== o ? o : i.defaultQueryHalfExtents, f = null !== (l = null == a ? void 0 : a.maxSmoothPathPoints) && void 0 !== l ? l : 2048, g = null !== (c = null == a ? void 0 : a.maxPathPolys) && void 0 !== c ? c : 256, v = null !== (u = null == a ? void 0 : a.stepSize) && void 0 !== u ? u : .5, _ = null !== (h = null == a ? void 0 : a.slop) && void 0 !== h ? h : .01, S = i.findNearestPoly(r, { filter: m, halfExtents: p }); if (!S.success)
1640
+ return { success: !1, error: { type: "START_NEAREST_POLY_FAILED", status: S.status }, path: [] }; var y = i.findNearestPoly(n, { filter: m, halfExtents: p }); if (!y.success)
1641
+ return { success: !1, error: { type: "END_NEAREST_POLY_FAILED", status: y.status }, path: [] }; var T = S.nearestRef, A = y.nearestRef, L = i.findPath(T, A, r, n, { filter: m, maxPathPolys: g }); if (!L.success)
1642
+ return { success: !1, error: { type: "FIND_PATH_FAILED", status: L.status }, path: [] }; if (L.polys.size <= 0)
1643
+ return { success: !1, error: { type: "NO_POLYGON_PATH_FOUND" }, path: [] }; var P = L.polys.get(L.polys.size - 1); var E = n; if (P !== A) {
1644
+ var e_64 = i.closestPointOnPoly(P, n);
1645
+ if (!e_64.success)
1646
+ return { success: !1, error: { type: "NO_CLOSEST_POINT_ON_LAST_POLYGON_FOUND", status: e_64.status }, path: [] };
1647
+ E = e_64.closestPoint;
1648
+ } var R = new t.Vector3(r.x, r.y, r.z), C = new t.Vector3(E.x, E.y, E.z), x = Array.from(L.polys.getHeapView()), M = []; for (M.push(R.clone()); x.length > 0 && M.length < f;) {
1649
+ var r_12 = ot(i, R, C, _, x, d);
1650
+ if (!r_12.success)
1232
1651
  break;
1233
- var r_5 = n_9.steerPosFlag & u.Detour.DT_STRAIGHTPATH_END, a_4 = n_9.steerPosFlag & u.Detour.DT_STRAIGHTPATH_OFFMESH_CONNECTION, s_2 = n_9.steerPos, o_2 = Xe.copyFrom(s_2).subtract(E);
1234
- var l_3 = Math.sqrt(o_2.dot(o_2));
1235
- l_3 = (r_5 || a_4) && l_3 < v ? 1 : v / l_3;
1236
- var c_3 = Je.copyFrom(E).addInPlace(o_2.scale(l_3)), d_2 = i.moveAlongSurface(x[0], E, c_3, { filter: m, maxVisitedSize: 16 });
1237
- if (!d_2.success)
1652
+ var n_8 = r_12.steerPosFlag & d.Detour.DT_STRAIGHTPATH_END, a_5 = r_12.steerPosFlag & d.Detour.DT_STRAIGHTPATH_OFFMESH_CONNECTION, s_3 = r_12.steerPos, o_3 = nt.copyFrom(s_3).subtract(R);
1653
+ var l_3 = Math.sqrt(o_3.dot(o_3));
1654
+ l_3 = (n_8 || a_5) && l_3 < v ? 1 : v / l_3;
1655
+ var c_3 = at.copyFrom(R).addInPlace(o_3.scale(l_3)), u_2 = i.moveAlongSurface(x[0], R, c_3, { filter: m, maxVisitedSize: 16 });
1656
+ if (!u_2.success)
1238
1657
  break;
1239
- var h_3 = d_2.resultPosition;
1240
- nt(x, g, d_2.visited), rt(x, e, u);
1658
+ var h_3 = u_2.resultPosition;
1659
+ ct(x, g, u_2.visited), ut(x, e, d);
1241
1660
  var p_2 = i.getPolyHeight(x[0], h_3);
1242
- if (p_2.success && (h_3.y = p_2.height), E.copyFromFloats(h_3.x, h_3.y, h_3.z), r_5 && it(E, n_9.steerPos, S, 1)) {
1243
- E.copyFrom(C), I.length < f && I.push(new t.Vector3(E.x, E.y, E.z));
1661
+ if (p_2.success && (h_3.y = p_2.height), R.copyFromFloats(h_3.x, h_3.y, h_3.z), n_8 && lt(R, r_12.steerPos, _, 1)) {
1662
+ R.copyFrom(C), M.length < f && M.push(new t.Vector3(R.x, R.y, R.z));
1244
1663
  break;
1245
1664
  }
1246
- if (a_4 && it(E, n_9.steerPos, S, 1)) {
1247
- var r_6 = n_9.steerPosRef;
1248
- var a_5 = 0, s_3 = x[0], o_3 = 0;
1249
- for (; o_3 < x.length && s_3 !== r_6;)
1250
- a_5 = s_3, s_3 = x[o_3], o_3++;
1251
- for (var e_53 = o_3; e_53 < x.length; e_53++)
1252
- x[e_53 - o_3] = x[e_53];
1253
- x.splice(o_3, x.length - o_3);
1254
- var l_4 = e.getOffMeshConnectionPolyEndPoints(a_5, s_3);
1255
- if (l_4.success && I.length < f) {
1256
- I.push(new t.Vector3(E.x, E.y, E.z)), 1 & I.length && I.push(new t.Vector3(E.x, E.y, E.z)), E.copyFromFloats(l_4.end.x, l_4.end.y, l_4.end.z);
1257
- var e_54 = i.getPolyHeight(x[0], E);
1258
- e_54.success && (E.y = e_54.height);
1665
+ if (a_5 && lt(R, r_12.steerPos, _, 1)) {
1666
+ var n_9 = r_12.steerPosRef;
1667
+ var a_6 = 0, s_4 = x[0], o_4 = 0;
1668
+ for (; o_4 < x.length && s_4 !== n_9;)
1669
+ a_6 = s_4, s_4 = x[o_4], o_4++;
1670
+ for (var e_65 = o_4; e_65 < x.length; e_65++)
1671
+ x[e_65 - o_4] = x[e_65];
1672
+ x.splice(o_4, x.length - o_4);
1673
+ var l_4 = e.getOffMeshConnectionPolyEndPoints(a_6, s_4);
1674
+ if (l_4.success && M.length < f) {
1675
+ M.push(new t.Vector3(R.x, R.y, R.z)), 1 & M.length && M.push(new t.Vector3(R.x, R.y, R.z)), R.copyFromFloats(l_4.end.x, l_4.end.y, l_4.end.z);
1676
+ var e_66 = i.getPolyHeight(x[0], R);
1677
+ e_66.success && (R.y = e_66.height);
1259
1678
  }
1260
1679
  }
1261
- I.length < f && I.push(new t.Vector3(E.x, E.y, E.z));
1262
- } return { success: !0, path: I }; }(e, i, n, r, a)); }
1263
- function tt(e, i, n, r, a, s) { var o = e.findStraightPath(i, n, a, { maxStraightPathPoints: 3 }); if (!o.success)
1264
- return { success: !1 }; var l = []; for (var e_55 = 0; e_55 < o.straightPathCount; e_55++) {
1265
- var i_11 = new t.Vector3(o.straightPath.get(3 * e_55), o.straightPath.get(3 * e_55 + 1), o.straightPath.get(3 * e_55 + 2));
1680
+ M.length < f && M.push(new t.Vector3(R.x, R.y, R.z));
1681
+ } return { success: !0, path: M }; }(e, i, r, n, a)); }
1682
+ function ot(e, i, r, n, a, s) { var o = e.findStraightPath(i, r, a, { maxStraightPathPoints: 3 }); if (!o.success)
1683
+ return { success: !1 }; var l = []; for (var e_67 = 0; e_67 < o.straightPathCount; e_67++) {
1684
+ var i_11 = new t.Vector3(o.straightPath.get(3 * e_67), o.straightPath.get(3 * e_67 + 1), o.straightPath.get(3 * e_67 + 2));
1266
1685
  l.push(i_11);
1267
- } var c = 0; for (; c < l.length && !(o.straightPathFlags.get(c) & s.Detour.DT_STRAIGHTPATH_OFFMESH_CONNECTION) && it(l[c], i, r, 1e3);)
1686
+ } var c = 0; for (; c < l.length && !(o.straightPathFlags.get(c) & s.Detour.DT_STRAIGHTPATH_OFFMESH_CONNECTION) && lt(l[c], i, n, 1e3);)
1268
1687
  c++; return c >= o.straightPathCount ? { success: !1 } : { success: !0, steerPos: l[c], steerPosFlag: o.straightPathFlags.get(c), steerPosRef: o.straightPathRefs.get(c), points: l }; }
1269
- function it(e, t, i, n) { var r = t.x - e.x, a = t.y - e.y, s = t.z - e.z; return r * r + s * s < i * i && Math.abs(a) < n; }
1270
- function nt(e, t, i) { var n = -1, r = -1; for (var t_13 = e.length - 1; t_13 >= 0; t_13--) {
1271
- var a_6 = !1;
1272
- for (var s_4 = i.length - 1; s_4 >= 0; s_4--)
1273
- e[t_13] === i[s_4] && (n = t_13, r = s_4, a_6 = !0);
1274
- if (a_6)
1688
+ function lt(e, t, i, r) { var n = t.x - e.x, a = t.y - e.y, s = t.z - e.z; return n * n + s * s < i * i && Math.abs(a) < r; }
1689
+ function ct(e, t, i) { var r = -1, n = -1; for (var t_18 = e.length - 1; t_18 >= 0; t_18--) {
1690
+ var a_7 = !1;
1691
+ for (var s_5 = i.length - 1; s_5 >= 0; s_5--)
1692
+ e[t_18] === i[s_5] && (r = t_18, n = s_5, a_7 = !0);
1693
+ if (a_7)
1275
1694
  break;
1276
- } if (-1 === n || -1 === r)
1277
- return e; var a = i.length - r, s = Math.min(n + 1, e.length); var o = Math.max(0, e.length - s); a + o > t && (o = t - a), o && e.splice.apply(e, __spreadArray([a, o], __read(e.slice(s, s + o)), false)); for (var t_14 = 0; t_14 < a; t_14++)
1278
- e[t_14] = i[i.length - (1 + t_14)]; return e; }
1279
- function rt(e, t, i) { if (e.length < 3)
1280
- return; var n = 0; var r = [], a = t.getTileAndPolyByRef(e[0]); if (!a.success)
1281
- return; var s = a.poly, o = a.tile; for (var e_56 = s.firstLink(); e_56 !== i.Detour.DT_NULL_LINK; e_56 = o.links(e_56).next()) {
1282
- var t_15 = o.links(e_56);
1283
- 0 !== t_15.ref() && n < 16 && (r.push(t_15.ref()), n++);
1284
- } var l = 0; for (var t_16 = Math.min(6, e.length) - 1; t_16 > 1 && 0 === l; t_16--)
1285
- for (var i_12 = 0; i_12 < n; i_12++)
1286
- if (e[t_16] === r[i_12]) {
1287
- l = t_16;
1695
+ } if (-1 === r || -1 === n)
1696
+ return e; var a = i.length - n, s = Math.min(r + 1, e.length); var o = Math.max(0, e.length - s); a + o > t && (o = t - a), o && e.splice.apply(e, __spreadArray([a, o], __read(e.slice(s, s + o)), false)); for (var t_19 = 0; t_19 < a; t_19++)
1697
+ e[t_19] = i[i.length - (1 + t_19)]; return e; }
1698
+ function ut(e, t, i) { if (e.length < 3)
1699
+ return; var r = 0; var n = [], a = t.getTileAndPolyByRef(e[0]); if (!a.success)
1700
+ return; var s = a.poly, o = a.tile; for (var e_68 = s.firstLink(); e_68 !== i.Detour.DT_NULL_LINK; e_68 = o.links(e_68).next()) {
1701
+ var t_20 = o.links(e_68);
1702
+ 0 !== t_20.ref() && r < 16 && (n.push(t_20.ref()), r++);
1703
+ } var l = 0; for (var t_21 = Math.min(6, e.length) - 1; t_21 > 1 && 0 === l; t_21--)
1704
+ for (var i_12 = 0; i_12 < r; i_12++)
1705
+ if (e[t_21] === n[i_12]) {
1706
+ l = t_21;
1288
1707
  break;
1289
1708
  } l > 1 && e.splice(1, l - 1); }
1290
- function at(e, i) { var n, r, a, s = 0; var o = [], l = []; for (n = 0; n < e.length; n++)
1291
- if (e[n]) {
1292
- var c_4 = e[n], d_3 = (null == i ? void 0 : i.doNotReverseIndices) ? c_4.getIndices(!1, !0) : st(c_4);
1293
- if (!d_3)
1709
+ function ht(e, i) { var r, n, a, s = 0; var o = [], l = []; for (r = 0; r < e.length; r++)
1710
+ if (e[r]) {
1711
+ var c_4 = e[r], u_3 = (null == i ? void 0 : i.doNotReverseIndices) ? c_4.getIndices(!1, !0) : dt(c_4);
1712
+ if (!u_3)
1294
1713
  continue;
1295
1714
  var h_4 = c_4.getVerticesData(t.VertexBuffer.PositionKind, !1, !1);
1296
1715
  if (!h_4)
1297
1716
  continue;
1298
- var u_3 = [], m_2 = c_4.computeWorldMatrix(!0);
1717
+ var d_3 = [], m_2 = c_4.computeWorldMatrix(!0);
1299
1718
  if (c_4.hasThinInstances) {
1300
- var e_57 = c_4.thinInstanceGetWorldMatrices();
1301
- for (var i_13 = 0; i_13 < e_57.length; i_13++) {
1302
- var n_10 = new t.Matrix;
1303
- e_57[i_13].multiplyToRef(m_2, n_10), u_3.push(n_10);
1719
+ var e_69 = c_4.thinInstanceGetWorldMatrices();
1720
+ for (var i_13 = 0; i_13 < e_69.length; i_13++) {
1721
+ var r_13 = new t.Matrix;
1722
+ e_69[i_13].multiplyToRef(m_2, r_13), d_3.push(r_13);
1304
1723
  }
1305
1724
  }
1306
1725
  else
1307
- u_3.push(m_2);
1726
+ d_3.push(m_2);
1308
1727
  var p_3 = t.Vector3.Zero(), f_2 = t.Vector3.Zero();
1309
- for (var e_58 = 0; e_58 < u_3.length; e_58++) {
1310
- var i_14 = u_3[e_58];
1311
- for (r = 0; r < d_3.length; r++)
1312
- l.push(d_3[r] + s);
1728
+ for (var e_70 = 0; e_70 < d_3.length; e_70++) {
1729
+ var i_14 = d_3[e_70];
1730
+ for (n = 0; n < u_3.length; n++)
1731
+ l.push(u_3[n] + s);
1313
1732
  for (a = 0; a < h_4.length; a += 3)
1314
1733
  t.Vector3.FromArrayToRef(h_4, a, f_2), t.Vector3.TransformCoordinatesToRef(f_2, i_14, p_3), o.push(p_3.x, p_3.y, p_3.z);
1315
1734
  s += h_4.length / 3;
1316
1735
  }
1317
1736
  } return [Float32Array.from(o), Uint32Array.from(l)]; }
1318
- function st(e) {
1737
+ function dt(e) {
1319
1738
  var _a;
1320
1739
  var i = e instanceof t.Mesh ? e.getIndices(!1, !0) : e;
1321
1740
  if (i)
1322
- for (var e_59 = 0; e_59 < i.length; e_59 += 3)
1323
- _a = __read([i[e_59 + 2], i[e_59 + 1]], 2), i[e_59 + 1] = _a[0], i[e_59 + 2] = _a[1];
1741
+ for (var e_71 = 0; e_71 < i.length; e_71 += 3)
1742
+ _a = __read([i[e_71 + 2], i[e_71 + 1]], 2), i[e_71 + 1] = _a[0], i[e_71 + 2] = _a[1];
1324
1743
  return i;
1325
1744
  }
1326
- function ot(e, i, n, r) { var _a = __read(Ge().getNavMeshPositionsAndIndices(e, r), 2), a = _a[0], s = _a[1], o = new t.Mesh("NavMeshDebug", i), l = new t.VertexData; return l.indices = st(s), l.positions = a, l.applyToMesh(o, !1), n && (o.parent = n), o; }
1327
- function lt(e, i) { var n, r; var a = Ge(); if (0 === e.length)
1328
- throw new Error("At least one mesh is needed to create the nav mesh."); var _a = __read(at(e, { doNotReverseIndices: i.doNotReverseIndices }), 2), s = _a[0], o = _a[1]; if (!s || !o)
1329
- throw new Error("Unable to get nav mesh. No vertices or indices."); var l = null !== (n = i.tileSize) && void 0 !== n ? n : 0, c = (null !== (r = i.maxObstacles) && void 0 !== r ? r : 0) > 0, d = l > 0; c && (l < 32 || l > 64) && t.Logger.Warn("NavigationPlugin: Tile cache is enabled. Recommended tileSize is 32 to 64. Other values may lead to unexpected behavior."); var h = c ? Ye(i) : d ? Ze(i) : qe(i), u = c ? a.generateTileCache(s, o, h, i.keepIntermediates) : d ? a.generateTiledNavMesh(s, o, h, i.keepIntermediates) : a.generateSoloNavMesh(s, o, h, i.keepIntermediates); if (!u.success)
1330
- throw new Error("Unable to generateSoloNavMesh: ".concat(u.error)); return { navMesh: u.navMesh, intermediates: u.intermediates, navMeshQuery: new a.NavMeshQuery(u.navMesh), tileCache: "tileCache" in u ? u.tileCache : void 0 }; }
1331
- function ct(e) {
1745
+ function mt(e, i, r, n) { var _a = __read(Ze().getNavMeshPositionsAndIndices(e, n), 2), a = _a[0], s = _a[1], o = new t.Mesh("NavMeshDebug", i), l = new t.VertexData; return l.indices = dt(s), l.positions = a, l.applyToMesh(o, !1), r && (o.parent = r), o; }
1746
+ function pt(e, i) { var r, n; var a = Ze(); if (0 === e.length)
1747
+ throw new Error("At least one mesh is needed to create the nav mesh."); var _a = __read(ht(e, { doNotReverseIndices: i.doNotReverseIndices }), 2), s = _a[0], o = _a[1]; if (!s || !o)
1748
+ throw new Error("Unable to get nav mesh. No vertices or indices."); var l = null !== (r = i.tileSize) && void 0 !== r ? r : 0, c = (null !== (n = i.maxObstacles) && void 0 !== n ? n : 0) > 0, u = l > 0; c && (l < 32 || l > 64) && t.Logger.Warn("NavigationPlugin: Tile cache is enabled. Recommended tileSize is 32 to 64. Other values may lead to unexpected behavior."); var h = c ? Je(i) : u ? Ke(i) : Qe(i), d = c ? a.generateTileCache(s, o, h, i.keepIntermediates) : u ? a.generateTiledNavMesh(s, o, h, i.keepIntermediates) : a.generateSoloNavMesh(s, o, h, i.keepIntermediates); if (!d.success)
1749
+ throw new Error("Unable to generateSoloNavMesh: ".concat(d.error)); return { navMesh: d.navMesh, intermediates: d.intermediates, navMeshQuery: new a.NavMeshQuery(d.navMesh), tileCache: "tileCache" in d ? d.tileCache : void 0 }; }
1750
+ function ft(e) {
1332
1751
  var _this = this;
1333
- e.createNavMeshImpl = function (e, t) { return lt(e, t); }, e.createNavMeshAsyncImpl = function (e, t) { return i(_this, void 0, void 0, function () { return __generator(this, function (_a) {
1752
+ e.createNavMeshImpl = function (e, t) { return pt(e, t); }, e.createNavMeshAsyncImpl = function (e, t) { return i(_this, void 0, void 0, function () { return __generator(this, function (_a) {
1334
1753
  switch (_a.label) {
1335
- case 0: return [4 /*yield*/, new Promise(function (i) { i(lt(e, t)); })];
1754
+ case 0: return [4 /*yield*/, new Promise(function (i) { i(pt(e, t)); })];
1336
1755
  case 1: return [2 /*return*/, _a.sent()];
1337
1756
  }
1338
1757
  }); }); };
1339
1758
  }
1340
- var dt = /** @class */ (function () {
1341
- function dt(e) {
1342
- this.name = "RecastNavigationJSPlugin", this._maximumSubStepCount = 10, this._timeStep = 1 / 60, this._timeFactor = 1, e || (e = Ge(), ct(this)), this.bjsRECAST = e, this.isSupported() ? this.setTimeStep() : t.Logger.Error("RecastJS is not available. Please make sure you included the js file.");
1759
+ var gt = /** @class */ (function () {
1760
+ function gt(e) {
1761
+ this.name = "RecastNavigationJSPlugin", this._maximumSubStepCount = 10, this._timeStep = 1 / 60, this._timeFactor = 1, e || (e = Ze(), ft(this)), this.bjsRECAST = e, this.isSupported() ? this.setTimeStep() : t.Logger.Error("RecastJS is not available. Please make sure you included the js file.");
1343
1762
  }
1344
- Object.defineProperty(dt.prototype, "navMeshQuery", {
1763
+ Object.defineProperty(gt.prototype, "navMeshQuery", {
1345
1764
  get: function () { return this._navMeshQuery; },
1346
1765
  enumerable: false,
1347
1766
  configurable: true
1348
1767
  });
1349
- Object.defineProperty(dt.prototype, "intermediates", {
1768
+ Object.defineProperty(gt.prototype, "intermediates", {
1350
1769
  get: function () { return this._intermediates; },
1351
1770
  enumerable: false,
1352
1771
  configurable: true
1353
1772
  });
1354
- Object.defineProperty(dt.prototype, "tileCache", {
1773
+ Object.defineProperty(gt.prototype, "tileCache", {
1355
1774
  get: function () { return this._tileCache; },
1356
1775
  enumerable: false,
1357
1776
  configurable: true
1358
1777
  });
1359
- dt.prototype.setTimeStep = function (e) {
1778
+ gt.prototype.setTimeStep = function (e) {
1360
1779
  if (e === void 0) { e = 1 / 60; }
1361
1780
  this._timeStep = e;
1362
1781
  };
1363
- dt.prototype.getTimeStep = function () { return this._timeStep; };
1364
- dt.prototype.setMaximumSubStepCount = function (e) {
1782
+ gt.prototype.getTimeStep = function () { return this._timeStep; };
1783
+ gt.prototype.setMaximumSubStepCount = function (e) {
1365
1784
  if (e === void 0) { e = 10; }
1366
1785
  this._maximumSubStepCount = e;
1367
1786
  };
1368
- dt.prototype.getMaximumSubStepCount = function () { return this._maximumSubStepCount; };
1369
- Object.defineProperty(dt.prototype, "timeFactor", {
1787
+ gt.prototype.getMaximumSubStepCount = function () { return this._maximumSubStepCount; };
1788
+ Object.defineProperty(gt.prototype, "timeFactor", {
1370
1789
  get: function () { return this._timeFactor; },
1371
1790
  set: function (e) { this._timeFactor = Math.max(e, 0); },
1372
1791
  enumerable: false,
1373
1792
  configurable: true
1374
1793
  });
1375
- dt.prototype.createNavMesh = function (e, t) { if (!this.createNavMeshImpl)
1794
+ gt.prototype.createNavMesh = function (e, t) { if (!this.createNavMeshImpl)
1376
1795
  throw new Error("Function not injected yet. Use the factory to create the plugin."); this._preprocessParameters(t); var i = this.createNavMeshImpl(e, t); return this._processNavMeshResult(i); };
1377
- dt.prototype.createNavMeshAsync = function (e, t) { return i(this, void 0, void 0, function () { var i; return __generator(this, function (_a) {
1796
+ gt.prototype.createNavMeshAsync = function (e, t) { return i(this, void 0, void 0, function () { var i; return __generator(this, function (_a) {
1378
1797
  switch (_a.label) {
1379
1798
  case 0:
1380
1799
  if (!this.createNavMeshAsyncImpl)
@@ -1386,746 +1805,782 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
1386
1805
  return [2 /*return*/, this._processNavMeshResult(i)];
1387
1806
  }
1388
1807
  }); }); };
1389
- dt.prototype.createDebugNavMesh = function (e) { if (!this.navMesh)
1390
- throw new Error("There is no navMesh generated."); return this.navMesh && this._tileCache && We(this.navMesh, this._tileCache), ot(this.navMesh, e); };
1391
- dt.prototype.getClosestPoint = function (e, i) { var n = this._navMeshQuery.findClosestPoint(e, i); return new t.Vector3(n.point.x, n.point.y, n.point.z); };
1392
- dt.prototype.getClosestPointToRef = function (e, t, i) { var n = this._navMeshQuery.findClosestPoint(e, i); t.set(n.point.x, n.point.y, n.point.z); };
1393
- dt.prototype.getRandomPointAround = function (e, i, n) { var r = this._navMeshQuery.findRandomPointAroundCircle(e, i, n); return new t.Vector3(r.randomPoint.x, r.randomPoint.y, r.randomPoint.z); };
1394
- dt.prototype.getRandomPointAroundToRef = function (e, t, i, n) { var r = this._navMeshQuery.findRandomPointAroundCircle(e, t, n); i.set(r.randomPoint.x, r.randomPoint.y, r.randomPoint.z); };
1395
- dt.prototype.moveAlong = function (e, i, n, r) {
1396
- if (n === void 0) { n = 0; }
1397
- var a = this._navMeshQuery.moveAlongSurface(n, e, i, r);
1808
+ gt.prototype.createDebugNavMesh = function (e) { if (!this.navMesh)
1809
+ throw new Error("There is no navMesh generated."); return this.navMesh && this._tileCache && Xe(this.navMesh, this._tileCache), mt(this.navMesh, e); };
1810
+ gt.prototype.getClosestPoint = function (e, i) { var r = this._navMeshQuery.findClosestPoint(e, i); return new t.Vector3(r.point.x, r.point.y, r.point.z); };
1811
+ gt.prototype.getClosestPointToRef = function (e, t, i) { var r = this._navMeshQuery.findClosestPoint(e, i); t.set(r.point.x, r.point.y, r.point.z); };
1812
+ gt.prototype.getRandomPointAround = function (e, i, r) { var n = this._navMeshQuery.findRandomPointAroundCircle(e, i, r); return new t.Vector3(n.randomPoint.x, n.randomPoint.y, n.randomPoint.z); };
1813
+ gt.prototype.getRandomPointAroundToRef = function (e, t, i, r) { var n = this._navMeshQuery.findRandomPointAroundCircle(e, t, r); i.set(n.randomPoint.x, n.randomPoint.y, n.randomPoint.z); };
1814
+ gt.prototype.moveAlong = function (e, i, r, n) {
1815
+ if (r === void 0) { r = 0; }
1816
+ var a = this._navMeshQuery.moveAlongSurface(r, e, i, n);
1398
1817
  return new t.Vector3(a.resultPosition.x, a.resultPosition.y, a.resultPosition.z);
1399
1818
  };
1400
- dt.prototype.moveAlongToRef = function (e, t, i, n, r) {
1401
- if (n === void 0) { n = 0; }
1402
- var a = this._navMeshQuery.moveAlongSurface(n, e, t, r);
1819
+ gt.prototype.moveAlongToRef = function (e, t, i, r, n) {
1820
+ if (r === void 0) { r = 0; }
1821
+ var a = this._navMeshQuery.moveAlongSurface(r, e, t, n);
1403
1822
  i.set(a.resultPosition.x, a.resultPosition.y, a.resultPosition.z);
1404
1823
  };
1405
- dt.prototype.computePath = function (e, t, i) { return Ke(this._navMeshQuery.computePath(e, t, i)); };
1406
- dt.prototype.computePathSmooth = function (e, i, n) { return this.navMesh ? et(this.navMesh, this._navMeshQuery, e, i, n) : (t.Logger.Error("No navmesh available. Cannot compute smooth path."), []); };
1407
- dt.prototype.createCrowd = function (e, t, i) { var n = new Qe(this, e, t, i); return this._crowd = n, n; };
1408
- dt.prototype.setDefaultQueryExtent = function (e) { this._navMeshQuery.defaultQueryHalfExtents = e; };
1409
- dt.prototype.getDefaultQueryExtent = function () { return new t.Vector3(this._navMeshQuery.defaultQueryHalfExtents.x, this._navMeshQuery.defaultQueryHalfExtents.y, this._navMeshQuery.defaultQueryHalfExtents.z); };
1410
- dt.prototype.getDefaultQueryExtentToRef = function (e) { e.set(this._navMeshQuery.defaultQueryHalfExtents.x, this._navMeshQuery.defaultQueryHalfExtents.y, this._navMeshQuery.defaultQueryHalfExtents.z); };
1411
- dt.prototype.buildFromNavmeshData = function (e) { var t = this.bjsRECAST.importNavMesh(e); this.navMesh = t.navMesh, this._navMeshQuery = new this.bjsRECAST.NavMeshQuery(this.navMesh); };
1412
- dt.prototype.getNavmeshData = function () { if (!this.navMesh)
1824
+ gt.prototype.computePath = function (e, t, i) { return rt(this._navMeshQuery.computePath(e, t, i)); };
1825
+ gt.prototype.computePathSmooth = function (e, i, r) { return this.navMesh ? st(this.navMesh, this._navMeshQuery, e, i, r) : (t.Logger.Error("No navmesh available. Cannot compute smooth path."), []); };
1826
+ gt.prototype.createCrowd = function (e, t, i) { var r = new it(this, e, t, i); return this._crowd = r, r; };
1827
+ gt.prototype.setDefaultQueryExtent = function (e) { this._navMeshQuery.defaultQueryHalfExtents = e; };
1828
+ gt.prototype.getDefaultQueryExtent = function () { return new t.Vector3(this._navMeshQuery.defaultQueryHalfExtents.x, this._navMeshQuery.defaultQueryHalfExtents.y, this._navMeshQuery.defaultQueryHalfExtents.z); };
1829
+ gt.prototype.getDefaultQueryExtentToRef = function (e) { e.set(this._navMeshQuery.defaultQueryHalfExtents.x, this._navMeshQuery.defaultQueryHalfExtents.y, this._navMeshQuery.defaultQueryHalfExtents.z); };
1830
+ gt.prototype.buildFromNavmeshData = function (e) { var t = this.bjsRECAST.importNavMesh(e); this.navMesh = t.navMesh, this._navMeshQuery = new this.bjsRECAST.NavMeshQuery(this.navMesh); };
1831
+ gt.prototype.getNavmeshData = function () { if (!this.navMesh)
1413
1832
  throw new Error("There is no NavMesh generated."); return this.bjsRECAST.exportNavMesh(this.navMesh); };
1414
- dt.prototype.buildFromTileCacheData = function (e, t) { var i = this.bjsRECAST.importTileCache(e, null != t ? t : He([])); this.navMesh = i.navMesh, this._tileCache = i.tileCache, this._navMeshQuery = new this.bjsRECAST.NavMeshQuery(this.navMesh); };
1415
- dt.prototype.getTileCacheData = function () { if (!this.navMesh || !this._tileCache)
1833
+ gt.prototype.buildFromTileCacheData = function (e, t) { var i = this.bjsRECAST.importTileCache(e, null != t ? t : je([])); this.navMesh = i.navMesh, this._tileCache = i.tileCache, this._navMeshQuery = new this.bjsRECAST.NavMeshQuery(this.navMesh); };
1834
+ gt.prototype.getTileCacheData = function () { if (!this.navMesh || !this._tileCache)
1416
1835
  throw new Error("There is no TileCache generated."); return this.bjsRECAST.exportTileCache(this.navMesh, this._tileCache); };
1417
- dt.prototype.dispose = function () { var e, t, i, n; null === (e = this._crowd) || void 0 === e || e.dispose(), null === (t = this.navMesh) || void 0 === t || t.destroy(), null === (i = this._navMeshQuery) || void 0 === i || i.destroy(), null === (n = this._tileCache) || void 0 === n || n.destroy(); };
1418
- dt.prototype.addCylinderObstacle = function (e, t, i, n) {
1419
- if (n === void 0) { n = !1; }
1420
- var r, a;
1421
- var s = null === (r = this._tileCache) || void 0 === r ? void 0 : r.addCylinderObstacle(e, t, i);
1422
- return (null == s ? void 0 : s.success) ? (!n && this.navMesh && this._tileCache && We(this.navMesh, this._tileCache), null !== (a = s.obstacle) && void 0 !== a ? a : null) : null;
1836
+ gt.prototype.dispose = function () { var e, t, i, r; null === (e = this._crowd) || void 0 === e || e.dispose(), null === (t = this.navMesh) || void 0 === t || t.destroy(), null === (i = this._navMeshQuery) || void 0 === i || i.destroy(), null === (r = this._tileCache) || void 0 === r || r.destroy(); };
1837
+ gt.prototype.addCylinderObstacle = function (e, t, i, r) {
1838
+ if (r === void 0) { r = !1; }
1839
+ var n, a;
1840
+ var s = null === (n = this._tileCache) || void 0 === n ? void 0 : n.addCylinderObstacle(e, t, i);
1841
+ return (null == s ? void 0 : s.success) ? (!r && this.navMesh && this._tileCache && Xe(this.navMesh, this._tileCache), null !== (a = s.obstacle) && void 0 !== a ? a : null) : null;
1423
1842
  };
1424
- dt.prototype.addBoxObstacle = function (e, t, i, n) {
1425
- if (n === void 0) { n = !1; }
1426
- var r, a;
1427
- var s = null === (r = this._tileCache) || void 0 === r ? void 0 : r.addBoxObstacle(e, t, i);
1428
- return (null == s ? void 0 : s.success) ? (!n && this.navMesh && this._tileCache && We(this.navMesh, this._tileCache), null !== (a = s.obstacle) && void 0 !== a ? a : null) : null;
1843
+ gt.prototype.addBoxObstacle = function (e, t, i, r) {
1844
+ if (r === void 0) { r = !1; }
1845
+ var n, a;
1846
+ var s = null === (n = this._tileCache) || void 0 === n ? void 0 : n.addBoxObstacle(e, t, i);
1847
+ return (null == s ? void 0 : s.success) ? (!r && this.navMesh && this._tileCache && Xe(this.navMesh, this._tileCache), null !== (a = s.obstacle) && void 0 !== a ? a : null) : null;
1429
1848
  };
1430
- dt.prototype.removeObstacle = function (e, t) {
1849
+ gt.prototype.removeObstacle = function (e, t) {
1431
1850
  if (t === void 0) { t = !1; }
1432
1851
  var i;
1433
- null === (i = this._tileCache) || void 0 === i || i.removeObstacle(e), !t && this.navMesh && this._tileCache && We(this.navMesh, this._tileCache);
1852
+ null === (i = this._tileCache) || void 0 === i || i.removeObstacle(e), !t && this.navMesh && this._tileCache && Xe(this.navMesh, this._tileCache);
1434
1853
  };
1435
- dt.prototype.isSupported = function () { return !!this.bjsRECAST; };
1436
- dt.prototype.getRandomSeed = function () { return this.bjsRECAST.getRandomSeed(); };
1437
- dt.prototype.setRandomSeed = function (e) { this.bjsRECAST.setRandomSeed(e); };
1438
- dt.prototype.raycast = function (e, i) { var n; var r = this._navMeshQuery.findNearestPoly(e), a = this._navMeshQuery.raycast(r.nearestRef, e, i); if (0 < a.t && a.t < 1) {
1854
+ gt.prototype.isSupported = function () { return !!this.bjsRECAST; };
1855
+ gt.prototype.getRandomSeed = function () { return this.bjsRECAST.getRandomSeed(); };
1856
+ gt.prototype.setRandomSeed = function (e) { this.bjsRECAST.setRandomSeed(e); };
1857
+ gt.prototype.raycast = function (e, i) { var r; var n = this._navMeshQuery.findNearestPoly(e), a = this._navMeshQuery.raycast(n.nearestRef, e, i); if (0 < a.t && a.t < 1) {
1439
1858
  t.TmpVectors.Vector3[0].set(e.x, e.y, e.z), t.TmpVectors.Vector3[1].set(i.x, i.y, i.z);
1440
- var r_7 = t.Vector3.Distance(t.TmpVectors.Vector3[0], t.TmpVectors.Vector3[1]) * (null !== (n = null == a ? void 0 : a.t) && void 0 !== n ? n : 0), s_5 = t.TmpVectors.Vector3[1].subtract(t.TmpVectors.Vector3[0]).normalize();
1441
- return { hit: !0, hitPoint: t.TmpVectors.Vector3[0].add(s_5.multiplyByFloats(r_7, r_7, r_7)) };
1859
+ var n_10 = t.Vector3.Distance(t.TmpVectors.Vector3[0], t.TmpVectors.Vector3[1]) * (null !== (r = null == a ? void 0 : a.t) && void 0 !== r ? r : 0), s_6 = t.TmpVectors.Vector3[1].subtract(t.TmpVectors.Vector3[0]).normalize();
1860
+ return { hit: !0, hitPoint: t.TmpVectors.Vector3[0].add(s_6.multiplyByFloats(n_10, n_10, n_10)) };
1442
1861
  } return { hit: !1 }; };
1443
- dt.prototype.moveAlongWithVelocity = function (e, t, i) { var _a = this._navMeshQuery.findClosestPoint({ x: e.x, y: e.y, z: e.z }, i), n = _a.point, r = _a.polyRef, a = this._navMeshQuery.moveAlongSurface(r, n, { x: n.x + t.x, y: n.y + t.y, z: n.z + t.z }, i).resultPosition, s = this._navMeshQuery.getPolyHeight(r, a); return { position: { x: a.x, y: s.success ? s.height : a.y, z: a.z }, polyRef: r, height: s.height }; };
1444
- dt.prototype._processNavMeshResult = function (e) { if (!(null == e ? void 0 : e.navMesh) || !(null == e ? void 0 : e.navMeshQuery))
1862
+ gt.prototype.moveAlongWithVelocity = function (e, t, i) { var _a = this._navMeshQuery.findClosestPoint({ x: e.x, y: e.y, z: e.z }, i), r = _a.point, n = _a.polyRef, a = this._navMeshQuery.moveAlongSurface(n, r, { x: r.x + t.x, y: r.y + t.y, z: r.z + t.z }, i).resultPosition, s = this._navMeshQuery.getPolyHeight(n, a); return { position: { x: a.x, y: s.success ? s.height : a.y, z: a.z }, polyRef: n, height: s.height }; };
1863
+ gt.prototype._processNavMeshResult = function (e) { if (!(null == e ? void 0 : e.navMesh) || !(null == e ? void 0 : e.navMeshQuery))
1445
1864
  throw new Error("Unable to create navmesh. No navMesh or navMeshQuery returned."); return this.navMesh = e.navMesh, this._navMeshQuery = e.navMeshQuery, this._intermediates = e.intermediates, this._tileCache = e.tileCache, { navMesh: e.navMesh, navMeshQuery: e.navMeshQuery, intermediates: e.intermediates, tileCache: e.tileCache }; };
1446
- dt.prototype._preprocessParameters = function (e) { var t, i; void 0 === e.maxObstacles && (e.tileSize = null !== (t = e.tileSize) && void 0 !== t ? t : 32, e.maxObstacles = 128), e.walkableSlopeAngle = Math.max(.1, null !== (i = e.walkableSlopeAngle) && void 0 !== i ? i : 60); };
1447
- return dt;
1865
+ gt.prototype._preprocessParameters = function (e) { var t, i; void 0 === e.maxObstacles && (e.tileSize = null !== (t = e.tileSize) && void 0 !== t ? t : 32, e.maxObstacles = 128), e.walkableSlopeAngle = Math.max(.1, null !== (i = e.walkableSlopeAngle) && void 0 !== i ? i : 60); };
1866
+ return gt;
1448
1867
  }());
1449
- function ht(e, t) { var i = e.x, n = e.z, r = t.x, a = t.z; var s; return s = Math.abs(r - i) >= Math.abs(a - n) ? { x: r, z: n } : { x: i, z: a }, s; }
1450
- var ut = { HEIGHTFIELD_SOLID: "heightfield solid", HEIGHTFIELD_WALKABLE: "heightfield walkable", COMPACT_HEIGHTFIELD_SOLID: "compact heightfield solid", COMPACT_HEIGHTFIELD_REGIONS: "compact heightfield regions", COMPACT_HEIGHTFIELD_DISTANCE: "compact heightfield distance", RAW_CONTOURS: "raw contours", CONTOURS: "contours", POLY_MESH: "poly mesh", POLY_MESH_DETAIL: "poly mesh detail", NAVMESH: "navmesh", NAVMESH_BV_TREE: "navmesh bv tree" };
1451
- var mt = /** @class */ (function () {
1452
- function mt(e, i) {
1453
- var n, r, a, s;
1868
+ function vt(e, t) { var i = e.x, r = e.z, n = t.x, a = t.z; var s; return s = Math.abs(n - i) >= Math.abs(a - r) ? { x: n, z: r } : { x: i, z: a }, s; }
1869
+ var _t = { HEIGHTFIELD_SOLID: "heightfield solid", HEIGHTFIELD_WALKABLE: "heightfield walkable", COMPACT_HEIGHTFIELD_SOLID: "compact heightfield solid", COMPACT_HEIGHTFIELD_REGIONS: "compact heightfield regions", COMPACT_HEIGHTFIELD_DISTANCE: "compact heightfield distance", RAW_CONTOURS: "raw contours", CONTOURS: "contours", POLY_MESH: "poly mesh", POLY_MESH_DETAIL: "poly mesh detail", NAVMESH: "navmesh", NAVMESH_BV_TREE: "navmesh bv tree" };
1870
+ var St = /** @class */ (function () {
1871
+ function St(e, i) {
1872
+ var r, n, a, s;
1454
1873
  this._scene = e, this.lineMaterials = [], this.getIntermediates = function (e) {
1455
- var e_60, _a, e_61, _b;
1456
- var t = [], i = [], n = [], r = [], a = [];
1874
+ var e_72, _a, e_73, _b;
1875
+ var t = [], i = [], r = [], n = [], a = [];
1457
1876
  if (e)
1458
1877
  if ("solo" === e.type)
1459
- e.heightfield && t.push(e.heightfield), e.compactHeightfield && i.push(e.compactHeightfield), e.contourSet && n.push(e.contourSet), e.polyMesh && r.push(e.polyMesh), e.polyMeshDetail && a.push(e.polyMeshDetail);
1878
+ e.heightfield && t.push(e.heightfield), e.compactHeightfield && i.push(e.compactHeightfield), e.contourSet && r.push(e.contourSet), e.polyMesh && n.push(e.polyMesh), e.polyMeshDetail && a.push(e.polyMeshDetail);
1460
1879
  else if ("tiled" === e.type)
1461
1880
  try {
1462
1881
  for (var _c = __values(e.tileIntermediates), _d = _c.next(); !_d.done; _d = _c.next()) {
1463
- var s_6 = _d.value;
1464
- s_6.heightfield && t.push(s_6.heightfield), s_6.compactHeightfield && i.push(s_6.compactHeightfield), s_6.contourSet && n.push(s_6.contourSet), s_6.polyMesh && r.push(s_6.polyMesh), s_6.polyMeshDetail && a.push(s_6.polyMeshDetail);
1882
+ var s_7 = _d.value;
1883
+ s_7.heightfield && t.push(s_7.heightfield), s_7.compactHeightfield && i.push(s_7.compactHeightfield), s_7.contourSet && r.push(s_7.contourSet), s_7.polyMesh && n.push(s_7.polyMesh), s_7.polyMeshDetail && a.push(s_7.polyMeshDetail);
1465
1884
  }
1466
1885
  }
1467
- catch (e_60_1) { e_60 = { error: e_60_1 }; }
1886
+ catch (e_72_1) { e_72 = { error: e_72_1 }; }
1468
1887
  finally {
1469
1888
  try {
1470
1889
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
1471
1890
  }
1472
- finally { if (e_60) throw e_60.error; }
1891
+ finally { if (e_72) throw e_72.error; }
1473
1892
  }
1474
1893
  else if ("tilecache" === e.type)
1475
1894
  try {
1476
1895
  for (var _f = __values(e.tileIntermediates), _g = _f.next(); !_g.done; _g = _f.next()) {
1477
- var n_11 = _g.value;
1478
- n_11.heightfield && t.push(n_11.heightfield), n_11.compactHeightfield && i.push(n_11.compactHeightfield);
1896
+ var r_14 = _g.value;
1897
+ r_14.heightfield && t.push(r_14.heightfield), r_14.compactHeightfield && i.push(r_14.compactHeightfield);
1479
1898
  }
1480
1899
  }
1481
- catch (e_61_1) { e_61 = { error: e_61_1 }; }
1900
+ catch (e_73_1) { e_73 = { error: e_73_1 }; }
1482
1901
  finally {
1483
1902
  try {
1484
1903
  if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
1485
1904
  }
1486
- finally { if (e_61) throw e_61.error; }
1905
+ finally { if (e_73) throw e_73.error; }
1487
1906
  }
1488
- return { heightfieldList: t, compactHeightfieldList: i, contourSetList: n, polyMeshList: r, polyMeshDetailList: a };
1489
- }, this._debugDrawerUtils = new (Ge().DebugDrawerUtils), this._primitiveTypes = null !== (n = null == i ? void 0 : i.primitiveTypes) && void 0 !== n ? n : ["points", "lines", "tris", "quads"], this.debugDrawerParentNode = (null === (r = null == i ? void 0 : i.parent) || void 0 === r ? void 0 : r.node) instanceof t.TransformNode ? i.parent.node : new t.TransformNode(null !== (s = null === (a = null == i ? void 0 : i.parent) || void 0 === a ? void 0 : a.node) && void 0 !== s ? s : "nav-mesh-debug-parent", this._scene);
1907
+ return { heightfieldList: t, compactHeightfieldList: i, contourSetList: r, polyMeshList: n, polyMeshDetailList: a };
1908
+ }, this._debugDrawerUtils = new (Ze().DebugDrawerUtils), this._primitiveTypes = null !== (r = null == i ? void 0 : i.primitiveTypes) && void 0 !== r ? r : ["points", "lines", "tris", "quads"], this.debugDrawerParentNode = (null === (n = null == i ? void 0 : i.parent) || void 0 === n ? void 0 : n.node) instanceof t.TransformNode ? i.parent.node : new t.TransformNode(null !== (s = null === (a = null == i ? void 0 : i.parent) || void 0 === a ? void 0 : a.node) && void 0 !== s ? s : "nav-mesh-debug-parent", this._scene);
1490
1909
  var o = null == i ? void 0 : i.materials;
1491
- (null == o ? void 0 : o.triMaterial) ? this.triMaterial = o.triMaterial : (this.triMaterial = new t.StandardMaterial("nav-debug-tris-material"), this.triMaterial.backFaceCulling = !1, this.triMaterial.specularColor = t.Color3.Black(), this.triMaterial.alpha = .5), (null == o ? void 0 : o.pointMaterial) ? this.pointMaterial = o.pointMaterial : (this.pointMaterial = new t.StandardMaterial("nav-debug-points-material"), this.pointMaterial.backFaceCulling = !1, this.pointMaterial.specularColor = t.Color3.Black()), (null == o ? void 0 : o.lineMaterialOptions) ? this._lineMaterialOptions = o.lineMaterialOptions : this._lineMaterialOptions = { greasedLineMaterialOptions: { width: 2, sizeAttenuation: !0 }, greasedLineMeshOptions: {} }, this._pointMesh = t.CreateBox(mt.NAV_MESH_DEBUG_NAME_POINTS, { size: .02 });
1910
+ (null == o ? void 0 : o.triMaterial) ? this.triMaterial = o.triMaterial : (this.triMaterial = new t.StandardMaterial("nav-debug-tris-material"), this.triMaterial.backFaceCulling = !1, this.triMaterial.specularColor = t.Color3.Black(), this.triMaterial.alpha = .5), (null == o ? void 0 : o.pointMaterial) ? this.pointMaterial = o.pointMaterial : (this.pointMaterial = new t.StandardMaterial("nav-debug-points-material"), this.pointMaterial.backFaceCulling = !1, this.pointMaterial.specularColor = t.Color3.Black()), (null == o ? void 0 : o.lineMaterialOptions) ? this._lineMaterialOptions = o.lineMaterialOptions : this._lineMaterialOptions = { greasedLineMaterialOptions: { width: 2, sizeAttenuation: !0 }, greasedLineMeshOptions: {} }, this._pointMesh = t.CreateBox(St.NAV_MESH_DEBUG_NAME_POINTS, { size: .02 });
1492
1911
  }
1493
- Object.defineProperty(mt.prototype, "primitiveTypes", {
1912
+ Object.defineProperty(St.prototype, "primitiveTypes", {
1494
1913
  get: function () { return this._primitiveTypes; },
1495
1914
  set: function (e) { this._primitiveTypes = e; },
1496
1915
  enumerable: false,
1497
1916
  configurable: true
1498
1917
  });
1499
- mt.prototype.clear = function () {
1500
- var e_62, _a;
1918
+ St.prototype.clear = function () {
1919
+ var e_74, _a;
1501
1920
  try {
1502
1921
  for (var _b = __values(this.debugDrawerParentNode.getChildMeshes()), _c = _b.next(); !_c.done; _c = _b.next()) {
1503
- var e_63 = _c.value;
1504
- e_63.dispose();
1922
+ var e_75 = _c.value;
1923
+ e_75.dispose();
1505
1924
  }
1506
1925
  }
1507
- catch (e_62_1) { e_62 = { error: e_62_1 }; }
1926
+ catch (e_74_1) { e_74 = { error: e_74_1 }; }
1508
1927
  finally {
1509
1928
  try {
1510
1929
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1511
1930
  }
1512
- finally { if (e_62) throw e_62.error; }
1931
+ finally { if (e_74) throw e_74.error; }
1513
1932
  }
1514
1933
  };
1515
- mt.prototype.dispose = function () { this.clear(), this._debugDrawerUtils.dispose(), this._pointMesh.dispose(), this.triMaterial.dispose(), this.pointMaterial.dispose(); };
1516
- mt.prototype.drawPrimitives = function (e, t) {
1517
- var e_64, _a;
1934
+ St.prototype.dispose = function () { this.clear(), this._debugDrawerUtils.dispose(), this._pointMesh.dispose(), this.triMaterial.dispose(), this.pointMaterial.dispose(); };
1935
+ St.prototype.drawPrimitives = function (e, t) {
1936
+ var e_76, _a;
1518
1937
  var i;
1519
- var n = null;
1938
+ var r = null;
1520
1939
  try {
1521
- for (var e_65 = __values(e), e_65_1 = e_65.next(); !e_65_1.done; e_65_1 = e_65.next()) {
1522
- var t_17 = e_65_1.value;
1523
- if (this._primitiveTypes.includes(t_17.type))
1524
- switch (t_17.type) {
1940
+ for (var e_77 = __values(e), e_77_1 = e_77.next(); !e_77_1.done; e_77_1 = e_77.next()) {
1941
+ var t_22 = e_77_1.value;
1942
+ if (this._primitiveTypes.includes(t_22.type))
1943
+ switch (t_22.type) {
1525
1944
  case "points":
1526
- this._drawPoints(t_17);
1945
+ this._drawPoints(t_22);
1527
1946
  break;
1528
1947
  case "lines": {
1529
- var e_66 = this._drawLines(t_17, n);
1530
- n || (n = e_66);
1948
+ var e_78 = this._drawLines(t_22, r);
1949
+ r || (r = e_78);
1531
1950
  break;
1532
1951
  }
1533
1952
  case "tris":
1534
- this._drawTris(t_17);
1953
+ this._drawTris(t_22);
1535
1954
  break;
1536
- case "quads": this._drawQuads(t_17);
1955
+ case "quads": this._drawQuads(t_22);
1537
1956
  }
1538
1957
  }
1539
1958
  }
1540
- catch (e_64_1) { e_64 = { error: e_64_1 }; }
1959
+ catch (e_76_1) { e_76 = { error: e_76_1 }; }
1541
1960
  finally {
1542
1961
  try {
1543
- if (e_65_1 && !e_65_1.done && (_a = e_65.return)) _a.call(e_65);
1962
+ if (e_77_1 && !e_77_1.done && (_a = e_77.return)) _a.call(e_77);
1544
1963
  }
1545
- finally { if (e_64) throw e_64.error; }
1964
+ finally { if (e_76) throw e_76.error; }
1546
1965
  }
1547
- null == n || n.updateLazy(), (null === (i = null == t ? void 0 : t.joinMeshes) || void 0 === i || i) && this._joinDebugMeshes();
1966
+ null == r || r.updateLazy(), (null === (i = null == t ? void 0 : t.joinMeshes) || void 0 === i || i) && this._joinDebugMeshes();
1548
1967
  };
1549
- mt.prototype.drawHeightfieldSolid = function (e) { var t = this._debugDrawerUtils.drawHeightfieldSolid(e); this.drawPrimitives(t); };
1550
- mt.prototype.drawHeightfieldWalkable = function (e) { var t = this._debugDrawerUtils.drawHeightfieldWalkable(e); this.drawPrimitives(t); };
1551
- mt.prototype.drawCompactHeightfieldSolid = function (e) { var t = this._debugDrawerUtils.drawCompactHeightfieldSolid(e); this.drawPrimitives(t); };
1552
- mt.prototype.drawCompactHeightfieldRegions = function (e) { var t = this._debugDrawerUtils.drawCompactHeightfieldRegions(e); this.drawPrimitives(t); };
1553
- mt.prototype.drawCompactHeightfieldDistance = function (e) { var t = this._debugDrawerUtils.drawCompactHeightfieldDistance(e); this.drawPrimitives(t); };
1554
- mt.prototype.drawHeightfieldLayer = function (e, t) { var i = this._debugDrawerUtils.drawHeightfieldLayer(e, t); this.drawPrimitives(i); };
1555
- mt.prototype.drawHeightfieldLayers = function (e) { var t = this._debugDrawerUtils.drawHeightfieldLayers(e); this.drawPrimitives(t); };
1556
- mt.prototype.drawRegionConnections = function (e, t) {
1968
+ St.prototype.drawHeightfieldSolid = function (e) { var t = this._debugDrawerUtils.drawHeightfieldSolid(e); this.drawPrimitives(t); };
1969
+ St.prototype.drawHeightfieldWalkable = function (e) { var t = this._debugDrawerUtils.drawHeightfieldWalkable(e); this.drawPrimitives(t); };
1970
+ St.prototype.drawCompactHeightfieldSolid = function (e) { var t = this._debugDrawerUtils.drawCompactHeightfieldSolid(e); this.drawPrimitives(t); };
1971
+ St.prototype.drawCompactHeightfieldRegions = function (e) { var t = this._debugDrawerUtils.drawCompactHeightfieldRegions(e); this.drawPrimitives(t); };
1972
+ St.prototype.drawCompactHeightfieldDistance = function (e) { var t = this._debugDrawerUtils.drawCompactHeightfieldDistance(e); this.drawPrimitives(t); };
1973
+ St.prototype.drawHeightfieldLayer = function (e, t) { var i = this._debugDrawerUtils.drawHeightfieldLayer(e, t); this.drawPrimitives(i); };
1974
+ St.prototype.drawHeightfieldLayers = function (e) { var t = this._debugDrawerUtils.drawHeightfieldLayers(e); this.drawPrimitives(t); };
1975
+ St.prototype.drawRegionConnections = function (e, t) {
1557
1976
  if (t === void 0) { t = 1; }
1558
1977
  var i = this._debugDrawerUtils.drawRegionConnections(e, t);
1559
1978
  this.drawPrimitives(i);
1560
1979
  };
1561
- mt.prototype.drawRawContours = function (e, t) {
1980
+ St.prototype.drawRawContours = function (e, t) {
1562
1981
  if (t === void 0) { t = 1; }
1563
1982
  var i = this._debugDrawerUtils.drawRawContours(e, t);
1564
1983
  this.drawPrimitives(i);
1565
1984
  };
1566
- mt.prototype.drawContours = function (e, t) {
1985
+ St.prototype.drawContours = function (e, t) {
1567
1986
  if (t === void 0) { t = 1; }
1568
1987
  var i = this._debugDrawerUtils.drawContours(e, t);
1569
1988
  this.drawPrimitives(i);
1570
1989
  };
1571
- mt.prototype.drawPolyMesh = function (e) { var t = this._debugDrawerUtils.drawPolyMesh(e); this.drawPrimitives(t); };
1572
- mt.prototype.drawPolyMeshDetail = function (e) { var t = this._debugDrawerUtils.drawPolyMeshDetail(e); this.drawPrimitives(t); };
1573
- mt.prototype.drawNavMesh = function (e, t) {
1990
+ St.prototype.drawPolyMesh = function (e) { var t = this._debugDrawerUtils.drawPolyMesh(e); this.drawPrimitives(t); };
1991
+ St.prototype.drawPolyMeshDetail = function (e) { var t = this._debugDrawerUtils.drawPolyMeshDetail(e); this.drawPrimitives(t); };
1992
+ St.prototype.drawNavMesh = function (e, t) {
1574
1993
  if (t === void 0) { t = 0; }
1575
1994
  var i = this._debugDrawerUtils.drawNavMesh(e, t);
1576
1995
  this.drawPrimitives(i);
1577
1996
  };
1578
- mt.prototype.drawNavMeshWithClosedList = function (e, t, i) {
1997
+ St.prototype.drawNavMeshWithClosedList = function (e, t, i) {
1579
1998
  if (i === void 0) { i = 0; }
1580
- var n = this._debugDrawerUtils.drawNavMeshWithClosedList(e, t, i);
1581
- this.drawPrimitives(n);
1999
+ var r = this._debugDrawerUtils.drawNavMeshWithClosedList(e, t, i);
2000
+ this.drawPrimitives(r);
1582
2001
  };
1583
- mt.prototype.drawNavMeshNodes = function (e) { var t = this._debugDrawerUtils.drawNavMeshNodes(e); this.drawPrimitives(t); };
1584
- mt.prototype.drawNavMeshBVTree = function (e) { var t = this._debugDrawerUtils.drawNavMeshBVTree(e); this.drawPrimitives(t); };
1585
- mt.prototype.drawNavMeshPortals = function (e) { var t = this._debugDrawerUtils.drawNavMeshPortals(e); this.drawPrimitives(t); };
1586
- mt.prototype.drawNavMeshPolysWithFlags = function (e, t, i) { var n = this._debugDrawerUtils.drawNavMeshPolysWithFlags(e, t, i); this.drawPrimitives(n); };
1587
- mt.prototype.drawNavMeshPoly = function (e, t, i) { var n = this._debugDrawerUtils.drawNavMeshPoly(e, t, i); this.drawPrimitives(n); };
1588
- mt.prototype.draw = function (e, t, i, n) {
1589
- var e_67, _a, e_68, _b, e_69, _c, e_70, _d, e_71, _f, e_72, _g, e_73, _h, e_74, _j, e_75, _k;
2002
+ St.prototype.drawNavMeshNodes = function (e) { var t = this._debugDrawerUtils.drawNavMeshNodes(e); this.drawPrimitives(t); };
2003
+ St.prototype.drawNavMeshBVTree = function (e) { var t = this._debugDrawerUtils.drawNavMeshBVTree(e); this.drawPrimitives(t); };
2004
+ St.prototype.drawNavMeshPortals = function (e) { var t = this._debugDrawerUtils.drawNavMeshPortals(e); this.drawPrimitives(t); };
2005
+ St.prototype.drawNavMeshPolysWithFlags = function (e, t, i) { var r = this._debugDrawerUtils.drawNavMeshPolysWithFlags(e, t, i); this.drawPrimitives(r); };
2006
+ St.prototype.drawNavMeshPoly = function (e, t, i) { var r = this._debugDrawerUtils.drawNavMeshPoly(e, t, i); this.drawPrimitives(r); };
2007
+ St.prototype.draw = function (e, t, i, r) {
2008
+ var e_79, _a, e_80, _b, e_81, _c, e_82, _d, e_83, _f, e_84, _g, e_85, _h, e_86, _j, e_87, _k;
1590
2009
  this.clear();
1591
- var _l = this.getIntermediates(t), r = _l.heightfieldList, a = _l.compactHeightfieldList, s = _l.contourSetList, o = _l.polyMeshList, l = _l.polyMeshDetailList;
1592
- if (n === ut.HEIGHTFIELD_SOLID)
2010
+ var _l = this.getIntermediates(t), n = _l.heightfieldList, a = _l.compactHeightfieldList, s = _l.contourSetList, o = _l.polyMeshList, l = _l.polyMeshDetailList;
2011
+ if (r === _t.HEIGHTFIELD_SOLID)
1593
2012
  try {
1594
- for (var r_8 = __values(r), r_8_1 = r_8.next(); !r_8_1.done; r_8_1 = r_8.next()) {
1595
- var e_76 = r_8_1.value;
1596
- this.drawHeightfieldSolid(e_76);
2013
+ for (var n_11 = __values(n), n_11_1 = n_11.next(); !n_11_1.done; n_11_1 = n_11.next()) {
2014
+ var e_88 = n_11_1.value;
2015
+ this.drawHeightfieldSolid(e_88);
1597
2016
  }
1598
2017
  }
1599
- catch (e_67_1) { e_67 = { error: e_67_1 }; }
2018
+ catch (e_79_1) { e_79 = { error: e_79_1 }; }
1600
2019
  finally {
1601
2020
  try {
1602
- if (r_8_1 && !r_8_1.done && (_a = r_8.return)) _a.call(r_8);
2021
+ if (n_11_1 && !n_11_1.done && (_a = n_11.return)) _a.call(n_11);
1603
2022
  }
1604
- finally { if (e_67) throw e_67.error; }
2023
+ finally { if (e_79) throw e_79.error; }
1605
2024
  }
1606
- else if (n === ut.HEIGHTFIELD_WALKABLE)
2025
+ else if (r === _t.HEIGHTFIELD_WALKABLE)
1607
2026
  try {
1608
- for (var r_9 = __values(r), r_9_1 = r_9.next(); !r_9_1.done; r_9_1 = r_9.next()) {
1609
- var e_77 = r_9_1.value;
1610
- this.drawHeightfieldWalkable(e_77);
2027
+ for (var n_12 = __values(n), n_12_1 = n_12.next(); !n_12_1.done; n_12_1 = n_12.next()) {
2028
+ var e_89 = n_12_1.value;
2029
+ this.drawHeightfieldWalkable(e_89);
1611
2030
  }
1612
2031
  }
1613
- catch (e_68_1) { e_68 = { error: e_68_1 }; }
2032
+ catch (e_80_1) { e_80 = { error: e_80_1 }; }
1614
2033
  finally {
1615
2034
  try {
1616
- if (r_9_1 && !r_9_1.done && (_b = r_9.return)) _b.call(r_9);
2035
+ if (n_12_1 && !n_12_1.done && (_b = n_12.return)) _b.call(n_12);
1617
2036
  }
1618
- finally { if (e_68) throw e_68.error; }
2037
+ finally { if (e_80) throw e_80.error; }
1619
2038
  }
1620
- else if (n === ut.COMPACT_HEIGHTFIELD_SOLID)
2039
+ else if (r === _t.COMPACT_HEIGHTFIELD_SOLID)
1621
2040
  try {
1622
- for (var a_7 = __values(a), a_7_1 = a_7.next(); !a_7_1.done; a_7_1 = a_7.next()) {
1623
- var e_78 = a_7_1.value;
1624
- this.drawCompactHeightfieldSolid(e_78);
2041
+ for (var a_8 = __values(a), a_8_1 = a_8.next(); !a_8_1.done; a_8_1 = a_8.next()) {
2042
+ var e_90 = a_8_1.value;
2043
+ this.drawCompactHeightfieldSolid(e_90);
1625
2044
  }
1626
2045
  }
1627
- catch (e_69_1) { e_69 = { error: e_69_1 }; }
2046
+ catch (e_81_1) { e_81 = { error: e_81_1 }; }
1628
2047
  finally {
1629
2048
  try {
1630
- if (a_7_1 && !a_7_1.done && (_c = a_7.return)) _c.call(a_7);
2049
+ if (a_8_1 && !a_8_1.done && (_c = a_8.return)) _c.call(a_8);
1631
2050
  }
1632
- finally { if (e_69) throw e_69.error; }
2051
+ finally { if (e_81) throw e_81.error; }
1633
2052
  }
1634
- else if (n === ut.COMPACT_HEIGHTFIELD_REGIONS)
2053
+ else if (r === _t.COMPACT_HEIGHTFIELD_REGIONS)
1635
2054
  try {
1636
- for (var a_8 = __values(a), a_8_1 = a_8.next(); !a_8_1.done; a_8_1 = a_8.next()) {
1637
- var e_79 = a_8_1.value;
1638
- this.drawCompactHeightfieldRegions(e_79);
2055
+ for (var a_9 = __values(a), a_9_1 = a_9.next(); !a_9_1.done; a_9_1 = a_9.next()) {
2056
+ var e_91 = a_9_1.value;
2057
+ this.drawCompactHeightfieldRegions(e_91);
1639
2058
  }
1640
2059
  }
1641
- catch (e_70_1) { e_70 = { error: e_70_1 }; }
2060
+ catch (e_82_1) { e_82 = { error: e_82_1 }; }
1642
2061
  finally {
1643
2062
  try {
1644
- if (a_8_1 && !a_8_1.done && (_d = a_8.return)) _d.call(a_8);
2063
+ if (a_9_1 && !a_9_1.done && (_d = a_9.return)) _d.call(a_9);
1645
2064
  }
1646
- finally { if (e_70) throw e_70.error; }
2065
+ finally { if (e_82) throw e_82.error; }
1647
2066
  }
1648
- else if (n === ut.COMPACT_HEIGHTFIELD_DISTANCE)
2067
+ else if (r === _t.COMPACT_HEIGHTFIELD_DISTANCE)
1649
2068
  try {
1650
- for (var a_9 = __values(a), a_9_1 = a_9.next(); !a_9_1.done; a_9_1 = a_9.next()) {
1651
- var e_80 = a_9_1.value;
1652
- this.drawCompactHeightfieldDistance(e_80);
2069
+ for (var a_10 = __values(a), a_10_1 = a_10.next(); !a_10_1.done; a_10_1 = a_10.next()) {
2070
+ var e_92 = a_10_1.value;
2071
+ this.drawCompactHeightfieldDistance(e_92);
1653
2072
  }
1654
2073
  }
1655
- catch (e_71_1) { e_71 = { error: e_71_1 }; }
2074
+ catch (e_83_1) { e_83 = { error: e_83_1 }; }
1656
2075
  finally {
1657
2076
  try {
1658
- if (a_9_1 && !a_9_1.done && (_f = a_9.return)) _f.call(a_9);
2077
+ if (a_10_1 && !a_10_1.done && (_f = a_10.return)) _f.call(a_10);
1659
2078
  }
1660
- finally { if (e_71) throw e_71.error; }
2079
+ finally { if (e_83) throw e_83.error; }
1661
2080
  }
1662
- else if (n === ut.RAW_CONTOURS)
2081
+ else if (r === _t.RAW_CONTOURS)
1663
2082
  try {
1664
- for (var s_7 = __values(s), s_7_1 = s_7.next(); !s_7_1.done; s_7_1 = s_7.next()) {
1665
- var e_81 = s_7_1.value;
1666
- this.drawRawContours(e_81);
2083
+ for (var s_8 = __values(s), s_8_1 = s_8.next(); !s_8_1.done; s_8_1 = s_8.next()) {
2084
+ var e_93 = s_8_1.value;
2085
+ this.drawRawContours(e_93);
1667
2086
  }
1668
2087
  }
1669
- catch (e_72_1) { e_72 = { error: e_72_1 }; }
2088
+ catch (e_84_1) { e_84 = { error: e_84_1 }; }
1670
2089
  finally {
1671
2090
  try {
1672
- if (s_7_1 && !s_7_1.done && (_g = s_7.return)) _g.call(s_7);
2091
+ if (s_8_1 && !s_8_1.done && (_g = s_8.return)) _g.call(s_8);
1673
2092
  }
1674
- finally { if (e_72) throw e_72.error; }
2093
+ finally { if (e_84) throw e_84.error; }
1675
2094
  }
1676
- else if (n === ut.CONTOURS)
2095
+ else if (r === _t.CONTOURS)
1677
2096
  try {
1678
- for (var s_8 = __values(s), s_8_1 = s_8.next(); !s_8_1.done; s_8_1 = s_8.next()) {
1679
- var e_82 = s_8_1.value;
1680
- this.drawContours(e_82);
2097
+ for (var s_9 = __values(s), s_9_1 = s_9.next(); !s_9_1.done; s_9_1 = s_9.next()) {
2098
+ var e_94 = s_9_1.value;
2099
+ this.drawContours(e_94);
1681
2100
  }
1682
2101
  }
1683
- catch (e_73_1) { e_73 = { error: e_73_1 }; }
2102
+ catch (e_85_1) { e_85 = { error: e_85_1 }; }
1684
2103
  finally {
1685
2104
  try {
1686
- if (s_8_1 && !s_8_1.done && (_h = s_8.return)) _h.call(s_8);
2105
+ if (s_9_1 && !s_9_1.done && (_h = s_9.return)) _h.call(s_9);
1687
2106
  }
1688
- finally { if (e_73) throw e_73.error; }
2107
+ finally { if (e_85) throw e_85.error; }
1689
2108
  }
1690
- else if (n === ut.POLY_MESH)
2109
+ else if (r === _t.POLY_MESH)
1691
2110
  try {
1692
- for (var o_4 = __values(o), o_4_1 = o_4.next(); !o_4_1.done; o_4_1 = o_4.next()) {
1693
- var e_83 = o_4_1.value;
1694
- this.drawPolyMesh(e_83);
2111
+ for (var o_5 = __values(o), o_5_1 = o_5.next(); !o_5_1.done; o_5_1 = o_5.next()) {
2112
+ var e_95 = o_5_1.value;
2113
+ this.drawPolyMesh(e_95);
1695
2114
  }
1696
2115
  }
1697
- catch (e_74_1) { e_74 = { error: e_74_1 }; }
2116
+ catch (e_86_1) { e_86 = { error: e_86_1 }; }
1698
2117
  finally {
1699
2118
  try {
1700
- if (o_4_1 && !o_4_1.done && (_j = o_4.return)) _j.call(o_4);
2119
+ if (o_5_1 && !o_5_1.done && (_j = o_5.return)) _j.call(o_5);
1701
2120
  }
1702
- finally { if (e_74) throw e_74.error; }
2121
+ finally { if (e_86) throw e_86.error; }
1703
2122
  }
1704
- else if (n === ut.POLY_MESH_DETAIL)
2123
+ else if (r === _t.POLY_MESH_DETAIL)
1705
2124
  try {
1706
2125
  for (var l_5 = __values(l), l_5_1 = l_5.next(); !l_5_1.done; l_5_1 = l_5.next()) {
1707
- var e_84 = l_5_1.value;
1708
- this.drawPolyMeshDetail(e_84);
2126
+ var e_96 = l_5_1.value;
2127
+ this.drawPolyMeshDetail(e_96);
1709
2128
  }
1710
2129
  }
1711
- catch (e_75_1) { e_75 = { error: e_75_1 }; }
2130
+ catch (e_87_1) { e_87 = { error: e_87_1 }; }
1712
2131
  finally {
1713
2132
  try {
1714
2133
  if (l_5_1 && !l_5_1.done && (_k = l_5.return)) _k.call(l_5);
1715
2134
  }
1716
- finally { if (e_75) throw e_75.error; }
2135
+ finally { if (e_87) throw e_87.error; }
1717
2136
  }
1718
2137
  else
1719
- n === ut.NAVMESH ? this.drawNavMesh(e) : n === ut.NAVMESH_BV_TREE && this.drawNavMeshBVTree(e);
2138
+ r === _t.NAVMESH ? this.drawNavMesh(e) : r === _t.NAVMESH_BV_TREE && this.drawNavMeshBVTree(e);
1720
2139
  };
1721
- mt.prototype._drawPoints = function (e) { if (0 === e.vertices.length)
1722
- return; var i = new Float32Array(16 * e.vertices.length), n = new Float32Array(4 * e.vertices.length); for (var r_10 = 0; r_10 < e.vertices.length; r_10++) {
1723
- var _a = __read(e.vertices[r_10], 7), a_10 = _a[0], s_9 = _a[1], o_5 = _a[2], l_6 = _a[3], c_5 = _a[4], d_4 = _a[5], h_5 = _a[6];
1724
- n[4 * r_10] = l_6, n[4 * r_10 + 1] = c_5, n[4 * r_10 + 2] = d_4, n[4 * r_10 + 3] = h_5, t.Matrix.Translation(a_10, s_9, o_5).copyToArray(i, 16 * r_10);
1725
- } this._pointMesh.thinInstanceSetBuffer("matrix", i, 16), this._pointMesh.thinInstanceSetBuffer("color", n, 4), this._pointMesh.parent = this.debugDrawerParentNode; };
1726
- mt.prototype._drawLines = function (e, i) { if (0 === e.vertices.length)
1727
- return null; var n = [], r = []; for (var i_15 = 0; i_15 < e.vertices.length; i_15 += 2) {
1728
- var _a = __read(e.vertices[i_15], 6), a_11 = _a[0], s_10 = _a[1], o_6 = _a[2], l_7 = _a[3], c_6 = _a[4], d_5 = _a[5], _b = __read(e.vertices[i_15 + 1], 6), h_6 = _b[0], u_4 = _b[1], m_3 = _b[2], p_4 = _b[3], f_3 = _b[4], g_2 = _b[5];
1729
- n.push([a_11, s_10, o_6, h_6, u_4, m_3]), r.push(new t.Color3(l_7, c_6, d_5)), r.push(new t.Color3(p_4, f_3, g_2));
1730
- } var a = Object.assign(Object.assign({}, this._lineMaterialOptions.greasedLineMeshOptions), { points: n, instance: null != i ? i : void 0 }), s = Object.assign(Object.assign({}, this._lineMaterialOptions.greasedLineMaterialOptions), { colors: r }), o = t.CreateGreasedLine(mt.NAV_MESH_DEBUG_NAME_LINES, a, s); return o.parent = this.debugDrawerParentNode, this.lineMaterials.push(o.material), o; };
1731
- mt.prototype._drawTris = function (e) { if (0 === e.vertices.length)
1732
- return; var i = new Float32Array(3 * e.vertices.length), n = new Float32Array(4 * e.vertices.length); for (var t_18 = 0; t_18 < e.vertices.length; t_18++) {
1733
- var _a = __read(e.vertices[t_18], 6), r_11 = _a[0], a_12 = _a[1], s_11 = _a[2], o_7 = _a[3], l_8 = _a[4], c_7 = _a[5];
1734
- i[3 * t_18 + 0] = r_11, i[3 * t_18 + 1] = a_12, i[3 * t_18 + 2] = s_11, n[4 * t_18 + 0] = o_7, n[4 * t_18 + 1] = l_8, n[4 * t_18 + 2] = c_7, n[4 * t_18 + 3] = 1;
1735
- } var r = new t.VertexData; r.positions = i, r.colors = n; var a = new t.Mesh(mt.NAV_MESH_DEBUG_NAME_TRIS); a.isUnIndexed = !0, r.applyToMesh(a), a.material = this.triMaterial, a.parent = this.debugDrawerParentNode; };
1736
- mt.prototype._drawQuads = function (e) {
1737
- var e_85, _a;
2140
+ St.prototype._drawPoints = function (e) { if (0 === e.vertices.length)
2141
+ return; var i = new Float32Array(16 * e.vertices.length), r = new Float32Array(4 * e.vertices.length); for (var n_13 = 0; n_13 < e.vertices.length; n_13++) {
2142
+ var _a = __read(e.vertices[n_13], 7), a_11 = _a[0], s_10 = _a[1], o_6 = _a[2], l_6 = _a[3], c_5 = _a[4], u_4 = _a[5], h_5 = _a[6];
2143
+ r[4 * n_13] = l_6, r[4 * n_13 + 1] = c_5, r[4 * n_13 + 2] = u_4, r[4 * n_13 + 3] = h_5, t.Matrix.Translation(a_11, s_10, o_6).copyToArray(i, 16 * n_13);
2144
+ } this._pointMesh.thinInstanceSetBuffer("matrix", i, 16), this._pointMesh.thinInstanceSetBuffer("color", r, 4), this._pointMesh.parent = this.debugDrawerParentNode; };
2145
+ St.prototype._drawLines = function (e, i) { if (0 === e.vertices.length)
2146
+ return null; var r = [], n = []; for (var i_15 = 0; i_15 < e.vertices.length; i_15 += 2) {
2147
+ var _a = __read(e.vertices[i_15], 6), a_12 = _a[0], s_11 = _a[1], o_7 = _a[2], l_7 = _a[3], c_6 = _a[4], u_5 = _a[5], _b = __read(e.vertices[i_15 + 1], 6), h_6 = _b[0], d_4 = _b[1], m_3 = _b[2], p_4 = _b[3], f_3 = _b[4], g_2 = _b[5];
2148
+ r.push([a_12, s_11, o_7, h_6, d_4, m_3]), n.push(new t.Color3(l_7, c_6, u_5)), n.push(new t.Color3(p_4, f_3, g_2));
2149
+ } var a = Object.assign(Object.assign({}, this._lineMaterialOptions.greasedLineMeshOptions), { points: r, instance: null != i ? i : void 0 }), s = Object.assign(Object.assign({}, this._lineMaterialOptions.greasedLineMaterialOptions), { colors: n }), o = t.CreateGreasedLine(St.NAV_MESH_DEBUG_NAME_LINES, a, s); return o.parent = this.debugDrawerParentNode, this.lineMaterials.push(o.material), o; };
2150
+ St.prototype._drawTris = function (e) { if (0 === e.vertices.length)
2151
+ return; var i = new Float32Array(3 * e.vertices.length), r = new Float32Array(4 * e.vertices.length); for (var t_23 = 0; t_23 < e.vertices.length; t_23++) {
2152
+ var _a = __read(e.vertices[t_23], 6), n_14 = _a[0], a_13 = _a[1], s_12 = _a[2], o_8 = _a[3], l_8 = _a[4], c_7 = _a[5];
2153
+ i[3 * t_23 + 0] = n_14, i[3 * t_23 + 1] = a_13, i[3 * t_23 + 2] = s_12, r[4 * t_23 + 0] = o_8, r[4 * t_23 + 1] = l_8, r[4 * t_23 + 2] = c_7, r[4 * t_23 + 3] = 1;
2154
+ } var n = new t.VertexData; n.positions = i, n.colors = r; var a = new t.Mesh(St.NAV_MESH_DEBUG_NAME_TRIS); a.isUnIndexed = !0, n.applyToMesh(a), a.material = this.triMaterial, a.parent = this.debugDrawerParentNode; };
2155
+ St.prototype._drawQuads = function (e) {
2156
+ var e_97, _a;
1738
2157
  if (0 === e.vertices.length)
1739
2158
  return;
1740
- var i = [], n = [];
1741
- for (var t_19 = 0; t_19 < e.vertices.length; t_19 += 4) {
1742
- var r_13 = [e.vertices[t_19], e.vertices[t_19 + 1], e.vertices[t_19 + 2], e.vertices[t_19], e.vertices[t_19 + 2], e.vertices[t_19 + 3]];
2159
+ var i = [], r = [];
2160
+ for (var t_24 = 0; t_24 < e.vertices.length; t_24 += 4) {
2161
+ var n_16 = [e.vertices[t_24], e.vertices[t_24 + 1], e.vertices[t_24 + 2], e.vertices[t_24], e.vertices[t_24 + 2], e.vertices[t_24 + 3]];
1743
2162
  try {
1744
- for (var r_12 = (e_85 = void 0, __values(r_13)), r_12_1 = r_12.next(); !r_12_1.done; r_12_1 = r_12.next()) {
1745
- var _b = __read(r_12_1.value, 6), e_86 = _b[0], t_20 = _b[1], a_13 = _b[2], s_12 = _b[3], o_8 = _b[4], l_9 = _b[5];
1746
- i.push(e_86, t_20, a_13), n.push(s_12, o_8, l_9, 1);
2163
+ for (var n_15 = (e_97 = void 0, __values(n_16)), n_15_1 = n_15.next(); !n_15_1.done; n_15_1 = n_15.next()) {
2164
+ var _b = __read(n_15_1.value, 6), e_98 = _b[0], t_25 = _b[1], a_14 = _b[2], s_13 = _b[3], o_9 = _b[4], l_9 = _b[5];
2165
+ i.push(e_98, t_25, a_14), r.push(s_13, o_9, l_9, 1);
1747
2166
  }
1748
2167
  }
1749
- catch (e_85_1) { e_85 = { error: e_85_1 }; }
2168
+ catch (e_97_1) { e_97 = { error: e_97_1 }; }
1750
2169
  finally {
1751
2170
  try {
1752
- if (r_12_1 && !r_12_1.done && (_a = r_12.return)) _a.call(r_12);
2171
+ if (n_15_1 && !n_15_1.done && (_a = n_15.return)) _a.call(n_15);
1753
2172
  }
1754
- finally { if (e_85) throw e_85.error; }
2173
+ finally { if (e_97) throw e_97.error; }
1755
2174
  }
1756
2175
  }
1757
- var r = new t.VertexData;
1758
- r.positions = i, r.colors = n;
1759
- var a = new t.Mesh(mt.NAV_MESH_DEBUG_NAME_QUADS);
1760
- a.isUnIndexed = !0, r.applyToMesh(a), a.material = this.triMaterial, a.parent = this.debugDrawerParentNode;
2176
+ var n = new t.VertexData;
2177
+ n.positions = i, n.colors = r;
2178
+ var a = new t.Mesh(St.NAV_MESH_DEBUG_NAME_QUADS);
2179
+ a.isUnIndexed = !0, n.applyToMesh(a), a.material = this.triMaterial, a.parent = this.debugDrawerParentNode;
1761
2180
  };
1762
- mt.prototype._joinDebugMeshes = function () {
2181
+ St.prototype._joinDebugMeshes = function () {
1763
2182
  var _this = this;
1764
- var e = this._scene.meshes.filter(function (e) { return e.name === mt.NAV_MESH_DEBUG_NAME; });
2183
+ var e = this._scene.meshes.filter(function (e) { return e.name === St.NAV_MESH_DEBUG_NAME; });
1765
2184
  e.forEach(function (e) { _this._convertUnindexedToIndexed(e); });
1766
2185
  var i = t.Mesh.MergeMeshes(e, !0);
1767
- i && (i.name = mt.NAV_MESH_DEBUG_NAME, i.parent = this.debugDrawerParentNode);
2186
+ i && (i.name = St.NAV_MESH_DEBUG_NAME, i.parent = this.debugDrawerParentNode);
1768
2187
  };
1769
- mt.prototype._convertUnindexedToIndexed = function (e) { var i = t.VertexData.ExtractFromMesh(e).positions; if (!i || i.length % 9 != 0)
1770
- return void t.Logger.Warn("Mesh must be fully unindexed with triangles."); var n = i.length / 3, r = Array.from({ length: n }, function (e, t) { return t; }), a = new t.VertexData; a.positions = i, a.indices = r, a.applyToMesh(e, !0); };
1771
- return mt;
2188
+ St.prototype._convertUnindexedToIndexed = function (e) { var i = t.VertexData.ExtractFromMesh(e).positions; if (!i || i.length % 9 != 0)
2189
+ return void t.Logger.Warn("Mesh must be fully unindexed with triangles."); var r = i.length / 3, n = Array.from({ length: r }, function (e, t) { return t; }), a = new t.VertexData; a.positions = i, a.indices = n, a.applyToMesh(e, !0); };
2190
+ return St;
1772
2191
  }());
1773
- mt.NAV_MESH_DEBUG_NAME = "nav-mesh-debug", mt.NAV_MESH_DEBUG_NAME_POINTS = "nav-mesh-debug-points", mt.NAV_MESH_DEBUG_NAME_TRIS = "nav-mesh-debug-tris", mt.NAV_MESH_DEBUG_NAME_QUADS = "nav-mesh-debug-quads", mt.NAV_MESH_DEBUG_NAME_LINES = "nav-mesh-debug-lines";
1774
- var pt = "atmosphereFunctions", ft = "#include<intersectionFunctions>\nconst MultiScatteringLutSize=vec2f(32.,32.);const MultiScatteringLutDomainInUVSpace=(MultiScatteringLutSize-vec2f(1.))/MultiScatteringLutSize;const MultiScatteringLutHalfTexelSize=vec2f(.5)/MultiScatteringLutSize;const NumAerialPerspectiveLutLayers=32.;const AerialPerspectiveLutSize=vec3f(16.,64.,NumAerialPerspectiveLutLayers);const DiffuseSkyIrradianceLutSize=vec2f(64.,16.);const DiffuseSkyIrradianceLutDomainInUVSpace=(DiffuseSkyIrradianceLutSize-vec2f(1.))/DiffuseSkyIrradianceLutSize;const DiffuseSkyIrradianceLutHalfTexelSize=vec2f(.5)/DiffuseSkyIrradianceLutSize;const SkyViewLutSize=vec2f(128.,128.);const SkyViewLutDomainInUVSpace=(SkyViewLutSize-vec2f(1.))/SkyViewLutSize;const SkyViewLutHalfTexelSize=vec2f(.5)/SkyViewLutSize;const AerialPerspectiveLutKMPerSlice=4.;const AerialPerspectiveLutRangeKM=AerialPerspectiveLutKMPerSlice*NumAerialPerspectiveLutLayers;const TransmittanceLutSize=vec2f(256.,64.);const TransmittanceLutDomainInUVSpace=(TransmittanceLutSize-vec2f(1.))/TransmittanceLutSize;const TransmittanceLutHalfTexelSize=vec2f(.5)/TransmittanceLutSize;const TransmittanceHorizonRange=2.*TransmittanceLutHalfTexelSize.x;const TransmittanceMaxUnoccludedU=1.-.5*TransmittanceHorizonRange;const TransmittanceMinOccludedU=1.+.5*TransmittanceHorizonRange;fn uvToUnit(uv: vec2f,domainInUVSpace: vec2f,halfTexelSize: vec2f)->vec2f {return (uv-halfTexelSize)/domainInUVSpace;}\nfn unitToUV(unit: vec2f,domainInUVSpace: vec2f,halfTexelSize: vec2f)->vec2f {return unit*domainInUVSpace+halfTexelSize;}\nfn sphereIntersectNearest(rayOrigin: vec3f,rayDirection: vec3f,sphereRadius: f32)->f32 {let result=sphereIntersectFromOrigin(rayOrigin,rayDirection,sphereRadius);let c=dot(rayOrigin,rayOrigin)-sphereRadius*sphereRadius;return select(result.x,result.y,c>=0.);}\nfn moveToTopAtmosphere(\ncameraPosition: vec3f,\npositionRadius: f32,\npositionGeocentricNormal: vec3f,\nrayDirection: vec3f,\nintersectsAtmosphere: ptr<function,bool>,\ncameraPositionClampedToTopOfAtmosphere: ptr<function,vec3f>\n) {*intersectsAtmosphere=true;*cameraPositionClampedToTopOfAtmosphere=cameraPosition;if (positionRadius>atmosphere.atmosphereRadius) {let tTop=sphereIntersectNearest(cameraPosition,rayDirection,atmosphere.atmosphereRadius);if (tTop>=0.) {let upOffset=-atmosphere.planetRadiusOffset*positionGeocentricNormal;*cameraPositionClampedToTopOfAtmosphere=cameraPosition+rayDirection*tTop+upOffset;} else {*intersectsAtmosphere=false;}}}\nfn getSkyViewUVFromParameters(\nintersectsGround: bool,\ncosHorizonAngleFromZenith: f32,\ncosAngleBetweenViewAndZenith: f32,\ncosAngleBetweenViewAndLightOnPlane: f32,\nuv: ptr<function,vec2f>\n) {var unit=vec2f(0.);if (intersectsGround) {var coord=(cosAngleBetweenViewAndZenith+1.)/(cosHorizonAngleFromZenith+1.);coord=sqrtClamped(coord); \nunit.y=.5*coord; } else {var coord=(cosAngleBetweenViewAndZenith-cosHorizonAngleFromZenith)/(1.-cosHorizonAngleFromZenith);coord=sqrtClamped(coord); \nunit.y=.5*coord+.5; }\nunit.x=.5-.5*cosAngleBetweenViewAndLightOnPlane;*uv=unitToUV(unit,SkyViewLutDomainInUVSpace,SkyViewLutHalfTexelSize);}\n#if USE_SKY_VIEW_LUT && SAMPLE_SKY_VIEW_LUT\nfn sampleSkyViewLut(\nskyViewLut: texture_2d<f32>,\npositionRadius: f32,\ngeocentricNormal: vec3f,\nrayDirection: vec3f,\ndirectionToLight: vec3f,\ncosHorizonAngleFromZenith: f32,\ncosAngleBetweenViewAndZenith: ptr<function,f32>,\nisRayIntersectingGround: ptr<function,bool>\n)->vec4f {*cosAngleBetweenViewAndZenith=dot(rayDirection,geocentricNormal);if (positionRadius>atmosphere.atmosphereRadius) {let sinAngleBetweenViewAndNadir=sqrtClamped(1.-*cosAngleBetweenViewAndZenith**cosAngleBetweenViewAndZenith);if (sinAngleBetweenViewAndNadir>atmosphere.sinCameraAtmosphereHorizonAngleFromNadir) {*isRayIntersectingGround=false;return vec4f(0.);}}\nlet sideVector=normalize(cross(geocentricNormal,rayDirection));let forwardVector=normalize(cross(sideVector,geocentricNormal));let lightOnPlane=normalize(vec2f(dot(directionToLight,forwardVector),dot(directionToLight,sideVector)));let cosAngleBetweenViewAndLightOnPlane=lightOnPlane.x;let rayIntersectionScale=mix(.95,1.,saturate((positionRadius-atmosphere.planetRadius)/atmosphere.atmosphereThickness));*isRayIntersectingGround =\npositionRadius>atmosphere.planetRadius &&\n(rayIntersectionScale**cosAngleBetweenViewAndZenith)<=cosHorizonAngleFromZenith;var uv: vec2f;getSkyViewUVFromParameters(\n*isRayIntersectingGround,\ncosHorizonAngleFromZenith,\n*cosAngleBetweenViewAndZenith,\ncosAngleBetweenViewAndLightOnPlane,\n&uv);return textureSampleLevel(skyViewLut,skyViewLutSampler,uv,0.);}\n#endif\nfn computeRayleighPhase(onePlusCosThetaSq: f32)->f32 {return 0.0596831037*onePlusCosThetaSq;}\nfn computeMiePhaseCornetteShanks(cosTheta: f32,onePlusCosThetaSq: f32)->f32 {const g=.8;const gSquared=g*g;const oneMinusGSquared=1.-gSquared;const onePlusGSquared=1.+gSquared;const twoPlusGSquared=2.+gSquared;const twoG=2.*g;const threeOverEightPi=3./(8.*PI);return threeOverEightPi*oneMinusGSquared*onePlusCosThetaSq/(twoPlusGSquared*pow(onePlusGSquared-twoG*cosTheta,1.5));}\nfn computeOzoneDensity(normalizedViewHeight: f32)->f32 {const MinOzoneDensity=.135;const OneMinusMinOzoneDensity=1.-MinOzoneDensity;const OzoneStartHeight=.15; \nconst PeakOzoneHeight=.25;const MaxOzoneHeight=.6;const InverseRampupDistance=1./(PeakOzoneHeight-OzoneStartHeight);const InverseRampdownDistance=1./(MaxOzoneHeight-PeakOzoneHeight);let lowerAtmosphereDensity=MinOzoneDensity+OneMinusMinOzoneDensity*max(0.,normalizedViewHeight-OzoneStartHeight)*InverseRampupDistance;let sqrtUpperAtmosphereDensity=max(0.,1.-(normalizedViewHeight-PeakOzoneHeight)*InverseRampdownDistance);let upperAtmosphereDensity=sqrtUpperAtmosphereDensity*sqrtUpperAtmosphereDensity;let densityOzone=select(upperAtmosphereDensity,lowerAtmosphereDensity,normalizedViewHeight<PeakOzoneHeight);return densityOzone;}\nfn sampleMediumRGB(\nviewHeight: f32,\nscatteringRayleigh: ptr<function,vec3f>,\nscatteringMie: ptr<function,vec3f>,\nextinction: ptr<function,vec3f>,\nscattering: ptr<function,vec3f>\n) {let normalizedViewHeight=saturate(viewHeight*atmosphere.inverseAtmosphereThickness);let densityMie=exp(-83.333*normalizedViewHeight);let densityRayleigh=exp(-12.5*normalizedViewHeight);let densityOzone=computeOzoneDensity(normalizedViewHeight);*scatteringRayleigh=densityRayleigh*atmosphere.peakRayleighScattering;*scatteringMie=densityMie*atmosphere.peakMieScattering;*scattering=*scatteringMie+*scatteringRayleigh;let extinctionRayleigh=*scatteringRayleigh;let extinctionMie=densityMie*atmosphere.peakMieExtinction;let extinctionOzone=densityOzone*atmosphere.peakOzoneAbsorption;*extinction=extinctionRayleigh+extinctionMie+extinctionOzone;}\nfn computeTransmittance(rayOriginGlobal: vec3f,rayDirection: vec3f,tMax: f32,sampleCount: f32)->vec3f {var opticalDepth=vec3f(0.);var t=0.;let sampleSegmentWeight=tMax/sampleCount;const sampleSegmentT=.3;for (var s=0.; s<sampleCount; s+=1.) {let newT=sampleSegmentWeight*(s+sampleSegmentT);let dt=newT-t;t=newT;var scatteringRayleigh: vec3f;var scatteringMie: vec3f;var extinction: vec3f;var scattering: vec3f;let samplePositionGlobal=rayOriginGlobal+t*rayDirection;sampleMediumRGB(length(samplePositionGlobal)-atmosphere.planetRadius,&scatteringRayleigh,&scatteringMie,&extinction,&scattering);opticalDepth+=extinction*dt;}\nreturn exp(-opticalDepth);}\n#if defined(SAMPLE_TRANSMITTANCE_LUT) || !defined(EXCLUDE_RAY_MARCHING_FUNCTIONS)\nfn getTransmittanceUV(radius: f32,cosAngleLightToZenith: f32,distanceToHorizon: ptr<function,f32>)->vec2f {let radiusSquared=radius*radius;let horizonDistance=sqrtClamped(radiusSquared-atmosphere.planetRadiusSquared);*distanceToHorizon=horizonDistance;let cosAngleLightToZenithSquared=cosAngleLightToZenith*cosAngleLightToZenith;let discriminant=radiusSquared*(cosAngleLightToZenithSquared-1.)+atmosphere.atmosphereRadiusSquared;let distanceToAtmosphereEdge=max(0.,-radius*cosAngleLightToZenith+sqrtClamped(discriminant));let minDistanceToAtmosphereEdge=max(0.,atmosphere.atmosphereRadius-radius);let maxDistanceToAtmosphereEdge=horizonDistance+atmosphere.horizonDistanceToAtmosphereEdge;let cosAngleLightToZenithCoordinate=(distanceToAtmosphereEdge-minDistanceToAtmosphereEdge)/max(.000001,maxDistanceToAtmosphereEdge-minDistanceToAtmosphereEdge);let distanceToHorizonCoordinate=horizonDistance/max(.000001,atmosphere.horizonDistanceToAtmosphereEdge);let unit=vec2f(cosAngleLightToZenithCoordinate,distanceToHorizonCoordinate);return unit*TransmittanceLutDomainInUVSpace+TransmittanceLutHalfTexelSize; }\nfn sampleTransmittanceLut(transmittanceLut: texture_2d<f32>,positionRadius: f32,cosAngleLightToZenith: f32)->vec4f {var distanceToHorizon=0.;let uv=getTransmittanceUV(positionRadius,cosAngleLightToZenith,&distanceToHorizon);let weight=smoothstep(TransmittanceMinOccludedU,TransmittanceMaxUnoccludedU,uv.x);return weight*textureSampleLevel(transmittanceLut,transmittanceLutSampler,uv,0.);}\n#endif\n#ifndef EXCLUDE_RAY_MARCHING_FUNCTIONS\n#ifndef COMPUTE_MULTI_SCATTERING\nfn sampleMultiScatteringLut(multiScatteringLut: texture_2d<f32>,radius: f32,cosAngleLightToZenith: f32)->vec3f {let unit=vec2f(.5+.5*cosAngleLightToZenith,(radius-atmosphere.planetRadius)/atmosphere.atmosphereThickness);let uv=unitToUV(unit,MultiScatteringLutDomainInUVSpace,MultiScatteringLutHalfTexelSize);let multiScattering=textureSampleLevel(multiScatteringLut,multiScatteringLutSampler,uv,0.).rgb;return max(atmosphere.minMultiScattering,multiScattering);}\n#endif\nconst uniformPhase=RECIPROCAL_PI4;fn integrateScatteredRadiance(\nisAerialPerspectiveLut: bool,\nlightIntensityParam: f32,\ntransmittanceLut: texture_2d<f32>,\n#ifndef COMPUTE_MULTI_SCATTERING\nmultiScatteringLut: texture_2d<f32>,\nmultiScatteringIntensityParam: f32,\n#endif\nrayOriginGlobal: vec3f,\nrayDirection: vec3f,\ndirectionToLightParam: vec3f,\ntMaxMax: f32,\nsampleCount: f32,\ndistanceToSurface: f32,\ntransmittance: ptr<function,vec3f>\n#if COMPUTE_MULTI_SCATTERING\n,multiScattering: ptr<function,vec3f>\n#endif\n)->vec3f {var radiance=vec3f(0.);*transmittance=vec3f(1.);\n#if COMPUTE_MULTI_SCATTERING\n*multiScattering=vec3f(0.);\n#endif\nlet tBottom=sphereIntersectNearest(rayOriginGlobal,rayDirection,atmosphere.planetRadius);let tTop=sphereIntersectNearest(rayOriginGlobal,rayDirection,atmosphere.atmosphereRadius);var tMax=0.;if (tBottom<0.) {if (tTop<0.) {return radiance;} else {tMax=tTop;}} else {if (tTop>0.) {if (isAerialPerspectiveLut) {tMax=tTop;} else {tMax=min(tBottom,tTop);}}}\nif (distanceToSurface>0. && distanceToSurface<tMax) {tMax=distanceToSurface;}\ntMax=min(tMax,tMaxMax);\n#ifndef COMPUTE_MULTI_SCATTERING\nlet cosTheta=dot(rayDirection,directionToLightParam);let onePlusCosThetaSq=1.+cosTheta*cosTheta;let rayleighPhase=computeRayleighPhase(onePlusCosThetaSq);let miePhase=computeMiePhaseCornetteShanks(cosTheta,onePlusCosThetaSq);\n#endif\nlet transmittanceScale=select(1.,atmosphere.aerialPerspectiveTransmittanceScale,isAerialPerspectiveLut);var t=0.;let sampleSegmentWeight=tMax/sampleCount;const sampleSegmentT=.3;for (var s=0.; s<sampleCount; s+=1.) {let newT=sampleSegmentWeight*(s+sampleSegmentT);let dt=newT-t;t=newT;let samplePositionGlobal=rayOriginGlobal+t*rayDirection;let sampleRadiusGlobal=length(samplePositionGlobal);let sampleGeocentricNormal=samplePositionGlobal/sampleRadiusGlobal;let sampleCosAngleLightToZenith=dot(directionToLightParam,sampleGeocentricNormal);var scatteringRayleigh: vec3f;var scatteringMie: vec3f;var extinction: vec3f;var scattering: vec3f;sampleMediumRGB(sampleRadiusGlobal-atmosphere.planetRadius,&scatteringRayleigh,&scatteringMie,&extinction,&scattering);let transmittanceToLight=sampleTransmittanceLut(transmittanceLut,sampleRadiusGlobal,sampleCosAngleLightToZenith).rgb;\n#if COMPUTE_MULTI_SCATTERING\nlet phaseTimesScattering=uniformPhase*scattering;let S=transmittanceToLight*phaseTimesScattering;\n#else\nlet phaseTimesScattering=scatteringMie*miePhase+scatteringRayleigh*rayleighPhase;let multiScatteredRadiance=sampleMultiScatteringLut(multiScatteringLut,sampleRadiusGlobal,sampleCosAngleLightToZenith);let S=transmittanceScale*transmittanceToLight*phaseTimesScattering+multiScatteringIntensityParam*multiScatteredRadiance*scattering;\n#endif\nlet sampleOpticalDepth=extinction*dt;let sampleTransmittanceVal=exp(-sampleOpticalDepth);let clampedExtinction=max(vec3f(.0000001),extinction);let SInt=(S-S*sampleTransmittanceVal)/clampedExtinction;radiance+=*transmittance*SInt;\n#if COMPUTE_MULTI_SCATTERING\nlet MSInt=(scattering-scattering*sampleTransmittanceVal)/clampedExtinction;*multiScattering+=*transmittance*MSInt;\n#endif\n*transmittance*=sampleTransmittanceVal;}\n#if USE_GROUND_ALBEDO\nif (tMax==tBottom && tBottom>0.) {let planetPos=rayOriginGlobal+tBottom*rayDirection;let planetPosRadius=length(planetPos);let planetPosGeocentricNormal=planetPos/planetPosRadius;let nDotL=dot(directionToLightParam,planetPosGeocentricNormal);let lightTransmittance=sampleTransmittanceLut(transmittanceLut,planetPosRadius,nDotL).rgb;const diffuseBrdf=RECIPROCAL_PI;radiance+=lightTransmittance**transmittance*atmosphere.groundAlbedo*(nDotL*diffuseBrdf);}\n#endif\nradiance*=lightIntensityParam;return radiance;}\n#endif\nfn layerIdxToAerialPerspectiveLayer(layerIdx: f32)->f32 {var layer=(layerIdx+1.)/NumAerialPerspectiveLutLayers;layer*=layer; \nlayer*=NumAerialPerspectiveLutLayers;return layer;}\nfn toAerialPerspectiveDepth(layer: f32)->f32 {return layer*AerialPerspectiveLutKMPerSlice;}\nfn toAerialPerspectiveLayer(distance: f32,aerialPerspectiveLutDistancePerSlice: f32)->f32 {return distance/aerialPerspectiveLutDistancePerSlice;}\nfn applyAerialPerspectiveSaturation(aerialPerspective: vec4f)->vec4f {let previousRadiance=getLuminanceUnclamped(aerialPerspective.rgb);let mixed=mix(vec3f(previousRadiance),aerialPerspective.rgb,atmosphere.aerialPerspectiveSaturation);return vec4f(mixed,aerialPerspective.a);}\nfn applyAerialPerspectiveIntensity(aerialPerspective: vec4f)->vec4f {var result=aerialPerspective;\n#if APPLY_AERIAL_PERSPECTIVE_INTENSITY\nif (atmosphere.aerialPerspectiveIntensity==0.) {result=vec4f(0.);} else {let previousAlpha=result.a;result=result/max(.00001,previousAlpha);result=result*pow(previousAlpha,1./atmosphere.aerialPerspectiveIntensity);}\n#endif\nreturn result;}\nfn applyAerialPerspectiveRadianceBias(aerialPerspective: vec4f)->vec4f {var result=aerialPerspective;\n#if APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS\nlet originalRadiance=dot(result.rgb,LuminanceEncodeApprox);let targetRadiance=originalRadiance+atmosphere.aerialPerspectiveRadianceBias;if (originalRadiance>0.) {result=result*max(0.,targetRadiance/originalRadiance);} else {result=max(vec4f(0.),vec4f(atmosphere.aerialPerspectiveRadianceBias));}\nresult.a=min(result.a,1.);\n#endif\nreturn result;}\nfn sampleAerialPerspectiveLut(\nscreenUV: vec2f,\nclampToLutRange: bool,\ndistanceFromCamera: f32,\nnumAerialPerspectiveLutLayers: f32,\naerialPerspectiveLutKMPerSlice: f32,\naerialPerspectiveLutRangeKM: f32,\naerialPerspective: ptr<function,vec4f>\n)->bool {*aerialPerspective=vec4f(0.);\n#if USE_AERIAL_PERSPECTIVE_LUT\nif (distanceFromCamera>0. &&\n(clampToLutRange || distanceFromCamera<aerialPerspectiveLutRangeKM) &&\natmosphere.clampedCameraRadius<=atmosphere.atmosphereRadius) {var layer=toAerialPerspectiveLayer(distanceFromCamera,aerialPerspectiveLutKMPerSlice);let normalizedLayer=sqrt(layer/numAerialPerspectiveLutLayers); \nlayer=min(normalizedLayer*numAerialPerspectiveLutLayers,numAerialPerspectiveLutLayers);let weight=min(layer,1.);let layerIdx=max(0.,layer-1.);let floorLayerIdx=floor(layerIdx);let aerialPerspectiveLayer0=textureSampleLevel(aerialPerspectiveLut,aerialPerspectiveLutSampler,screenUV,i32(floorLayerIdx),0.);let aerialPerspectiveLayer1=textureSampleLevel(aerialPerspectiveLut,aerialPerspectiveLutSampler,screenUV,i32(floorLayerIdx+1.),0.);var interpolated=mix(aerialPerspectiveLayer0,aerialPerspectiveLayer1,layerIdx-floorLayerIdx);interpolated=vec4f(interpolated.rgb*atmosphere.atmosphereExposure,interpolated.a);interpolated=applyAerialPerspectiveSaturation(interpolated);interpolated=weight*applyAerialPerspectiveIntensity(interpolated);interpolated=applyAerialPerspectiveRadianceBias(interpolated);*aerialPerspective=interpolated;return true;}\n#endif\nreturn false;}\n#if RENDER_TRANSMITTANCE\nfn getTransmittanceParameters(uv: vec2f,radius: ptr<function,f32>,cosAngleLightToZenith: ptr<function,f32>,distanceToAtmosphereEdge: ptr<function,f32>) {let unit=uvToUnit(uv,TransmittanceLutDomainInUVSpace,TransmittanceLutHalfTexelSize);let distanceToHorizon=unit.y*atmosphere.horizonDistanceToAtmosphereEdge;let distanceToHorizonSquared=distanceToHorizon*distanceToHorizon;*radius=sqrtClamped(distanceToHorizonSquared+atmosphere.planetRadiusSquared);let minDistanceToAtmosphereEdge=atmosphere.atmosphereRadius-*radius;let maxDistanceToAtmosphereEdge=distanceToHorizon+atmosphere.horizonDistanceToAtmosphereEdge;*distanceToAtmosphereEdge=minDistanceToAtmosphereEdge+unit.x*(maxDistanceToAtmosphereEdge-minDistanceToAtmosphereEdge);let distanceToAtmosphereEdgeSquared=*distanceToAtmosphereEdge**distanceToAtmosphereEdge;*cosAngleLightToZenith=select(\n(atmosphere.horizonDistanceToAtmosphereEdgeSquared-distanceToAtmosphereEdgeSquared-distanceToHorizonSquared)/(2.**radius**distanceToAtmosphereEdge),\n1.,\n*distanceToAtmosphereEdge<=0.\n);*cosAngleLightToZenith=clamp(*cosAngleLightToZenith,-1.,1.);}\nfn renderTransmittance(uv: vec2f)->vec4f {var radius: f32;var cosAngleLightToZenith: f32;var distanceToAtmosphereEdgeAlongAngle: f32;getTransmittanceParameters(uv,&radius,&cosAngleLightToZenith,&distanceToAtmosphereEdgeAlongAngle);let sinAngleLightToZenith=sqrtClamped(1.-cosAngleLightToZenith*cosAngleLightToZenith);let directionToLight=normalize(vec3f(0.,cosAngleLightToZenith,sinAngleLightToZenith));let transmittance=computeTransmittance(vec3f(0.,radius,0.),directionToLight,distanceToAtmosphereEdgeAlongAngle,atmosphere.transmittanceSampleCount);return vec4f(transmittance,avg(transmittance));}\n#endif\n#if RENDER_MULTI_SCATTERING\nfn getSphereSample(azimuth: f32,inclination: f32,sinInclination: ptr<function,f32>)->vec3f {*sinInclination=sin(inclination);return vec3f(*sinInclination*sin(azimuth),cos(inclination),*sinInclination*cos(azimuth));}\nfn renderMultiScattering(uv: vec2f,transmittanceLut: texture_2d<f32>)->vec4f {let MultiScatteringAzimuthIterationAngle=TWO_PI/atmosphere.multiScatteringAzimuthSampleCount;let MultiScatteringInclinationIterationAngle=PI/atmosphere.multiScatteringInclinationSampleCount;let MultiScatteringAngleStepProduct=MultiScatteringAzimuthIterationAngle*MultiScatteringInclinationIterationAngle;let unit=uvToUnit(uv,MultiScatteringLutDomainInUVSpace,MultiScatteringLutHalfTexelSize);let cosAngleLightToZenith=2.*unit.x-1.;let sinAngleLightToZenith=sqrtClamped(1.-cosAngleLightToZenith*cosAngleLightToZenith);let directionToLightLocal=normalize(vec3f(0.,cosAngleLightToZenith,sinAngleLightToZenith));let rayOriginRadius=atmosphere.planetRadius+max(unit.y,.001)*atmosphere.atmosphereThickness;let rayOrigin=vec3f(0.,rayOriginRadius,0.);var inscattered=vec3f(0.);var multiScatteringTotal=vec3f(0.);for (var i=.5; i<atmosphere.multiScatteringAzimuthSampleCount; i+=1.) {let azimuth=MultiScatteringAzimuthIterationAngle*i;for (var j=.5; j<atmosphere.multiScatteringInclinationSampleCount; j+=1.) {let inclination=MultiScatteringInclinationIterationAngle*j;var sinInclination: f32;let rayDirection=getSphereSample(azimuth,inclination,&sinInclination);var transmittanceVal: vec3f;var multiScatteringVal: vec3f;let radianceVal=integrateScatteredRadiance(\nfalse,\n1.,\ntransmittanceLut,\nrayOrigin,\nrayDirection,\ndirectionToLightLocal,\n100000000.,\natmosphere.multiScatteringLutSampleCount,\n-1.,\n&transmittanceVal,\n&multiScatteringVal);let weight=RECIPROCAL_PI4*abs(sinInclination)*MultiScatteringAngleStepProduct;multiScatteringTotal+=multiScatteringVal*weight;inscattered+=radianceVal*weight;}}\nlet multiScatteringResult=inscattered/max(vec3f(.000001),vec3f(1.)-multiScatteringTotal);return vec4f(multiScatteringResult,1.);}\n#endif\nfn computeCosHorizonAngleFromZenith(radius: f32)->f32 {let sinAngleBetweenHorizonAndNadir=min(1.,atmosphere.planetRadius/radius);let cosHorizonAngleFromNadir=sqrt(1.-sinAngleBetweenHorizonAndNadir*sinAngleBetweenHorizonAndNadir);let cosHorizonAngleFromZenith=-cosHorizonAngleFromNadir;return cosHorizonAngleFromZenith;}\n#if RENDER_SKY_VIEW\nfn getSkyViewParametersFromUV(\nradius: f32,\nuv: vec2f,\ncosAngleBetweenViewAndZenith: ptr<function,f32>,\ncosAngleBetweenViewAndLightOnPlane: ptr<function,f32>\n) {let unit=uvToUnit(uv,SkyViewLutDomainInUVSpace,SkyViewLutHalfTexelSize);let cosHorizonAngleFromZenith=computeCosHorizonAngleFromZenith(radius);if (unit.y<.5) {var coord=2.*unit.y; \ncoord*=coord; \n*cosAngleBetweenViewAndZenith=mix(-1.,cosHorizonAngleFromZenith,coord); } else {var coord=2.*unit.y-1.; \ncoord*=coord; \n*cosAngleBetweenViewAndZenith=mix(cosHorizonAngleFromZenith,1.,coord); }\n*cosAngleBetweenViewAndLightOnPlane=1.-2.*unit.x;}\nfn renderSkyView(uv: vec2f,transmittanceLut: texture_2d<f32>,multiScatteringLut: texture_2d<f32>)->vec4f {var cosAngleBetweenViewAndZenith: f32;var cosAngleBetweenViewAndLightOnPlane: f32;getSkyViewParametersFromUV(atmosphere.clampedCameraRadius,uv,&cosAngleBetweenViewAndZenith,&cosAngleBetweenViewAndLightOnPlane);let sinAngleBetweenViewAndZenith=sqrtClamped(1.-cosAngleBetweenViewAndZenith*cosAngleBetweenViewAndZenith);let sinAngleBetweenViewAndLightOnPlane=sqrtClamped(1.-cosAngleBetweenViewAndLightOnPlane*cosAngleBetweenViewAndLightOnPlane);let rayDirection =\nvec3f(\nsinAngleBetweenViewAndZenith*cosAngleBetweenViewAndLightOnPlane,\ncosAngleBetweenViewAndZenith,\nsinAngleBetweenViewAndZenith*sinAngleBetweenViewAndLightOnPlane);var intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\nvec3f(0.,atmosphere.clampedCameraRadius,0.),\natmosphere.clampedCameraRadius,\nvec3f(0.,1.,0.),\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere\n);if (!intersectsAtmosphere) {return vec4f(0.);}\nvar transmittanceVal: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLightRelativeToCameraGeocentricNormal,\n100000000.,\natmosphere.skyViewLutSampleCount,\n-1.,\n&transmittanceVal\n);let transparency=1.-avg(transmittanceVal);return vec4f(radiance,transparency);}\n#endif\n#if RENDER_CAMERA_VOLUME\nfn renderCameraVolume(\npositionOnNearPlane: vec3f,\nlayerIdx: f32,\ntransmittanceLut: texture_2d<f32>,\nmultiScatteringLut: texture_2d<f32>\n)->vec4f {var result=vec4f(0.);let rayDirection=normalize(positionOnNearPlane);let layer=layerIdxToAerialPerspectiveLayer(layerIdx);let tMax=toAerialPerspectiveDepth(layer);var tMaxMax=tMax;var cameraPositionGlobalClampedToTopOfAtmosphere=atmosphere.clampedCameraPositionGlobal;if (atmosphere.clampedCameraRadius>=atmosphere.atmosphereRadius) {var intersectsAtmosphere=false;moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return result;}\nlet distanceToAtmosphere=distance(atmosphere.clampedCameraPositionGlobal,cameraPositionGlobalClampedToTopOfAtmosphere);if (tMaxMax<distanceToAtmosphere) {return result;}\ntMaxMax=max(0.,tMaxMax-distanceToAtmosphere);}\nlet sampleCount=min(atmosphere.skyViewLutSampleCount,2.*layer+2.);var transmittance: vec3f;let radiance=integrateScatteredRadiance(\ntrue,\natmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\ntMaxMax,\nsampleCount,\n-1.,\n&transmittance);let transparency=1.-avg(transmittance);result=vec4f(radiance,transparency);return result;}\n#endif\n";
1775
- t.ShaderStore.IncludesShadersStoreWGSL[pt] || (t.ShaderStore.IncludesShadersStoreWGSL[pt] = ft);
1776
- var gt = { name: pt, shader: ft };
1777
- var vt = { __proto__: null, atmosphereFunctionsWGSL: gt };
1778
- var St = "atmosphereUboDeclaration", _t = "struct Atmosphere {peakRayleighScattering: vec3<f32>,\nplanetRadius: f32,\npeakMieScattering: vec3<f32>,\natmosphereThickness: f32,\npeakMieAbsorption: vec3<f32>,\nplanetRadiusSquared: f32,\npeakMieExtinction: vec3<f32>,\natmosphereRadius: f32,\npeakOzoneAbsorption: vec3<f32>,\natmosphereRadiusSquared: f32,\nhorizonDistanceToAtmosphereEdge: f32,\nhorizonDistanceToAtmosphereEdgeSquared: f32,\nplanetRadiusWithOffset: f32,\nplanetRadiusOffset: f32,\natmosphereExposure: f32,\naerialPerspectiveRadianceBias: f32,\ninverseAtmosphereThickness: f32,\naerialPerspectiveTransmittanceScale: f32,\ninverseViewProjectionWithoutTranslation: mat4x4<f32>,\ndirectionToLight: vec3<f32>,\nmultiScatteringIntensity: f32,\ndirectionToLightRelativeToCameraGeocentricNormal: vec3<f32>,\ncameraRadius: f32,\nlightRadianceAtCamera: vec3<f32>,\ndiffuseSkyIrradianceDesaturationFactor: f32,\ngroundAlbedo: vec3<f32>,\naerialPerspectiveSaturation: f32,\nminMultiScattering: vec3<f32>,\ndiffuseSkyIrradianceIntensity: f32,\ncameraPositionGlobal: vec3<f32>,\nlightIntensity: f32,\nclampedCameraPositionGlobal: vec3<f32>,\naerialPerspectiveIntensity: f32,\ncameraGeocentricNormal: vec3<f32>,\nclampedCameraRadius: f32,\ncameraForward: vec3<f32>,\nclampedCameraHeight: f32,\ncameraPosition: vec3<f32>,\ncosCameraHorizonAngleFromZenith: f32,\nviewport: vec4<f32>,\nadditionalDiffuseSkyIrradiance: vec3<f32>,\ncameraHeight: f32,\ncameraNearPlane: f32,\noriginHeight: f32,\nsinCameraAtmosphereHorizonAngleFromNadir: f32,\ntransmittanceSampleCount: f32,\nskyViewLutSampleCount: f32,\nmultiScatteringLutSampleCount: f32,\nmultiScatteringAzimuthSampleCount: f32,\nmultiScatteringInclinationSampleCount: f32,\ndiffuseSkyIrradianceLutSampleCount: f32};var<uniform> atmosphere : Atmosphere;\n";
1779
- t.ShaderStore.IncludesShadersStoreWGSL[St] || (t.ShaderStore.IncludesShadersStoreWGSL[St] = _t);
1780
- var yt = { name: St, shader: _t };
1781
- var Tt = { __proto__: null, atmosphereUboDeclarationWGSL: yt };
1782
- var At = "atmosphereFunctions", Pt = "#include<intersectionFunctions>\nconst vec2 MultiScatteringLutSize=vec2(32.0,32.0);const vec2 MultiScatteringLutDomainInUVSpace=(MultiScatteringLutSize-vec2(1.0))/MultiScatteringLutSize;const vec2 MultiScatteringLutHalfTexelSize=vec2(0.5)/MultiScatteringLutSize;const float NumAerialPerspectiveLutLayers=32.0;const vec3 AerialPerspectiveLutSize=vec3(16.0,64.0,NumAerialPerspectiveLutLayers);const vec2 DiffuseSkyIrradianceLutSize=vec2(64.0,16.0);const vec2 DiffuseSkyIrradianceLutDomainInUVSpace=(DiffuseSkyIrradianceLutSize-vec2(1.0))/DiffuseSkyIrradianceLutSize;const vec2 DiffuseSkyIrradianceLutHalfTexelSize=vec2(0.5)/DiffuseSkyIrradianceLutSize;const vec2 SkyViewLutSize=vec2(128.0,128.0);const vec2 SkyViewLutDomainInUVSpace=(SkyViewLutSize-vec2(1.0))/SkyViewLutSize;const vec2 SkyViewLutHalfTexelSize=vec2(0.5)/SkyViewLutSize;const float AerialPerspectiveLutKMPerSlice=4.0;const float AerialPerspectiveLutRangeKM=AerialPerspectiveLutKMPerSlice*NumAerialPerspectiveLutLayers;const vec2 TransmittanceLutSize=vec2(256.,64.);const vec2 TransmittanceLutDomainInUVSpace=(TransmittanceLutSize-vec2(1.))/TransmittanceLutSize;const vec2 TransmittanceLutHalfTexelSize=vec2(0.5)/TransmittanceLutSize;const float TransmittanceHorizonRange=2.*TransmittanceLutHalfTexelSize.x;const float TransmittanceMaxUnoccludedU=1.-0.5*TransmittanceHorizonRange;const float TransmittanceMinOccludedU=1.+0.5*TransmittanceHorizonRange;vec2 uvToUnit(vec2 uv,vec2 domainInUVSpace,vec2 halfTexelSize) {return (uv-halfTexelSize)/domainInUVSpace;}\nvec2 unitToUV(vec2 unit,vec2 domainInUVSpace,vec2 halfTexelSize) {return unit*domainInUVSpace+halfTexelSize;}\nfloat sphereIntersectNearest(vec3 rayOrigin,vec3 rayDirection,float sphereRadius) {vec2 result=sphereIntersectFromOrigin(rayOrigin,rayDirection,sphereRadius);float c=dot(rayOrigin,rayOrigin)-sphereRadius*sphereRadius;return c>=0.0 ?\nresult.y :\nresult.x;}\nvoid moveToTopAtmosphere(\nvec3 cameraPosition,\nfloat positionRadius,\nvec3 positionGeocentricNormal,\nvec3 rayDirection,\nout bool intersectsAtmosphere,\nout vec3 cameraPositionClampedToTopOfAtmosphere) {intersectsAtmosphere=true;cameraPositionClampedToTopOfAtmosphere=cameraPosition;if (positionRadius>atmosphereRadius) {float tTop=sphereIntersectNearest(cameraPosition,rayDirection,atmosphereRadius);if (tTop>=0.0) {vec3 upOffset=-planetRadiusOffset*positionGeocentricNormal;cameraPositionClampedToTopOfAtmosphere=cameraPosition+rayDirection*tTop+upOffset;} else {intersectsAtmosphere=false;}}}\nvoid getSkyViewUVFromParameters(\nbool intersectsGround,\nfloat cosHorizonAngleFromZenith,\nfloat cosAngleBetweenViewAndZenith,\nfloat cosAngleBetweenViewAndLightOnPlane,\nout vec2 uv)\n{vec2 unit=vec2(0.);if (intersectsGround) {float coord=(cosAngleBetweenViewAndZenith+1.)/(cosHorizonAngleFromZenith+1.);coord=sqrtClamped(coord); \nunit.y=0.5*coord; } else {float coord=(cosAngleBetweenViewAndZenith-cosHorizonAngleFromZenith)/(1.-cosHorizonAngleFromZenith);coord=sqrtClamped(coord); \nunit.y=0.5*coord+0.5; }\n{float coord=0.5-0.5*cosAngleBetweenViewAndLightOnPlane;unit.x=coord;}\nuv=unitToUV(unit,SkyViewLutDomainInUVSpace,SkyViewLutHalfTexelSize);}\n#if USE_SKY_VIEW_LUT && SAMPLE_SKY_VIEW_LUT\nvec4 sampleSkyViewLut(\nsampler2D skyViewLut,\nfloat positionRadius,\nvec3 geocentricNormal,\nvec3 rayDirection,\nvec3 directionToLight,\nfloat cosHorizonAngleFromZenith,\nout float cosAngleBetweenViewAndZenith,\nout bool isRayIntersectingGround) {cosAngleBetweenViewAndZenith=dot(rayDirection,geocentricNormal);if (positionRadius>atmosphereRadius) {float sinAngleBetweenViewAndNadir=sqrtClamped(1.-cosAngleBetweenViewAndZenith*cosAngleBetweenViewAndZenith);if (sinAngleBetweenViewAndNadir>sinCameraAtmosphereHorizonAngleFromNadir) {isRayIntersectingGround=false;return vec4(0.);}}\nvec3 sideVector=normalize(cross(geocentricNormal,rayDirection));vec3 forwardVector=normalize(cross(sideVector,geocentricNormal));vec2 lightOnPlane=normalize(vec2(dot(directionToLight,forwardVector),dot(directionToLight,sideVector)));float cosAngleBetweenViewAndLightOnPlane=lightOnPlane.x;float rayIntersectionScale=mix(0.95,1.,saturate((positionRadius-planetRadius)/atmosphereThickness));isRayIntersectingGround =\npositionRadius>planetRadius &&\n(rayIntersectionScale*cosAngleBetweenViewAndZenith)<=cosHorizonAngleFromZenith;vec2 uv;getSkyViewUVFromParameters(\nisRayIntersectingGround,\ncosHorizonAngleFromZenith,\ncosAngleBetweenViewAndZenith,\ncosAngleBetweenViewAndLightOnPlane,\nuv);return textureLod(skyViewLut,uv,0.);}\n#endif\nfloat computeRayleighPhase(float onePlusCosThetaSq) {return 0.0596831037*onePlusCosThetaSq;}\nfloat computeMiePhaseCornetteShanks(float cosTheta,float onePlusCosThetaSq) {const float g=0.8;const float gSquared=g*g;const float oneMinusGSquared=1.-gSquared;const float onePlusGSquared=1.+gSquared;const float twoPlusGSquared=2.+gSquared;const float twoG=2.*g;const float threeOverEightPi=3./(8.*PI);return threeOverEightPi*oneMinusGSquared*onePlusCosThetaSq/(twoPlusGSquared*pow(onePlusGSquared-twoG*cosTheta,1.5));}\nfloat computeOzoneDensity(float normalizedViewHeight) {const float MinOzoneDensity=0.135;const float OneMinusMinOzoneDensity=1.-MinOzoneDensity;const float OzoneStartHeight=.15; \nconst float PeakOzoneHeight=.25;const float MaxOzoneHeight=0.6;const float InverseRampupDistance=1./(PeakOzoneHeight-OzoneStartHeight);const float InverseRampdownDistance=1./(MaxOzoneHeight-PeakOzoneHeight);float lowerAtmosphereDensity=MinOzoneDensity+OneMinusMinOzoneDensity*max(0.,normalizedViewHeight-OzoneStartHeight)*InverseRampupDistance;float sqrtUpperAtmosphereDensity=max(0.,1.-(normalizedViewHeight-PeakOzoneHeight)*InverseRampdownDistance);float upperAtmosphereDensity=sqrtUpperAtmosphereDensity*sqrtUpperAtmosphereDensity;float densityOzone=normalizedViewHeight<PeakOzoneHeight ? lowerAtmosphereDensity : upperAtmosphereDensity;return densityOzone;}\nvoid sampleMediumRGB(\nfloat viewHeight,\nout vec3 scatteringRayleigh,\nout vec3 scatteringMie,\nout vec3 extinction,\nout vec3 scattering) {float normalizedViewHeight=saturate(viewHeight*inverseAtmosphereThickness);float densityMie=exp(-83.333*normalizedViewHeight);float densityRayleigh=exp(-12.5*normalizedViewHeight);float densityOzone=computeOzoneDensity(normalizedViewHeight);scatteringRayleigh=densityRayleigh*peakRayleighScattering;scatteringMie=densityMie*peakMieScattering;scattering=scatteringMie+scatteringRayleigh;vec3 extinctionRayleigh=scatteringRayleigh;vec3 extinctionMie=densityMie*peakMieExtinction;vec3 extinctionOzone=densityOzone*peakOzoneAbsorption;extinction=extinctionRayleigh+extinctionMie+extinctionOzone;}\nvec3 computeTransmittance(vec3 rayOriginGlobal,vec3 rayDirection,float tMax,float sampleCount) {vec3 opticalDepth=vec3(0.);float t=0.;float sampleSegmentWeight=tMax/sampleCount;const float sampleSegmentT=0.3;for (float s=0.; s<sampleCount; s+=1.) {float newT=sampleSegmentWeight*(s+sampleSegmentT);float dt=newT-t;t=newT;vec3 scatteringRayleigh,scatteringMie,extinction,scattering;vec3 samplePositionGlobal=rayOriginGlobal+t*rayDirection;sampleMediumRGB(length(samplePositionGlobal)-planetRadius,scatteringRayleigh,scatteringMie,extinction,scattering);opticalDepth+=extinction*dt;}\nreturn exp(-opticalDepth);}\n#if defined(SAMPLE_TRANSMITTANCE_LUT) || !defined(EXCLUDE_RAY_MARCHING_FUNCTIONS)\nvec2 getTransmittanceUV(float radius,float cosAngleLightToZenith,out float distanceToHorizon) {float radiusSquared=radius*radius;distanceToHorizon=sqrtClamped(radiusSquared-planetRadiusSquared);float cosAngleLightToZenithSquared=cosAngleLightToZenith*cosAngleLightToZenith;float discriminant=radiusSquared*(cosAngleLightToZenithSquared-1.)+atmosphereRadiusSquared;float distanceToAtmosphereEdge=max(0.,-radius*cosAngleLightToZenith+sqrtClamped(discriminant));float minDistanceToAtmosphereEdge=max(0.,atmosphereRadius-radius);float maxDistanceToAtmosphereEdge=distanceToHorizon+horizonDistanceToAtmosphereEdge;float cosAngleLightToZenithCoordinate=(distanceToAtmosphereEdge-minDistanceToAtmosphereEdge)/max(0.000001,maxDistanceToAtmosphereEdge-minDistanceToAtmosphereEdge);float distanceToHorizonCoordinate=distanceToHorizon/max(0.000001,horizonDistanceToAtmosphereEdge);vec2 unit=vec2(cosAngleLightToZenithCoordinate,distanceToHorizonCoordinate);return unit*TransmittanceLutDomainInUVSpace+TransmittanceLutHalfTexelSize; }\nvec4 sampleTransmittanceLut(sampler2D transmittanceLut,float positionRadius,float cosAngleLightToZenith) {float distanceToHorizon;vec2 uv=getTransmittanceUV(positionRadius,cosAngleLightToZenith,distanceToHorizon);float weight=smoothstep(TransmittanceMinOccludedU,TransmittanceMaxUnoccludedU,uv.x);return weight*textureLod(transmittanceLut,uv,0.);}\n#endif\n#ifndef EXCLUDE_RAY_MARCHING_FUNCTIONS\n#ifndef COMPUTE_MULTI_SCATTERING\nvec3 sampleMultiScatteringLut(sampler2D multiScatteringLut,float radius,float cosAngleLightToZenith) {vec2 unit=vec2(0.5+0.5*cosAngleLightToZenith,(radius-planetRadius)/atmosphereThickness);vec2 uv=unitToUV(unit,MultiScatteringLutDomainInUVSpace,MultiScatteringLutHalfTexelSize);vec3 multiScattering=textureLod(multiScatteringLut,uv,0.).rgb;return max(minMultiScattering,multiScattering);}\n#endif\nconst float uniformPhase=RECIPROCAL_PI4;vec3 integrateScatteredRadiance(\nbool isAerialPerspectiveLut,\nfloat lightIntensity,\nsampler2D transmittanceLut,\n#ifndef COMPUTE_MULTI_SCATTERING\nsampler2D multiScatteringLut,\nfloat multiScatteringIntensity,\n#endif\nvec3 rayOriginGlobal,\nvec3 rayDirection,\nvec3 directionToLight,\nfloat tMaxMax,\nfloat sampleCount,\nfloat distanceToSurface,\nout vec3 transmittance\n#if COMPUTE_MULTI_SCATTERING\n,out vec3 multiScattering\n#endif\n) {vec3 radiance=vec3(0.);transmittance=vec3(1.);\n#if COMPUTE_MULTI_SCATTERING\nmultiScattering=vec3(0.);\n#endif\nfloat tBottom=sphereIntersectNearest(rayOriginGlobal,rayDirection,planetRadius);float tTop=sphereIntersectNearest(rayOriginGlobal,rayDirection,atmosphereRadius);float tMax=0.;if (tBottom<0.) {if (tTop<0.) {return radiance;} else {tMax=tTop;}} else {if (tTop>0.) {if (isAerialPerspectiveLut) {tMax=tTop;} else {tMax=min(tBottom,tTop);}}}\nif (distanceToSurface>0. && distanceToSurface<tMax) {tMax=distanceToSurface;}\ntMax=min(tMax,tMaxMax);\n#ifndef COMPUTE_MULTI_SCATTERING\nfloat cosTheta=dot(rayDirection,directionToLight);float onePlusCosThetaSq=1.+cosTheta*cosTheta;float rayleighPhase=computeRayleighPhase(onePlusCosThetaSq);float miePhase=computeMiePhaseCornetteShanks(cosTheta,onePlusCosThetaSq);\n#endif\nfloat transmittanceScale=isAerialPerspectiveLut ? aerialPerspectiveTransmittanceScale : 1.;float t=0.;float sampleSegmentWeight=tMax/sampleCount;const float sampleSegmentT=0.3;for (float s=0.; s<sampleCount; s+=1.) {float newT=sampleSegmentWeight*(s+sampleSegmentT);float dt=newT-t;t=newT;vec3 samplePositionGlobal=rayOriginGlobal+t*rayDirection;float sampleRadiusGlobal=length(samplePositionGlobal);vec3 sampleGeocentricNormal=samplePositionGlobal/sampleRadiusGlobal;float sampleCosAngleLightToZenith=dot(directionToLight,sampleGeocentricNormal);vec3 scatteringRayleigh,scatteringMie,extinction,scattering;sampleMediumRGB(sampleRadiusGlobal-planetRadius,scatteringRayleigh,scatteringMie,extinction,scattering);vec3 transmittanceToLight=sampleTransmittanceLut(transmittanceLut,sampleRadiusGlobal,sampleCosAngleLightToZenith).rgb;\n#if COMPUTE_MULTI_SCATTERING\nvec3 phaseTimesScattering=uniformPhase*scattering;vec3 S=transmittanceToLight*phaseTimesScattering;\n#else\nvec3 phaseTimesScattering=scatteringMie*miePhase+scatteringRayleigh*rayleighPhase;vec3 multiScatteredRadiance=sampleMultiScatteringLut(multiScatteringLut,sampleRadiusGlobal,sampleCosAngleLightToZenith);vec3 S=transmittanceScale*transmittanceToLight*phaseTimesScattering+multiScatteringIntensity*multiScatteredRadiance*scattering;\n#endif\nvec3 sampleOpticalDepth=extinction*dt;vec3 sampleTransmittance=exp(-sampleOpticalDepth);vec3 clampedExtinction=max(vec3(0.0000001),extinction);vec3 SInt=(S-S*sampleTransmittance)/clampedExtinction;radiance+=transmittance*SInt;\n#if COMPUTE_MULTI_SCATTERING\nvec3 MSInt=(scattering-scattering*sampleTransmittance)/clampedExtinction;multiScattering+=transmittance*MSInt;\n#endif\ntransmittance*=sampleTransmittance;}\n#if USE_GROUND_ALBEDO\nif (tMax==tBottom && tBottom>0.) {vec3 planetPos=rayOriginGlobal+tBottom*rayDirection;float planetPosRadius=length(planetPos);vec3 planetPosGeocentricNormal=planetPos/planetPosRadius;float nDotL=dot(directionToLight,planetPosGeocentricNormal);vec3 lightTransmittance=sampleTransmittanceLut(transmittanceLut,planetPosRadius,nDotL).rgb;const float diffuseBrdf=RECIPROCAL_PI;radiance+=lightTransmittance*transmittance*groundAlbedo*(nDotL*diffuseBrdf);}\n#endif\nradiance*=lightIntensity;return radiance;}\n#endif\nfloat layerIdxToAerialPerspectiveLayer(float layerIdx) {float layer=(layerIdx+1.)/NumAerialPerspectiveLutLayers;layer*=layer; \nlayer*=NumAerialPerspectiveLutLayers;return layer;}\nfloat toAerialPerspectiveDepth(float layer) {return layer*AerialPerspectiveLutKMPerSlice;}\nfloat toAerialPerspectiveLayer(float distance,float aerialPerspectiveLutDistancePerSlice) {return distance/aerialPerspectiveLutDistancePerSlice;}\nvec4 applyAerialPerspectiveSaturation(vec4 aerialPerspective) {float previousRadiance=getLuminanceUnclamped(aerialPerspective.rgb);aerialPerspective.rgb=mix(vec3(previousRadiance),aerialPerspective.rgb,aerialPerspectiveSaturation);return aerialPerspective;}\nvec4 applyAerialPerspectiveIntensity(vec4 aerialPerspective) {\n#if APPLY_AERIAL_PERSPECTIVE_INTENSITY\nif (aerialPerspectiveIntensity==0.) {aerialPerspective=vec4(0.);} else {float previousAlpha=aerialPerspective.a;aerialPerspective/=max(0.00001,previousAlpha);aerialPerspective*=pow(previousAlpha,1./aerialPerspectiveIntensity);}\n#endif\nreturn aerialPerspective;}\nvec4 applyAerialPerspectiveRadianceBias(vec4 aerialPerspective) {\n#if APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS\nfloat originalRadiance=dot(aerialPerspective.rgb,LuminanceEncodeApprox);float targetRadiance=originalRadiance+aerialPerspectiveRadianceBias;if (originalRadiance>0.) {aerialPerspective*=max(0.,targetRadiance/originalRadiance);} else {aerialPerspective=max(vec4(0.),vec4(aerialPerspectiveRadianceBias));}\naerialPerspective.a=min(aerialPerspective.a,1.);\n#endif\nreturn aerialPerspective;}\nbool sampleAerialPerspectiveLut(\nvec2 screenUV,\nbool clampToLutRange,\nfloat distanceFromCamera,\nfloat numAerialPerspectiveLutLayers,\nfloat aerialPerspectiveLutKMPerSlice,\nfloat aerialPerspectiveLutRangeKM,\nout vec4 aerialPerspective) {aerialPerspective=vec4(0.);\n#if USE_AERIAL_PERSPECTIVE_LUT\nif (distanceFromCamera>0. &&\n(clampToLutRange || distanceFromCamera<aerialPerspectiveLutRangeKM) &&\nclampedCameraRadius<=atmosphereRadius) {float layer=toAerialPerspectiveLayer(distanceFromCamera,aerialPerspectiveLutKMPerSlice);float normalizedLayer=sqrt(layer/numAerialPerspectiveLutLayers); \nlayer=min(normalizedLayer*numAerialPerspectiveLutLayers,numAerialPerspectiveLutLayers);float weight=min(layer,1.);float layerIdx=max(0.,layer-1.);float floorLayerIdx=floor(layerIdx);vec4 aerialPerspectiveLayer0=textureLod(aerialPerspectiveLut,vec3(screenUV,floorLayerIdx),0.);vec4 aerialPerspectiveLayer1=textureLod(aerialPerspectiveLut,vec3(screenUV,floorLayerIdx+1.),0.);aerialPerspective=mix(aerialPerspectiveLayer0,aerialPerspectiveLayer1,layerIdx-floorLayerIdx);aerialPerspective.rgb*=atmosphereExposure;aerialPerspective=applyAerialPerspectiveSaturation(aerialPerspective);aerialPerspective=weight*applyAerialPerspectiveIntensity(aerialPerspective);aerialPerspective=applyAerialPerspectiveRadianceBias(aerialPerspective);return true;}\n#endif\nreturn false;}\n#if RENDER_TRANSMITTANCE\nvoid getTransmittanceParameters(vec2 uv,out float radius,out float cosAngleLightToZenith,out float distanceToAtmosphereEdge) {vec2 unit=uvToUnit(uv,TransmittanceLutDomainInUVSpace,TransmittanceLutHalfTexelSize);float distanceToHorizon=unit.y*horizonDistanceToAtmosphereEdge;float distanceToHorizonSquared=distanceToHorizon*distanceToHorizon;radius=sqrtClamped(distanceToHorizonSquared+planetRadiusSquared);float minDistanceToAtmosphereEdge=atmosphereRadius-radius;float maxDistanceToAtmosphereEdge=distanceToHorizon+horizonDistanceToAtmosphereEdge;distanceToAtmosphereEdge=minDistanceToAtmosphereEdge+unit.x*(maxDistanceToAtmosphereEdge-minDistanceToAtmosphereEdge);float distanceToAtmosphereEdgeSquared=distanceToAtmosphereEdge*distanceToAtmosphereEdge;cosAngleLightToZenith =\ndistanceToAtmosphereEdge<=0. ?\n1. :\n(horizonDistanceToAtmosphereEdgeSquared-distanceToAtmosphereEdgeSquared-distanceToHorizonSquared)/(2.*radius*distanceToAtmosphereEdge);cosAngleLightToZenith=clamp(cosAngleLightToZenith,-1.,1.);}\nvec4 renderTransmittance(vec2 uv) {float radius,cosAngleLightToZenith,distanceToAtmosphereEdgeAlongAngle;getTransmittanceParameters(uv,radius,cosAngleLightToZenith,distanceToAtmosphereEdgeAlongAngle);float sinAngleLightToZenith=sqrtClamped(1.-cosAngleLightToZenith*cosAngleLightToZenith);vec3 directionToLight=normalize(vec3(0.,cosAngleLightToZenith,sinAngleLightToZenith));vec3 transmittance=computeTransmittance(vec3(0.,radius,0.),directionToLight,distanceToAtmosphereEdgeAlongAngle,transmittanceSampleCount);return vec4(transmittance,avg(transmittance));}\n#endif\n#if RENDER_MULTI_SCATTERING\nvec3 getSphereSample(float azimuth,float inclination,out float sinInclination) {sinInclination=sin(inclination);return vec3(sinInclination*sin(azimuth),cos(inclination),sinInclination*cos(azimuth));}\nvec4 renderMultiScattering(vec2 uv,sampler2D transmittanceLut) {float MultiScatteringAzimuthIterationAngle=TWO_PI/multiScatteringAzimuthSampleCount;float MultiScatteringInclinationIterationAngle=PI/multiScatteringInclinationSampleCount;float MultiScatteringAngleStepProduct=MultiScatteringAzimuthIterationAngle*MultiScatteringInclinationIterationAngle;vec2 unit=uvToUnit(uv,MultiScatteringLutDomainInUVSpace,MultiScatteringLutHalfTexelSize);float cosAngleLightToZenith=2.*unit.x-1.;float sinAngleLightToZenith=sqrtClamped(1.-cosAngleLightToZenith*cosAngleLightToZenith);vec3 directionToLight=normalize(vec3(0.,cosAngleLightToZenith,sinAngleLightToZenith));float rayOriginRadius=planetRadius+max(unit.y,0.001)*atmosphereThickness;vec3 rayOrigin=vec3(0.,rayOriginRadius,0.);vec3 inscattered=vec3(0.);vec3 multiScatteringTotal=vec3(0.);for (float i=0.5; i<multiScatteringAzimuthSampleCount; i+=1.) {float azimuth=MultiScatteringAzimuthIterationAngle*i;for (float j=0.5; j<multiScatteringInclinationSampleCount; j+=1.) {float inclination=MultiScatteringInclinationIterationAngle*j;float sinInclination;vec3 rayDirection=getSphereSample(azimuth,inclination,sinInclination);vec3 transmittance;vec3 multiScattering;vec3 radiance=integrateScatteredRadiance(\nfalse,\n1.,\ntransmittanceLut,\nrayOrigin,\nrayDirection,\ndirectionToLight,\n100000000.,\nmultiScatteringLutSampleCount,\n-1.,\ntransmittance,\nmultiScattering);float weight=RECIPROCAL_PI4*abs(sinInclination)*MultiScatteringAngleStepProduct;multiScatteringTotal+=multiScattering*weight;inscattered+=radiance*weight;}}\nvec3 multiScattering=inscattered/max(vec3(0.000001),vec3(1.)-multiScatteringTotal);return vec4(multiScattering,1.);}\n#endif\nfloat computeCosHorizonAngleFromZenith(float radius) {float sinAngleBetweenHorizonAndNadir=min(1.,planetRadius/radius);float cosHorizonAngleFromNadir=sqrt(1.-sinAngleBetweenHorizonAndNadir*sinAngleBetweenHorizonAndNadir);float cosHorizonAngleFromZenith=-cosHorizonAngleFromNadir;return cosHorizonAngleFromZenith;}\n#if RENDER_SKY_VIEW\nvoid getSkyViewParametersFromUV(\nfloat radius,\nvec2 uv,\nout float cosAngleBetweenViewAndZenith,\nout float cosAngleBetweenViewAndLightOnPlane) {vec2 unit=uvToUnit(uv,SkyViewLutDomainInUVSpace,SkyViewLutHalfTexelSize);float cosHorizonAngleFromZenith=computeCosHorizonAngleFromZenith(radius);if (unit.y<0.5) {float coord=2.*unit.y; \ncoord*=coord; \ncosAngleBetweenViewAndZenith=mix(-1.,cosHorizonAngleFromZenith,coord); } else {float coord=2.*unit.y-1.; \ncoord*=coord; \ncosAngleBetweenViewAndZenith=mix(cosHorizonAngleFromZenith,1.,coord); }\n{float coord=unit.x;cosAngleBetweenViewAndLightOnPlane=1.-2.*coord;}}\nvec4 renderSkyView(vec2 uv,sampler2D transmittanceLut,sampler2D multiScatteringLut) {float cosAngleBetweenViewAndZenith;float cosAngleBetweenViewAndLightOnPlane;getSkyViewParametersFromUV(clampedCameraRadius,uv,cosAngleBetweenViewAndZenith,cosAngleBetweenViewAndLightOnPlane);float sinAngleBetweenViewAndZenith=sqrtClamped(1.-cosAngleBetweenViewAndZenith*cosAngleBetweenViewAndZenith);float sinAngleBetweenViewAndLightOnPlane=sqrtClamped(1.-cosAngleBetweenViewAndLightOnPlane*cosAngleBetweenViewAndLightOnPlane);vec3 rayDirection =\nvec3(\nsinAngleBetweenViewAndZenith*cosAngleBetweenViewAndLightOnPlane,\ncosAngleBetweenViewAndZenith,\nsinAngleBetweenViewAndZenith*sinAngleBetweenViewAndLightOnPlane);bool intersectsAtmosphere=false;vec3 cameraPositionGlobalClampedToTopOfAtmosphere=vec3(0.);moveToTopAtmosphere(\nvec3(0.,clampedCameraRadius,0.),\nclampedCameraRadius,\nvec3(0.,1.,0.),\nrayDirection,\nintersectsAtmosphere,\ncameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return vec4(0.);}\nvec3 transmittance;vec3 radiance=integrateScatteredRadiance(\nfalse,\natmosphereExposure*lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\nmultiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\ndirectionToLightRelativeToCameraGeocentricNormal,\n100000000.,\nskyViewLutSampleCount,\n-1.,\ntransmittance);float transparency=1.-avg(transmittance);return vec4(radiance,transparency);}\n#endif\n#if RENDER_CAMERA_VOLUME\nvec4 renderCameraVolume(\nvec3 positionOnNearPlane,\nfloat layerIdx,\nsampler2D transmittanceLut,\nsampler2D multiScatteringLut) {vec4 result=vec4(0.);vec3 rayDirection=normalize(positionOnNearPlane);float layer=layerIdxToAerialPerspectiveLayer(layerIdx);float tMax=toAerialPerspectiveDepth(layer);float tMaxMax=tMax;vec3 cameraPositionGlobalClampedToTopOfAtmosphere=clampedCameraPositionGlobal;if (clampedCameraRadius>=atmosphereRadius) {bool intersectsAtmosphere=false;moveToTopAtmosphere(\nclampedCameraPositionGlobal,\nclampedCameraRadius,\ncameraGeocentricNormal,\nrayDirection,\nintersectsAtmosphere,\ncameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return result;}\nfloat distanceToAtmosphere=distance(clampedCameraPositionGlobal,cameraPositionGlobalClampedToTopOfAtmosphere);if (tMaxMax<distanceToAtmosphere) {return result;}\ntMaxMax=max(0.,tMaxMax-distanceToAtmosphere);}\nfloat sampleCount=min(skyViewLutSampleCount,2.*layer+2.);vec3 transmittance;vec3 radiance=integrateScatteredRadiance(\ntrue,\nlightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\nmultiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\ndirectionToLight,\ntMaxMax,\nsampleCount,\n-1.,\ntransmittance);float transparency=1.-avg(transmittance);result=vec4(radiance,transparency);return result;}\n#endif\n";
1783
- t.ShaderStore.IncludesShadersStore[At] || (t.ShaderStore.IncludesShadersStore[At] = Pt);
1784
- var Lt = { name: At, shader: Pt };
1785
- var Rt = { __proto__: null, atmosphereFunctions: Lt };
1786
- var Et = "atmosphereUboDeclaration", Ct = "layout(std140,column_major) uniform;uniform Atmosphere {vec3 peakRayleighScattering;float planetRadius;vec3 peakMieScattering;float atmosphereThickness;vec3 peakMieAbsorption;float planetRadiusSquared;vec3 peakMieExtinction;float atmosphereRadius;vec3 peakOzoneAbsorption;float atmosphereRadiusSquared;float horizonDistanceToAtmosphereEdge;float horizonDistanceToAtmosphereEdgeSquared;float planetRadiusWithOffset;float planetRadiusOffset;float atmosphereExposure;float aerialPerspectiveRadianceBias;float inverseAtmosphereThickness;float aerialPerspectiveTransmittanceScale;mat4 inverseViewProjectionWithoutTranslation;vec3 directionToLight;float multiScatteringIntensity;vec3 directionToLightRelativeToCameraGeocentricNormal;float cameraRadius;vec3 lightRadianceAtCamera;float diffuseSkyIrradianceDesaturationFactor;vec3 groundAlbedo;float aerialPerspectiveSaturation;vec3 minMultiScattering;float diffuseSkyIrradianceIntensity;vec3 cameraPositionGlobal;float lightIntensity;vec3 clampedCameraPositionGlobal;float aerialPerspectiveIntensity;vec3 cameraGeocentricNormal;float clampedCameraRadius;vec3 cameraForward;float clampedCameraHeight;vec3 cameraPosition;float cosCameraHorizonAngleFromZenith;vec4 viewport;vec3 additionalDiffuseSkyIrradiance;float cameraHeight;float cameraNearPlane;float originHeight;float sinCameraAtmosphereHorizonAngleFromNadir;float transmittanceSampleCount;float skyViewLutSampleCount;float multiScatteringLutSampleCount;float multiScatteringAzimuthSampleCount;float multiScatteringInclinationSampleCount;float diffuseSkyIrradianceLutSampleCount;};\n";
1787
- t.ShaderStore.IncludesShadersStore[Et] || (t.ShaderStore.IncludesShadersStore[Et] = Ct);
1788
- var xt = { name: Et, shader: Ct };
1789
- var It = { __proto__: null, atmosphereUboDeclaration: xt };
1790
- var wt = "atmosphereFragmentDeclaration", Mt = "uniform vec3 peakRayleighScattering;uniform float planetRadius;uniform vec3 peakMieScattering;uniform float atmosphereThickness;uniform vec3 peakMieAbsorption;uniform float planetRadiusSquared;uniform vec3 peakMieExtinction;uniform float atmosphereRadius;uniform vec3 peakOzoneAbsorption;uniform float atmosphereRadiusSquared;uniform float horizonDistanceToAtmosphereEdge;uniform float horizonDistanceToAtmosphereEdgeSquared;uniform float planetRadiusWithOffset;uniform float planetRadiusOffset;uniform float atmosphereExposure;uniform float aerialPerspectiveRadianceBias;uniform float inverseAtmosphereThickness;uniform float aerialPerspectiveTransmittanceScale;uniform mat4 inverseViewProjectionWithoutTranslation;uniform vec3 directionToLight;uniform float multiScatteringIntensity;uniform vec3 directionToLightRelativeToCameraGeocentricNormal;uniform float cameraRadius;uniform vec3 lightRadianceAtCamera;uniform float diffuseSkyIrradianceDesaturationFactor;uniform vec3 groundAlbedo;uniform float aerialPerspectiveSaturation;uniform vec3 minMultiScattering;uniform float diffuseSkyIrradianceIntensity;uniform vec3 cameraPositionGlobal;uniform float lightIntensity;uniform vec3 clampedCameraPositionGlobal;uniform float aerialPerspectiveIntensity;uniform vec3 cameraGeocentricNormal;uniform float clampedCameraRadius;uniform vec3 cameraForward;uniform float clampedCameraHeight;uniform vec3 cameraPosition;uniform float cosCameraHorizonAngleFromZenith;uniform vec4 viewport;uniform vec3 additionalDiffuseSkyIrradiance;uniform float cameraHeight;uniform float cameraNearPlane;uniform float originHeight;uniform float sinCameraAtmosphereHorizonAngleFromNadir;uniform float transmittanceSampleCount;uniform float skyViewLutSampleCount;uniform float multiScatteringLutSampleCount;uniform float multiScatteringAzimuthSampleCount;uniform float multiScatteringInclinationSampleCount;uniform float diffuseSkyIrradianceLutSampleCount;\n";
1791
- t.ShaderStore.IncludesShadersStore[wt] || (t.ShaderStore.IncludesShadersStore[wt] = Mt);
1792
- var bt = { name: wt, shader: Mt };
1793
- var Dt = { __proto__: null, atmosphereFragmentDeclaration: bt };
1794
- var Ot = "fullscreenTriangleVertexShader", Nt = "#include<atmosphereUboDeclaration>\n#if POSITION_VEC2\nattribute position: vec2f;\n#else\nattribute position: vec3f;\n#endif\nuniform depth: f32;varying vUV: vec2f;\n#if COMPUTE_WORLD_RAY\nvarying positionOnNearPlane: vec3f;\n#endif\n#if COMPUTE_WORLD_RAY\nconst nearPlaneNDC: f32=-1.0;\n#endif\n@vertex\nfn main(input: VertexInputs)->FragmentInputs {vertexOutputs.position=vec4f(input.position.xy,uniforms.depth,1.0);vertexOutputs.vUV=input.position.xy*vec2f(0.5,0.5)+vec2f(0.5,0.5);\n#if COMPUTE_WORLD_RAY\nvertexOutputs.positionOnNearPlane=(atmosphere.inverseViewProjectionWithoutTranslation*vec4f(input.position.xy,nearPlaneNDC,1.0)).xyz;\n#endif\n}\n";
1795
- t.ShaderStore.ShadersStoreWGSL[Ot] || (t.ShaderStore.ShadersStoreWGSL[Ot] = Nt);
1796
- var Vt = [yt];
2192
+ St.NAV_MESH_DEBUG_NAME = "nav-mesh-debug", St.NAV_MESH_DEBUG_NAME_POINTS = "nav-mesh-debug-points", St.NAV_MESH_DEBUG_NAME_TRIS = "nav-mesh-debug-tris", St.NAV_MESH_DEBUG_NAME_QUADS = "nav-mesh-debug-quads", St.NAV_MESH_DEBUG_NAME_LINES = "nav-mesh-debug-lines";
2193
+ var yt = "atmosphereFunctions", Tt = "#include<intersectionFunctions>\nconst MultiScatteringLutSize=vec2f(32.,32.);const MultiScatteringLutDomainInUVSpace=(MultiScatteringLutSize-vec2f(1.))/MultiScatteringLutSize;const MultiScatteringLutHalfTexelSize=vec2f(.5)/MultiScatteringLutSize;const NumAerialPerspectiveLutLayers=32.;const AerialPerspectiveLutSize=vec3f(16.,64.,NumAerialPerspectiveLutLayers);const DiffuseSkyIrradianceLutSize=vec2f(64.,16.);const DiffuseSkyIrradianceLutDomainInUVSpace=(DiffuseSkyIrradianceLutSize-vec2f(1.))/DiffuseSkyIrradianceLutSize;const DiffuseSkyIrradianceLutHalfTexelSize=vec2f(.5)/DiffuseSkyIrradianceLutSize;const SkyViewLutSize=vec2f(128.,128.);const SkyViewLutDomainInUVSpace=(SkyViewLutSize-vec2f(1.))/SkyViewLutSize;const SkyViewLutHalfTexelSize=vec2f(.5)/SkyViewLutSize;const AerialPerspectiveLutKMPerSlice=4.;const AerialPerspectiveLutRangeKM=AerialPerspectiveLutKMPerSlice*NumAerialPerspectiveLutLayers;const TransmittanceLutSize=vec2f(256.,64.);const TransmittanceLutDomainInUVSpace=(TransmittanceLutSize-vec2f(1.))/TransmittanceLutSize;const TransmittanceLutHalfTexelSize=vec2f(.5)/TransmittanceLutSize;const TransmittanceHorizonRange=2.*TransmittanceLutHalfTexelSize.x;const TransmittanceMaxUnoccludedU=1.-.5*TransmittanceHorizonRange;const TransmittanceMinOccludedU=1.+.5*TransmittanceHorizonRange;fn uvToUnit(uv: vec2f,domainInUVSpace: vec2f,halfTexelSize: vec2f)->vec2f {return (uv-halfTexelSize)/domainInUVSpace;}\nfn unitToUV(unit: vec2f,domainInUVSpace: vec2f,halfTexelSize: vec2f)->vec2f {return unit*domainInUVSpace+halfTexelSize;}\nfn sphereIntersectNearest(rayOrigin: vec3f,rayDirection: vec3f,sphereRadius: f32)->f32 {let result=sphereIntersectFromOrigin(rayOrigin,rayDirection,sphereRadius);let c=dot(rayOrigin,rayOrigin)-sphereRadius*sphereRadius;return select(result.x,result.y,c>=0.);}\nfn moveToTopAtmosphere(\ncameraPosition: vec3f,\npositionRadius: f32,\npositionGeocentricNormal: vec3f,\nrayDirection: vec3f,\nintersectsAtmosphere: ptr<function,bool>,\ncameraPositionClampedToTopOfAtmosphere: ptr<function,vec3f>\n) {*intersectsAtmosphere=true;*cameraPositionClampedToTopOfAtmosphere=cameraPosition;if (positionRadius>atmosphere.atmosphereRadius) {let tTop=sphereIntersectNearest(cameraPosition,rayDirection,atmosphere.atmosphereRadius);if (tTop>=0.) {let upOffset=-atmosphere.planetRadiusOffset*positionGeocentricNormal;*cameraPositionClampedToTopOfAtmosphere=cameraPosition+rayDirection*tTop+upOffset;} else {*intersectsAtmosphere=false;}}}\nfn getSkyViewUVFromParameters(\nintersectsGround: bool,\ncosHorizonAngleFromZenith: f32,\ncosAngleBetweenViewAndZenith: f32,\ncosAngleBetweenViewAndLightOnPlane: f32,\nuv: ptr<function,vec2f>\n) {var unit=vec2f(0.);if (intersectsGround) {var coord=(cosAngleBetweenViewAndZenith+1.)/(cosHorizonAngleFromZenith+1.);coord=sqrtClamped(coord); \nunit.y=.5*coord; } else {var coord=(cosAngleBetweenViewAndZenith-cosHorizonAngleFromZenith)/(1.-cosHorizonAngleFromZenith);coord=sqrtClamped(coord); \nunit.y=.5*coord+.5; }\nunit.x=.5-.5*cosAngleBetweenViewAndLightOnPlane;*uv=unitToUV(unit,SkyViewLutDomainInUVSpace,SkyViewLutHalfTexelSize);}\n#if USE_SKY_VIEW_LUT && SAMPLE_SKY_VIEW_LUT\nfn sampleSkyViewLut(\nskyViewLut: texture_2d<f32>,\npositionRadius: f32,\ngeocentricNormal: vec3f,\nrayDirection: vec3f,\ndirectionToLight: vec3f,\ncosHorizonAngleFromZenith: f32,\ncosAngleBetweenViewAndZenith: ptr<function,f32>,\nisRayIntersectingGround: ptr<function,bool>\n)->vec4f {*cosAngleBetweenViewAndZenith=dot(rayDirection,geocentricNormal);if (positionRadius>atmosphere.atmosphereRadius) {let sinAngleBetweenViewAndNadir=sqrtClamped(1.-*cosAngleBetweenViewAndZenith**cosAngleBetweenViewAndZenith);if (sinAngleBetweenViewAndNadir>atmosphere.sinCameraAtmosphereHorizonAngleFromNadir) {*isRayIntersectingGround=false;return vec4f(0.);}}\nlet sideVector=normalize(cross(geocentricNormal,rayDirection));let forwardVector=normalize(cross(sideVector,geocentricNormal));let lightOnPlane=normalize(vec2f(dot(directionToLight,forwardVector),dot(directionToLight,sideVector)));let cosAngleBetweenViewAndLightOnPlane=lightOnPlane.x;let rayIntersectionScale=mix(.95,1.,saturate((positionRadius-atmosphere.planetRadius)/atmosphere.atmosphereThickness));*isRayIntersectingGround =\npositionRadius>atmosphere.planetRadius &&\n(rayIntersectionScale**cosAngleBetweenViewAndZenith)<=cosHorizonAngleFromZenith;var uv: vec2f;getSkyViewUVFromParameters(\n*isRayIntersectingGround,\ncosHorizonAngleFromZenith,\n*cosAngleBetweenViewAndZenith,\ncosAngleBetweenViewAndLightOnPlane,\n&uv);return textureSampleLevel(skyViewLut,skyViewLutSampler,uv,0.);}\n#endif\nfn computeRayleighPhase(onePlusCosThetaSq: f32)->f32 {return 0.0596831037*onePlusCosThetaSq;}\nfn computeMiePhaseCornetteShanks(cosTheta: f32,onePlusCosThetaSq: f32)->f32 {const g=.8;const gSquared=g*g;const oneMinusGSquared=1.-gSquared;const onePlusGSquared=1.+gSquared;const twoPlusGSquared=2.+gSquared;const twoG=2.*g;const threeOverEightPi=3./(8.*PI);return threeOverEightPi*oneMinusGSquared*onePlusCosThetaSq/(twoPlusGSquared*pow(onePlusGSquared-twoG*cosTheta,1.5));}\nfn computeOzoneDensity(normalizedViewHeight: f32)->f32 {const MinOzoneDensity=.135;const OneMinusMinOzoneDensity=1.-MinOzoneDensity;const OzoneStartHeight=.15; \nconst PeakOzoneHeight=.25;const MaxOzoneHeight=.6;const InverseRampupDistance=1./(PeakOzoneHeight-OzoneStartHeight);const InverseRampdownDistance=1./(MaxOzoneHeight-PeakOzoneHeight);let lowerAtmosphereDensity=MinOzoneDensity+OneMinusMinOzoneDensity*max(0.,normalizedViewHeight-OzoneStartHeight)*InverseRampupDistance;let sqrtUpperAtmosphereDensity=max(0.,1.-(normalizedViewHeight-PeakOzoneHeight)*InverseRampdownDistance);let upperAtmosphereDensity=sqrtUpperAtmosphereDensity*sqrtUpperAtmosphereDensity;let densityOzone=select(upperAtmosphereDensity,lowerAtmosphereDensity,normalizedViewHeight<PeakOzoneHeight);return densityOzone;}\nfn sampleMediumRGB(\nviewHeight: f32,\nscatteringRayleigh: ptr<function,vec3f>,\nscatteringMie: ptr<function,vec3f>,\nextinction: ptr<function,vec3f>,\nscattering: ptr<function,vec3f>\n) {let normalizedViewHeight=saturate(viewHeight*atmosphere.inverseAtmosphereThickness);let densityMie=exp(-83.333*normalizedViewHeight);let densityRayleigh=exp(-12.5*normalizedViewHeight);let densityOzone=computeOzoneDensity(normalizedViewHeight);*scatteringRayleigh=densityRayleigh*atmosphere.peakRayleighScattering;*scatteringMie=densityMie*atmosphere.peakMieScattering;*scattering=*scatteringMie+*scatteringRayleigh;let extinctionRayleigh=*scatteringRayleigh;let extinctionMie=densityMie*atmosphere.peakMieExtinction;let extinctionOzone=densityOzone*atmosphere.peakOzoneAbsorption;*extinction=extinctionRayleigh+extinctionMie+extinctionOzone;}\nfn computeTransmittance(rayOriginGlobal: vec3f,rayDirection: vec3f,tMax: f32,sampleCount: f32)->vec3f {var opticalDepth=vec3f(0.);var t=0.;let sampleSegmentWeight=tMax/sampleCount;const sampleSegmentT=.3;for (var s=0.; s<sampleCount; s+=1.) {let newT=sampleSegmentWeight*(s+sampleSegmentT);let dt=newT-t;t=newT;var scatteringRayleigh: vec3f;var scatteringMie: vec3f;var extinction: vec3f;var scattering: vec3f;let samplePositionGlobal=rayOriginGlobal+t*rayDirection;sampleMediumRGB(length(samplePositionGlobal)-atmosphere.planetRadius,&scatteringRayleigh,&scatteringMie,&extinction,&scattering);opticalDepth+=extinction*dt;}\nreturn exp(-opticalDepth);}\n#if defined(SAMPLE_TRANSMITTANCE_LUT) || !defined(EXCLUDE_RAY_MARCHING_FUNCTIONS)\nfn getTransmittanceUV(radius: f32,cosAngleLightToZenith: f32,distanceToHorizon: ptr<function,f32>)->vec2f {let radiusSquared=radius*radius;let horizonDistance=sqrtClamped(radiusSquared-atmosphere.planetRadiusSquared);*distanceToHorizon=horizonDistance;let cosAngleLightToZenithSquared=cosAngleLightToZenith*cosAngleLightToZenith;let discriminant=radiusSquared*(cosAngleLightToZenithSquared-1.)+atmosphere.atmosphereRadiusSquared;let distanceToAtmosphereEdge=max(0.,-radius*cosAngleLightToZenith+sqrtClamped(discriminant));let minDistanceToAtmosphereEdge=max(0.,atmosphere.atmosphereRadius-radius);let maxDistanceToAtmosphereEdge=horizonDistance+atmosphere.horizonDistanceToAtmosphereEdge;let cosAngleLightToZenithCoordinate=(distanceToAtmosphereEdge-minDistanceToAtmosphereEdge)/max(.000001,maxDistanceToAtmosphereEdge-minDistanceToAtmosphereEdge);let distanceToHorizonCoordinate=horizonDistance/max(.000001,atmosphere.horizonDistanceToAtmosphereEdge);let unit=vec2f(cosAngleLightToZenithCoordinate,distanceToHorizonCoordinate);return unit*TransmittanceLutDomainInUVSpace+TransmittanceLutHalfTexelSize; }\nfn sampleTransmittanceLut(transmittanceLut: texture_2d<f32>,positionRadius: f32,cosAngleLightToZenith: f32)->vec4f {var distanceToHorizon=0.;let uv=getTransmittanceUV(positionRadius,cosAngleLightToZenith,&distanceToHorizon);let weight=smoothstep(TransmittanceMinOccludedU,TransmittanceMaxUnoccludedU,uv.x);return weight*textureSampleLevel(transmittanceLut,transmittanceLutSampler,uv,0.);}\n#endif\n#ifndef EXCLUDE_RAY_MARCHING_FUNCTIONS\n#ifndef COMPUTE_MULTI_SCATTERING\nfn sampleMultiScatteringLut(multiScatteringLut: texture_2d<f32>,radius: f32,cosAngleLightToZenith: f32)->vec3f {let unit=vec2f(.5+.5*cosAngleLightToZenith,(radius-atmosphere.planetRadius)/atmosphere.atmosphereThickness);let uv=unitToUV(unit,MultiScatteringLutDomainInUVSpace,MultiScatteringLutHalfTexelSize);let multiScattering=textureSampleLevel(multiScatteringLut,multiScatteringLutSampler,uv,0.).rgb;return max(atmosphere.minMultiScattering,multiScattering);}\n#endif\nconst uniformPhase=RECIPROCAL_PI4;fn integrateScatteredRadiance(\nisAerialPerspectiveLut: bool,\nlightIntensityParam: f32,\ntransmittanceLut: texture_2d<f32>,\n#ifndef COMPUTE_MULTI_SCATTERING\nmultiScatteringLut: texture_2d<f32>,\nmultiScatteringIntensityParam: f32,\n#endif\nrayOriginGlobal: vec3f,\nrayDirection: vec3f,\ndirectionToLightParam: vec3f,\ntMaxMax: f32,\nsampleCount: f32,\ndistanceToSurface: f32,\ntransmittance: ptr<function,vec3f>\n#if COMPUTE_MULTI_SCATTERING\n,multiScattering: ptr<function,vec3f>\n#endif\n)->vec3f {var radiance=vec3f(0.);*transmittance=vec3f(1.);\n#if COMPUTE_MULTI_SCATTERING\n*multiScattering=vec3f(0.);\n#endif\nlet tBottom=sphereIntersectNearest(rayOriginGlobal,rayDirection,atmosphere.planetRadius);let tTop=sphereIntersectNearest(rayOriginGlobal,rayDirection,atmosphere.atmosphereRadius);var tMax=0.;if (tBottom<0.) {if (tTop<0.) {return radiance;} else {tMax=tTop;}} else {if (tTop>0.) {if (isAerialPerspectiveLut) {tMax=tTop;} else {tMax=min(tBottom,tTop);}}}\nif (distanceToSurface>0. && distanceToSurface<tMax) {tMax=distanceToSurface;}\ntMax=min(tMax,tMaxMax);\n#ifndef COMPUTE_MULTI_SCATTERING\nlet cosTheta=dot(rayDirection,directionToLightParam);let onePlusCosThetaSq=1.+cosTheta*cosTheta;let rayleighPhase=computeRayleighPhase(onePlusCosThetaSq);let miePhase=computeMiePhaseCornetteShanks(cosTheta,onePlusCosThetaSq);\n#endif\nlet transmittanceScale=select(1.,atmosphere.aerialPerspectiveTransmittanceScale,isAerialPerspectiveLut);var t=0.;let sampleSegmentWeight=tMax/sampleCount;const sampleSegmentT=.3;for (var s=0.; s<sampleCount; s+=1.) {let newT=sampleSegmentWeight*(s+sampleSegmentT);let dt=newT-t;t=newT;let samplePositionGlobal=rayOriginGlobal+t*rayDirection;let sampleRadiusGlobal=length(samplePositionGlobal);let sampleGeocentricNormal=samplePositionGlobal/sampleRadiusGlobal;let sampleCosAngleLightToZenith=dot(directionToLightParam,sampleGeocentricNormal);var scatteringRayleigh: vec3f;var scatteringMie: vec3f;var extinction: vec3f;var scattering: vec3f;sampleMediumRGB(sampleRadiusGlobal-atmosphere.planetRadius,&scatteringRayleigh,&scatteringMie,&extinction,&scattering);let transmittanceToLight=sampleTransmittanceLut(transmittanceLut,sampleRadiusGlobal,sampleCosAngleLightToZenith).rgb;\n#if COMPUTE_MULTI_SCATTERING\nlet phaseTimesScattering=uniformPhase*scattering;let S=transmittanceToLight*phaseTimesScattering;\n#else\nlet phaseTimesScattering=scatteringMie*miePhase+scatteringRayleigh*rayleighPhase;let multiScatteredRadiance=sampleMultiScatteringLut(multiScatteringLut,sampleRadiusGlobal,sampleCosAngleLightToZenith);let S=transmittanceScale*transmittanceToLight*phaseTimesScattering+multiScatteringIntensityParam*multiScatteredRadiance*scattering;\n#endif\nlet sampleOpticalDepth=extinction*dt;let sampleTransmittanceVal=exp(-sampleOpticalDepth);let clampedExtinction=max(vec3f(.0000001),extinction);let SInt=(S-S*sampleTransmittanceVal)/clampedExtinction;radiance+=*transmittance*SInt;\n#if COMPUTE_MULTI_SCATTERING\nlet MSInt=(scattering-scattering*sampleTransmittanceVal)/clampedExtinction;*multiScattering+=*transmittance*MSInt;\n#endif\n*transmittance*=sampleTransmittanceVal;}\n#if USE_GROUND_ALBEDO\nif (tMax==tBottom && tBottom>0.) {let planetPos=rayOriginGlobal+tBottom*rayDirection;let planetPosRadius=length(planetPos);let planetPosGeocentricNormal=planetPos/planetPosRadius;let nDotL=dot(directionToLightParam,planetPosGeocentricNormal);let lightTransmittance=sampleTransmittanceLut(transmittanceLut,planetPosRadius,nDotL).rgb;const diffuseBrdf=RECIPROCAL_PI;radiance+=lightTransmittance**transmittance*atmosphere.groundAlbedo*(nDotL*diffuseBrdf);}\n#endif\nradiance*=lightIntensityParam;return radiance;}\n#endif\nfn layerIdxToAerialPerspectiveLayer(layerIdx: f32)->f32 {var layer=(layerIdx+1.)/NumAerialPerspectiveLutLayers;layer*=layer; \nlayer*=NumAerialPerspectiveLutLayers;return layer;}\nfn toAerialPerspectiveDepth(layer: f32)->f32 {return layer*AerialPerspectiveLutKMPerSlice;}\nfn toAerialPerspectiveLayer(distance: f32,aerialPerspectiveLutDistancePerSlice: f32)->f32 {return distance/aerialPerspectiveLutDistancePerSlice;}\nfn applyAerialPerspectiveSaturation(aerialPerspective: vec4f)->vec4f {let previousRadiance=getLuminanceUnclamped(aerialPerspective.rgb);let mixed=mix(vec3f(previousRadiance),aerialPerspective.rgb,atmosphere.aerialPerspectiveSaturation);return vec4f(mixed,aerialPerspective.a);}\nfn applyAerialPerspectiveIntensity(aerialPerspective: vec4f)->vec4f {var result=aerialPerspective;\n#if APPLY_AERIAL_PERSPECTIVE_INTENSITY\nif (atmosphere.aerialPerspectiveIntensity==0.) {result=vec4f(0.);} else {let previousAlpha=result.a;result=result/max(.00001,previousAlpha);result=result*pow(previousAlpha,1./atmosphere.aerialPerspectiveIntensity);}\n#endif\nreturn result;}\nfn applyAerialPerspectiveRadianceBias(aerialPerspective: vec4f)->vec4f {var result=aerialPerspective;\n#if APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS\nlet originalRadiance=dot(result.rgb,LuminanceEncodeApprox);let targetRadiance=originalRadiance+atmosphere.aerialPerspectiveRadianceBias;if (originalRadiance>0.) {result=result*max(0.,targetRadiance/originalRadiance);} else {result=max(vec4f(0.),vec4f(atmosphere.aerialPerspectiveRadianceBias));}\nresult.a=min(result.a,1.);\n#endif\nreturn result;}\nfn sampleAerialPerspectiveLut(\nscreenUV: vec2f,\nclampToLutRange: bool,\ndistanceFromCamera: f32,\nnumAerialPerspectiveLutLayers: f32,\naerialPerspectiveLutKMPerSlice: f32,\naerialPerspectiveLutRangeKM: f32,\naerialPerspective: ptr<function,vec4f>\n)->bool {*aerialPerspective=vec4f(0.);\n#if USE_AERIAL_PERSPECTIVE_LUT\nif (distanceFromCamera>0. &&\n(clampToLutRange || distanceFromCamera<aerialPerspectiveLutRangeKM) &&\natmosphere.clampedCameraRadius<=atmosphere.atmosphereRadius) {var layer=toAerialPerspectiveLayer(distanceFromCamera,aerialPerspectiveLutKMPerSlice);let normalizedLayer=sqrt(layer/numAerialPerspectiveLutLayers); \nlayer=min(normalizedLayer*numAerialPerspectiveLutLayers,numAerialPerspectiveLutLayers);let weight=min(layer,1.);let layerIdx=max(0.,layer-1.);let floorLayerIdx=floor(layerIdx);let aerialPerspectiveLayer0=textureSampleLevel(aerialPerspectiveLut,aerialPerspectiveLutSampler,screenUV,i32(floorLayerIdx),0.);let aerialPerspectiveLayer1=textureSampleLevel(aerialPerspectiveLut,aerialPerspectiveLutSampler,screenUV,i32(floorLayerIdx+1.),0.);var interpolated=mix(aerialPerspectiveLayer0,aerialPerspectiveLayer1,layerIdx-floorLayerIdx);interpolated=vec4f(interpolated.rgb*atmosphere.atmosphereExposure,interpolated.a);interpolated=applyAerialPerspectiveSaturation(interpolated);interpolated=weight*applyAerialPerspectiveIntensity(interpolated);interpolated=applyAerialPerspectiveRadianceBias(interpolated);*aerialPerspective=interpolated;return true;}\n#endif\nreturn false;}\n#if RENDER_TRANSMITTANCE\nfn getTransmittanceParameters(uv: vec2f,radius: ptr<function,f32>,cosAngleLightToZenith: ptr<function,f32>,distanceToAtmosphereEdge: ptr<function,f32>) {let unit=uvToUnit(uv,TransmittanceLutDomainInUVSpace,TransmittanceLutHalfTexelSize);let distanceToHorizon=unit.y*atmosphere.horizonDistanceToAtmosphereEdge;let distanceToHorizonSquared=distanceToHorizon*distanceToHorizon;*radius=sqrtClamped(distanceToHorizonSquared+atmosphere.planetRadiusSquared);let minDistanceToAtmosphereEdge=atmosphere.atmosphereRadius-*radius;let maxDistanceToAtmosphereEdge=distanceToHorizon+atmosphere.horizonDistanceToAtmosphereEdge;*distanceToAtmosphereEdge=minDistanceToAtmosphereEdge+unit.x*(maxDistanceToAtmosphereEdge-minDistanceToAtmosphereEdge);let distanceToAtmosphereEdgeSquared=*distanceToAtmosphereEdge**distanceToAtmosphereEdge;*cosAngleLightToZenith=select(\n(atmosphere.horizonDistanceToAtmosphereEdgeSquared-distanceToAtmosphereEdgeSquared-distanceToHorizonSquared)/(2.**radius**distanceToAtmosphereEdge),\n1.,\n*distanceToAtmosphereEdge<=0.\n);*cosAngleLightToZenith=clamp(*cosAngleLightToZenith,-1.,1.);}\nfn renderTransmittance(uv: vec2f)->vec4f {var radius: f32;var cosAngleLightToZenith: f32;var distanceToAtmosphereEdgeAlongAngle: f32;getTransmittanceParameters(uv,&radius,&cosAngleLightToZenith,&distanceToAtmosphereEdgeAlongAngle);let sinAngleLightToZenith=sqrtClamped(1.-cosAngleLightToZenith*cosAngleLightToZenith);let directionToLight=normalize(vec3f(0.,cosAngleLightToZenith,sinAngleLightToZenith));let transmittance=computeTransmittance(vec3f(0.,radius,0.),directionToLight,distanceToAtmosphereEdgeAlongAngle,atmosphere.transmittanceSampleCount);return vec4f(transmittance,avg(transmittance));}\n#endif\n#if RENDER_MULTI_SCATTERING\nfn getSphereSample(azimuth: f32,inclination: f32,sinInclination: ptr<function,f32>)->vec3f {*sinInclination=sin(inclination);return vec3f(*sinInclination*sin(azimuth),cos(inclination),*sinInclination*cos(azimuth));}\nfn renderMultiScattering(uv: vec2f,transmittanceLut: texture_2d<f32>)->vec4f {let MultiScatteringAzimuthIterationAngle=TWO_PI/atmosphere.multiScatteringAzimuthSampleCount;let MultiScatteringInclinationIterationAngle=PI/atmosphere.multiScatteringInclinationSampleCount;let MultiScatteringAngleStepProduct=MultiScatteringAzimuthIterationAngle*MultiScatteringInclinationIterationAngle;let unit=uvToUnit(uv,MultiScatteringLutDomainInUVSpace,MultiScatteringLutHalfTexelSize);let cosAngleLightToZenith=2.*unit.x-1.;let sinAngleLightToZenith=sqrtClamped(1.-cosAngleLightToZenith*cosAngleLightToZenith);let directionToLightLocal=normalize(vec3f(0.,cosAngleLightToZenith,sinAngleLightToZenith));let rayOriginRadius=atmosphere.planetRadius+max(unit.y,.001)*atmosphere.atmosphereThickness;let rayOrigin=vec3f(0.,rayOriginRadius,0.);var inscattered=vec3f(0.);var multiScatteringTotal=vec3f(0.);for (var i=.5; i<atmosphere.multiScatteringAzimuthSampleCount; i+=1.) {let azimuth=MultiScatteringAzimuthIterationAngle*i;for (var j=.5; j<atmosphere.multiScatteringInclinationSampleCount; j+=1.) {let inclination=MultiScatteringInclinationIterationAngle*j;var sinInclination: f32;let rayDirection=getSphereSample(azimuth,inclination,&sinInclination);var transmittanceVal: vec3f;var multiScatteringVal: vec3f;let radianceVal=integrateScatteredRadiance(\nfalse,\n1.,\ntransmittanceLut,\nrayOrigin,\nrayDirection,\ndirectionToLightLocal,\n100000000.,\natmosphere.multiScatteringLutSampleCount,\n-1.,\n&transmittanceVal,\n&multiScatteringVal);let weight=RECIPROCAL_PI4*abs(sinInclination)*MultiScatteringAngleStepProduct;multiScatteringTotal+=multiScatteringVal*weight;inscattered+=radianceVal*weight;}}\nlet multiScatteringResult=inscattered/max(vec3f(.000001),vec3f(1.)-multiScatteringTotal);return vec4f(multiScatteringResult,1.);}\n#endif\nfn computeCosHorizonAngleFromZenith(radius: f32)->f32 {let sinAngleBetweenHorizonAndNadir=min(1.,atmosphere.planetRadius/radius);let cosHorizonAngleFromNadir=sqrt(1.-sinAngleBetweenHorizonAndNadir*sinAngleBetweenHorizonAndNadir);let cosHorizonAngleFromZenith=-cosHorizonAngleFromNadir;return cosHorizonAngleFromZenith;}\n#if RENDER_SKY_VIEW\nfn getSkyViewParametersFromUV(\nradius: f32,\nuv: vec2f,\ncosAngleBetweenViewAndZenith: ptr<function,f32>,\ncosAngleBetweenViewAndLightOnPlane: ptr<function,f32>\n) {let unit=uvToUnit(uv,SkyViewLutDomainInUVSpace,SkyViewLutHalfTexelSize);let cosHorizonAngleFromZenith=computeCosHorizonAngleFromZenith(radius);if (unit.y<.5) {var coord=2.*unit.y; \ncoord*=coord; \n*cosAngleBetweenViewAndZenith=mix(-1.,cosHorizonAngleFromZenith,coord); } else {var coord=2.*unit.y-1.; \ncoord*=coord; \n*cosAngleBetweenViewAndZenith=mix(cosHorizonAngleFromZenith,1.,coord); }\n*cosAngleBetweenViewAndLightOnPlane=1.-2.*unit.x;}\nfn renderSkyView(uv: vec2f,transmittanceLut: texture_2d<f32>,multiScatteringLut: texture_2d<f32>)->vec4f {var cosAngleBetweenViewAndZenith: f32;var cosAngleBetweenViewAndLightOnPlane: f32;getSkyViewParametersFromUV(atmosphere.clampedCameraRadius,uv,&cosAngleBetweenViewAndZenith,&cosAngleBetweenViewAndLightOnPlane);let sinAngleBetweenViewAndZenith=sqrtClamped(1.-cosAngleBetweenViewAndZenith*cosAngleBetweenViewAndZenith);let sinAngleBetweenViewAndLightOnPlane=sqrtClamped(1.-cosAngleBetweenViewAndLightOnPlane*cosAngleBetweenViewAndLightOnPlane);let rayDirection =\nvec3f(\nsinAngleBetweenViewAndZenith*cosAngleBetweenViewAndLightOnPlane,\ncosAngleBetweenViewAndZenith,\nsinAngleBetweenViewAndZenith*sinAngleBetweenViewAndLightOnPlane);var intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\nvec3f(0.,atmosphere.clampedCameraRadius,0.),\natmosphere.clampedCameraRadius,\nvec3f(0.,1.,0.),\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere\n);if (!intersectsAtmosphere) {return vec4f(0.);}\nvar transmittanceVal: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLightRelativeToCameraGeocentricNormal,\n100000000.,\natmosphere.skyViewLutSampleCount,\n-1.,\n&transmittanceVal\n);let transparency=1.-avg(transmittanceVal);return vec4f(radiance,transparency);}\n#endif\n#if RENDER_CAMERA_VOLUME\nfn renderCameraVolume(\npositionOnNearPlane: vec3f,\nlayerIdx: f32,\ntransmittanceLut: texture_2d<f32>,\nmultiScatteringLut: texture_2d<f32>\n)->vec4f {var result=vec4f(0.);let rayDirection=normalize(positionOnNearPlane);let layer=layerIdxToAerialPerspectiveLayer(layerIdx);let tMax=toAerialPerspectiveDepth(layer);var tMaxMax=tMax;var cameraPositionGlobalClampedToTopOfAtmosphere=atmosphere.clampedCameraPositionGlobal;if (atmosphere.clampedCameraRadius>=atmosphere.atmosphereRadius) {var intersectsAtmosphere=false;moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return result;}\nlet distanceToAtmosphere=distance(atmosphere.clampedCameraPositionGlobal,cameraPositionGlobalClampedToTopOfAtmosphere);if (tMaxMax<distanceToAtmosphere) {return result;}\ntMaxMax=max(0.,tMaxMax-distanceToAtmosphere);}\nlet sampleCount=min(atmosphere.skyViewLutSampleCount,2.*layer+2.);var transmittance: vec3f;let radiance=integrateScatteredRadiance(\ntrue,\natmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\ntMaxMax,\nsampleCount,\n-1.,\n&transmittance);let transparency=1.-avg(transmittance);result=vec4f(radiance,transparency);return result;}\n#endif\n";
2194
+ t.ShaderStore.IncludesShadersStoreWGSL[yt] || (t.ShaderStore.IncludesShadersStoreWGSL[yt] = Tt);
2195
+ var At = { name: yt, shader: Tt };
2196
+ var Lt = { __proto__: null, atmosphereFunctionsWGSL: At };
2197
+ var Pt = "atmosphereUboDeclaration", Et = "struct Atmosphere {peakRayleighScattering: vec3<f32>,\nplanetRadius: f32,\npeakMieScattering: vec3<f32>,\natmosphereThickness: f32,\npeakMieAbsorption: vec3<f32>,\nplanetRadiusSquared: f32,\npeakMieExtinction: vec3<f32>,\natmosphereRadius: f32,\npeakOzoneAbsorption: vec3<f32>,\natmosphereRadiusSquared: f32,\nhorizonDistanceToAtmosphereEdge: f32,\nhorizonDistanceToAtmosphereEdgeSquared: f32,\nplanetRadiusWithOffset: f32,\nplanetRadiusOffset: f32,\natmosphereExposure: f32,\naerialPerspectiveRadianceBias: f32,\ninverseAtmosphereThickness: f32,\naerialPerspectiveTransmittanceScale: f32,\ninverseViewProjectionWithoutTranslation: mat4x4<f32>,\ndirectionToLight: vec3<f32>,\nmultiScatteringIntensity: f32,\ndirectionToLightRelativeToCameraGeocentricNormal: vec3<f32>,\ncameraRadius: f32,\nlightRadianceAtCamera: vec3<f32>,\ndiffuseSkyIrradianceDesaturationFactor: f32,\ngroundAlbedo: vec3<f32>,\naerialPerspectiveSaturation: f32,\nminMultiScattering: vec3<f32>,\ndiffuseSkyIrradianceIntensity: f32,\ncameraPositionGlobal: vec3<f32>,\nlightIntensity: f32,\nclampedCameraPositionGlobal: vec3<f32>,\naerialPerspectiveIntensity: f32,\ncameraGeocentricNormal: vec3<f32>,\nclampedCameraRadius: f32,\ncameraForward: vec3<f32>,\nclampedCameraHeight: f32,\ncameraPosition: vec3<f32>,\ncosCameraHorizonAngleFromZenith: f32,\nviewport: vec4<f32>,\nadditionalDiffuseSkyIrradiance: vec3<f32>,\ncameraHeight: f32,\ncameraNearPlane: f32,\noriginHeight: f32,\nsinCameraAtmosphereHorizonAngleFromNadir: f32,\ntransmittanceSampleCount: f32,\nskyViewLutSampleCount: f32,\nmultiScatteringLutSampleCount: f32,\nmultiScatteringAzimuthSampleCount: f32,\nmultiScatteringInclinationSampleCount: f32,\ndiffuseSkyIrradianceLutSampleCount: f32};var<uniform> atmosphere : Atmosphere;\n";
2198
+ t.ShaderStore.IncludesShadersStoreWGSL[Pt] || (t.ShaderStore.IncludesShadersStoreWGSL[Pt] = Et);
2199
+ var Rt = { name: Pt, shader: Et };
2200
+ var Ct = { __proto__: null, atmosphereUboDeclarationWGSL: Rt };
2201
+ var xt = "atmosphereFunctions", Mt = "#include<intersectionFunctions>\nconst vec2 MultiScatteringLutSize=vec2(32.0,32.0);const vec2 MultiScatteringLutDomainInUVSpace=(MultiScatteringLutSize-vec2(1.0))/MultiScatteringLutSize;const vec2 MultiScatteringLutHalfTexelSize=vec2(0.5)/MultiScatteringLutSize;const float NumAerialPerspectiveLutLayers=32.0;const vec3 AerialPerspectiveLutSize=vec3(16.0,64.0,NumAerialPerspectiveLutLayers);const vec2 DiffuseSkyIrradianceLutSize=vec2(64.0,16.0);const vec2 DiffuseSkyIrradianceLutDomainInUVSpace=(DiffuseSkyIrradianceLutSize-vec2(1.0))/DiffuseSkyIrradianceLutSize;const vec2 DiffuseSkyIrradianceLutHalfTexelSize=vec2(0.5)/DiffuseSkyIrradianceLutSize;const vec2 SkyViewLutSize=vec2(128.0,128.0);const vec2 SkyViewLutDomainInUVSpace=(SkyViewLutSize-vec2(1.0))/SkyViewLutSize;const vec2 SkyViewLutHalfTexelSize=vec2(0.5)/SkyViewLutSize;const float AerialPerspectiveLutKMPerSlice=4.0;const float AerialPerspectiveLutRangeKM=AerialPerspectiveLutKMPerSlice*NumAerialPerspectiveLutLayers;const vec2 TransmittanceLutSize=vec2(256.,64.);const vec2 TransmittanceLutDomainInUVSpace=(TransmittanceLutSize-vec2(1.))/TransmittanceLutSize;const vec2 TransmittanceLutHalfTexelSize=vec2(0.5)/TransmittanceLutSize;const float TransmittanceHorizonRange=2.*TransmittanceLutHalfTexelSize.x;const float TransmittanceMaxUnoccludedU=1.-0.5*TransmittanceHorizonRange;const float TransmittanceMinOccludedU=1.+0.5*TransmittanceHorizonRange;vec2 uvToUnit(vec2 uv,vec2 domainInUVSpace,vec2 halfTexelSize) {return (uv-halfTexelSize)/domainInUVSpace;}\nvec2 unitToUV(vec2 unit,vec2 domainInUVSpace,vec2 halfTexelSize) {return unit*domainInUVSpace+halfTexelSize;}\nfloat sphereIntersectNearest(vec3 rayOrigin,vec3 rayDirection,float sphereRadius) {vec2 result=sphereIntersectFromOrigin(rayOrigin,rayDirection,sphereRadius);float c=dot(rayOrigin,rayOrigin)-sphereRadius*sphereRadius;return c>=0.0 ?\nresult.y :\nresult.x;}\nvoid moveToTopAtmosphere(\nvec3 cameraPosition,\nfloat positionRadius,\nvec3 positionGeocentricNormal,\nvec3 rayDirection,\nout bool intersectsAtmosphere,\nout vec3 cameraPositionClampedToTopOfAtmosphere) {intersectsAtmosphere=true;cameraPositionClampedToTopOfAtmosphere=cameraPosition;if (positionRadius>atmosphereRadius) {float tTop=sphereIntersectNearest(cameraPosition,rayDirection,atmosphereRadius);if (tTop>=0.0) {vec3 upOffset=-planetRadiusOffset*positionGeocentricNormal;cameraPositionClampedToTopOfAtmosphere=cameraPosition+rayDirection*tTop+upOffset;} else {intersectsAtmosphere=false;}}}\nvoid getSkyViewUVFromParameters(\nbool intersectsGround,\nfloat cosHorizonAngleFromZenith,\nfloat cosAngleBetweenViewAndZenith,\nfloat cosAngleBetweenViewAndLightOnPlane,\nout vec2 uv)\n{vec2 unit=vec2(0.);if (intersectsGround) {float coord=(cosAngleBetweenViewAndZenith+1.)/(cosHorizonAngleFromZenith+1.);coord=sqrtClamped(coord); \nunit.y=0.5*coord; } else {float coord=(cosAngleBetweenViewAndZenith-cosHorizonAngleFromZenith)/(1.-cosHorizonAngleFromZenith);coord=sqrtClamped(coord); \nunit.y=0.5*coord+0.5; }\n{float coord=0.5-0.5*cosAngleBetweenViewAndLightOnPlane;unit.x=coord;}\nuv=unitToUV(unit,SkyViewLutDomainInUVSpace,SkyViewLutHalfTexelSize);}\n#if USE_SKY_VIEW_LUT && SAMPLE_SKY_VIEW_LUT\nvec4 sampleSkyViewLut(\nsampler2D skyViewLut,\nfloat positionRadius,\nvec3 geocentricNormal,\nvec3 rayDirection,\nvec3 directionToLight,\nfloat cosHorizonAngleFromZenith,\nout float cosAngleBetweenViewAndZenith,\nout bool isRayIntersectingGround) {cosAngleBetweenViewAndZenith=dot(rayDirection,geocentricNormal);if (positionRadius>atmosphereRadius) {float sinAngleBetweenViewAndNadir=sqrtClamped(1.-cosAngleBetweenViewAndZenith*cosAngleBetweenViewAndZenith);if (sinAngleBetweenViewAndNadir>sinCameraAtmosphereHorizonAngleFromNadir) {isRayIntersectingGround=false;return vec4(0.);}}\nvec3 sideVector=normalize(cross(geocentricNormal,rayDirection));vec3 forwardVector=normalize(cross(sideVector,geocentricNormal));vec2 lightOnPlane=normalize(vec2(dot(directionToLight,forwardVector),dot(directionToLight,sideVector)));float cosAngleBetweenViewAndLightOnPlane=lightOnPlane.x;float rayIntersectionScale=mix(0.95,1.,saturate((positionRadius-planetRadius)/atmosphereThickness));isRayIntersectingGround =\npositionRadius>planetRadius &&\n(rayIntersectionScale*cosAngleBetweenViewAndZenith)<=cosHorizonAngleFromZenith;vec2 uv;getSkyViewUVFromParameters(\nisRayIntersectingGround,\ncosHorizonAngleFromZenith,\ncosAngleBetweenViewAndZenith,\ncosAngleBetweenViewAndLightOnPlane,\nuv);return textureLod(skyViewLut,uv,0.);}\n#endif\nfloat computeRayleighPhase(float onePlusCosThetaSq) {return 0.0596831037*onePlusCosThetaSq;}\nfloat computeMiePhaseCornetteShanks(float cosTheta,float onePlusCosThetaSq) {const float g=0.8;const float gSquared=g*g;const float oneMinusGSquared=1.-gSquared;const float onePlusGSquared=1.+gSquared;const float twoPlusGSquared=2.+gSquared;const float twoG=2.*g;const float threeOverEightPi=3./(8.*PI);return threeOverEightPi*oneMinusGSquared*onePlusCosThetaSq/(twoPlusGSquared*pow(onePlusGSquared-twoG*cosTheta,1.5));}\nfloat computeOzoneDensity(float normalizedViewHeight) {const float MinOzoneDensity=0.135;const float OneMinusMinOzoneDensity=1.-MinOzoneDensity;const float OzoneStartHeight=.15; \nconst float PeakOzoneHeight=.25;const float MaxOzoneHeight=0.6;const float InverseRampupDistance=1./(PeakOzoneHeight-OzoneStartHeight);const float InverseRampdownDistance=1./(MaxOzoneHeight-PeakOzoneHeight);float lowerAtmosphereDensity=MinOzoneDensity+OneMinusMinOzoneDensity*max(0.,normalizedViewHeight-OzoneStartHeight)*InverseRampupDistance;float sqrtUpperAtmosphereDensity=max(0.,1.-(normalizedViewHeight-PeakOzoneHeight)*InverseRampdownDistance);float upperAtmosphereDensity=sqrtUpperAtmosphereDensity*sqrtUpperAtmosphereDensity;float densityOzone=normalizedViewHeight<PeakOzoneHeight ? lowerAtmosphereDensity : upperAtmosphereDensity;return densityOzone;}\nvoid sampleMediumRGB(\nfloat viewHeight,\nout vec3 scatteringRayleigh,\nout vec3 scatteringMie,\nout vec3 extinction,\nout vec3 scattering) {float normalizedViewHeight=saturate(viewHeight*inverseAtmosphereThickness);float densityMie=exp(-83.333*normalizedViewHeight);float densityRayleigh=exp(-12.5*normalizedViewHeight);float densityOzone=computeOzoneDensity(normalizedViewHeight);scatteringRayleigh=densityRayleigh*peakRayleighScattering;scatteringMie=densityMie*peakMieScattering;scattering=scatteringMie+scatteringRayleigh;vec3 extinctionRayleigh=scatteringRayleigh;vec3 extinctionMie=densityMie*peakMieExtinction;vec3 extinctionOzone=densityOzone*peakOzoneAbsorption;extinction=extinctionRayleigh+extinctionMie+extinctionOzone;}\nvec3 computeTransmittance(vec3 rayOriginGlobal,vec3 rayDirection,float tMax,float sampleCount) {vec3 opticalDepth=vec3(0.);float t=0.;float sampleSegmentWeight=tMax/sampleCount;const float sampleSegmentT=0.3;for (float s=0.; s<sampleCount; s+=1.) {float newT=sampleSegmentWeight*(s+sampleSegmentT);float dt=newT-t;t=newT;vec3 scatteringRayleigh,scatteringMie,extinction,scattering;vec3 samplePositionGlobal=rayOriginGlobal+t*rayDirection;sampleMediumRGB(length(samplePositionGlobal)-planetRadius,scatteringRayleigh,scatteringMie,extinction,scattering);opticalDepth+=extinction*dt;}\nreturn exp(-opticalDepth);}\n#if defined(SAMPLE_TRANSMITTANCE_LUT) || !defined(EXCLUDE_RAY_MARCHING_FUNCTIONS)\nvec2 getTransmittanceUV(float radius,float cosAngleLightToZenith,out float distanceToHorizon) {float radiusSquared=radius*radius;distanceToHorizon=sqrtClamped(radiusSquared-planetRadiusSquared);float cosAngleLightToZenithSquared=cosAngleLightToZenith*cosAngleLightToZenith;float discriminant=radiusSquared*(cosAngleLightToZenithSquared-1.)+atmosphereRadiusSquared;float distanceToAtmosphereEdge=max(0.,-radius*cosAngleLightToZenith+sqrtClamped(discriminant));float minDistanceToAtmosphereEdge=max(0.,atmosphereRadius-radius);float maxDistanceToAtmosphereEdge=distanceToHorizon+horizonDistanceToAtmosphereEdge;float cosAngleLightToZenithCoordinate=(distanceToAtmosphereEdge-minDistanceToAtmosphereEdge)/max(0.000001,maxDistanceToAtmosphereEdge-minDistanceToAtmosphereEdge);float distanceToHorizonCoordinate=distanceToHorizon/max(0.000001,horizonDistanceToAtmosphereEdge);vec2 unit=vec2(cosAngleLightToZenithCoordinate,distanceToHorizonCoordinate);return unit*TransmittanceLutDomainInUVSpace+TransmittanceLutHalfTexelSize; }\nvec4 sampleTransmittanceLut(sampler2D transmittanceLut,float positionRadius,float cosAngleLightToZenith) {float distanceToHorizon;vec2 uv=getTransmittanceUV(positionRadius,cosAngleLightToZenith,distanceToHorizon);float weight=smoothstep(TransmittanceMinOccludedU,TransmittanceMaxUnoccludedU,uv.x);return weight*textureLod(transmittanceLut,uv,0.);}\n#endif\n#ifndef EXCLUDE_RAY_MARCHING_FUNCTIONS\n#ifndef COMPUTE_MULTI_SCATTERING\nvec3 sampleMultiScatteringLut(sampler2D multiScatteringLut,float radius,float cosAngleLightToZenith) {vec2 unit=vec2(0.5+0.5*cosAngleLightToZenith,(radius-planetRadius)/atmosphereThickness);vec2 uv=unitToUV(unit,MultiScatteringLutDomainInUVSpace,MultiScatteringLutHalfTexelSize);vec3 multiScattering=textureLod(multiScatteringLut,uv,0.).rgb;return max(minMultiScattering,multiScattering);}\n#endif\nconst float uniformPhase=RECIPROCAL_PI4;vec3 integrateScatteredRadiance(\nbool isAerialPerspectiveLut,\nfloat lightIntensity,\nsampler2D transmittanceLut,\n#ifndef COMPUTE_MULTI_SCATTERING\nsampler2D multiScatteringLut,\nfloat multiScatteringIntensity,\n#endif\nvec3 rayOriginGlobal,\nvec3 rayDirection,\nvec3 directionToLight,\nfloat tMaxMax,\nfloat sampleCount,\nfloat distanceToSurface,\nout vec3 transmittance\n#if COMPUTE_MULTI_SCATTERING\n,out vec3 multiScattering\n#endif\n) {vec3 radiance=vec3(0.);transmittance=vec3(1.);\n#if COMPUTE_MULTI_SCATTERING\nmultiScattering=vec3(0.);\n#endif\nfloat tBottom=sphereIntersectNearest(rayOriginGlobal,rayDirection,planetRadius);float tTop=sphereIntersectNearest(rayOriginGlobal,rayDirection,atmosphereRadius);float tMax=0.;if (tBottom<0.) {if (tTop<0.) {return radiance;} else {tMax=tTop;}} else {if (tTop>0.) {if (isAerialPerspectiveLut) {tMax=tTop;} else {tMax=min(tBottom,tTop);}}}\nif (distanceToSurface>0. && distanceToSurface<tMax) {tMax=distanceToSurface;}\ntMax=min(tMax,tMaxMax);\n#ifndef COMPUTE_MULTI_SCATTERING\nfloat cosTheta=dot(rayDirection,directionToLight);float onePlusCosThetaSq=1.+cosTheta*cosTheta;float rayleighPhase=computeRayleighPhase(onePlusCosThetaSq);float miePhase=computeMiePhaseCornetteShanks(cosTheta,onePlusCosThetaSq);\n#endif\nfloat transmittanceScale=isAerialPerspectiveLut ? aerialPerspectiveTransmittanceScale : 1.;float t=0.;float sampleSegmentWeight=tMax/sampleCount;const float sampleSegmentT=0.3;for (float s=0.; s<sampleCount; s+=1.) {float newT=sampleSegmentWeight*(s+sampleSegmentT);float dt=newT-t;t=newT;vec3 samplePositionGlobal=rayOriginGlobal+t*rayDirection;float sampleRadiusGlobal=length(samplePositionGlobal);vec3 sampleGeocentricNormal=samplePositionGlobal/sampleRadiusGlobal;float sampleCosAngleLightToZenith=dot(directionToLight,sampleGeocentricNormal);vec3 scatteringRayleigh,scatteringMie,extinction,scattering;sampleMediumRGB(sampleRadiusGlobal-planetRadius,scatteringRayleigh,scatteringMie,extinction,scattering);vec3 transmittanceToLight=sampleTransmittanceLut(transmittanceLut,sampleRadiusGlobal,sampleCosAngleLightToZenith).rgb;\n#if COMPUTE_MULTI_SCATTERING\nvec3 phaseTimesScattering=uniformPhase*scattering;vec3 S=transmittanceToLight*phaseTimesScattering;\n#else\nvec3 phaseTimesScattering=scatteringMie*miePhase+scatteringRayleigh*rayleighPhase;vec3 multiScatteredRadiance=sampleMultiScatteringLut(multiScatteringLut,sampleRadiusGlobal,sampleCosAngleLightToZenith);vec3 S=transmittanceScale*transmittanceToLight*phaseTimesScattering+multiScatteringIntensity*multiScatteredRadiance*scattering;\n#endif\nvec3 sampleOpticalDepth=extinction*dt;vec3 sampleTransmittance=exp(-sampleOpticalDepth);vec3 clampedExtinction=max(vec3(0.0000001),extinction);vec3 SInt=(S-S*sampleTransmittance)/clampedExtinction;radiance+=transmittance*SInt;\n#if COMPUTE_MULTI_SCATTERING\nvec3 MSInt=(scattering-scattering*sampleTransmittance)/clampedExtinction;multiScattering+=transmittance*MSInt;\n#endif\ntransmittance*=sampleTransmittance;}\n#if USE_GROUND_ALBEDO\nif (tMax==tBottom && tBottom>0.) {vec3 planetPos=rayOriginGlobal+tBottom*rayDirection;float planetPosRadius=length(planetPos);vec3 planetPosGeocentricNormal=planetPos/planetPosRadius;float nDotL=dot(directionToLight,planetPosGeocentricNormal);vec3 lightTransmittance=sampleTransmittanceLut(transmittanceLut,planetPosRadius,nDotL).rgb;const float diffuseBrdf=RECIPROCAL_PI;radiance+=lightTransmittance*transmittance*groundAlbedo*(nDotL*diffuseBrdf);}\n#endif\nradiance*=lightIntensity;return radiance;}\n#endif\nfloat layerIdxToAerialPerspectiveLayer(float layerIdx) {float layer=(layerIdx+1.)/NumAerialPerspectiveLutLayers;layer*=layer; \nlayer*=NumAerialPerspectiveLutLayers;return layer;}\nfloat toAerialPerspectiveDepth(float layer) {return layer*AerialPerspectiveLutKMPerSlice;}\nfloat toAerialPerspectiveLayer(float distance,float aerialPerspectiveLutDistancePerSlice) {return distance/aerialPerspectiveLutDistancePerSlice;}\nvec4 applyAerialPerspectiveSaturation(vec4 aerialPerspective) {float previousRadiance=getLuminanceUnclamped(aerialPerspective.rgb);aerialPerspective.rgb=mix(vec3(previousRadiance),aerialPerspective.rgb,aerialPerspectiveSaturation);return aerialPerspective;}\nvec4 applyAerialPerspectiveIntensity(vec4 aerialPerspective) {\n#if APPLY_AERIAL_PERSPECTIVE_INTENSITY\nif (aerialPerspectiveIntensity==0.) {aerialPerspective=vec4(0.);} else {float previousAlpha=aerialPerspective.a;aerialPerspective/=max(0.00001,previousAlpha);aerialPerspective*=pow(previousAlpha,1./aerialPerspectiveIntensity);}\n#endif\nreturn aerialPerspective;}\nvec4 applyAerialPerspectiveRadianceBias(vec4 aerialPerspective) {\n#if APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS\nfloat originalRadiance=dot(aerialPerspective.rgb,LuminanceEncodeApprox);float targetRadiance=originalRadiance+aerialPerspectiveRadianceBias;if (originalRadiance>0.) {aerialPerspective*=max(0.,targetRadiance/originalRadiance);} else {aerialPerspective=max(vec4(0.),vec4(aerialPerspectiveRadianceBias));}\naerialPerspective.a=min(aerialPerspective.a,1.);\n#endif\nreturn aerialPerspective;}\nbool sampleAerialPerspectiveLut(\nvec2 screenUV,\nbool clampToLutRange,\nfloat distanceFromCamera,\nfloat numAerialPerspectiveLutLayers,\nfloat aerialPerspectiveLutKMPerSlice,\nfloat aerialPerspectiveLutRangeKM,\nout vec4 aerialPerspective) {aerialPerspective=vec4(0.);\n#if USE_AERIAL_PERSPECTIVE_LUT\nif (distanceFromCamera>0. &&\n(clampToLutRange || distanceFromCamera<aerialPerspectiveLutRangeKM) &&\nclampedCameraRadius<=atmosphereRadius) {float layer=toAerialPerspectiveLayer(distanceFromCamera,aerialPerspectiveLutKMPerSlice);float normalizedLayer=sqrt(layer/numAerialPerspectiveLutLayers); \nlayer=min(normalizedLayer*numAerialPerspectiveLutLayers,numAerialPerspectiveLutLayers);float weight=min(layer,1.);float layerIdx=max(0.,layer-1.);float floorLayerIdx=floor(layerIdx);vec4 aerialPerspectiveLayer0=textureLod(aerialPerspectiveLut,vec3(screenUV,floorLayerIdx),0.);vec4 aerialPerspectiveLayer1=textureLod(aerialPerspectiveLut,vec3(screenUV,floorLayerIdx+1.),0.);aerialPerspective=mix(aerialPerspectiveLayer0,aerialPerspectiveLayer1,layerIdx-floorLayerIdx);aerialPerspective.rgb*=atmosphereExposure;aerialPerspective=applyAerialPerspectiveSaturation(aerialPerspective);aerialPerspective=weight*applyAerialPerspectiveIntensity(aerialPerspective);aerialPerspective=applyAerialPerspectiveRadianceBias(aerialPerspective);return true;}\n#endif\nreturn false;}\n#if RENDER_TRANSMITTANCE\nvoid getTransmittanceParameters(vec2 uv,out float radius,out float cosAngleLightToZenith,out float distanceToAtmosphereEdge) {vec2 unit=uvToUnit(uv,TransmittanceLutDomainInUVSpace,TransmittanceLutHalfTexelSize);float distanceToHorizon=unit.y*horizonDistanceToAtmosphereEdge;float distanceToHorizonSquared=distanceToHorizon*distanceToHorizon;radius=sqrtClamped(distanceToHorizonSquared+planetRadiusSquared);float minDistanceToAtmosphereEdge=atmosphereRadius-radius;float maxDistanceToAtmosphereEdge=distanceToHorizon+horizonDistanceToAtmosphereEdge;distanceToAtmosphereEdge=minDistanceToAtmosphereEdge+unit.x*(maxDistanceToAtmosphereEdge-minDistanceToAtmosphereEdge);float distanceToAtmosphereEdgeSquared=distanceToAtmosphereEdge*distanceToAtmosphereEdge;cosAngleLightToZenith =\ndistanceToAtmosphereEdge<=0. ?\n1. :\n(horizonDistanceToAtmosphereEdgeSquared-distanceToAtmosphereEdgeSquared-distanceToHorizonSquared)/(2.*radius*distanceToAtmosphereEdge);cosAngleLightToZenith=clamp(cosAngleLightToZenith,-1.,1.);}\nvec4 renderTransmittance(vec2 uv) {float radius,cosAngleLightToZenith,distanceToAtmosphereEdgeAlongAngle;getTransmittanceParameters(uv,radius,cosAngleLightToZenith,distanceToAtmosphereEdgeAlongAngle);float sinAngleLightToZenith=sqrtClamped(1.-cosAngleLightToZenith*cosAngleLightToZenith);vec3 directionToLight=normalize(vec3(0.,cosAngleLightToZenith,sinAngleLightToZenith));vec3 transmittance=computeTransmittance(vec3(0.,radius,0.),directionToLight,distanceToAtmosphereEdgeAlongAngle,transmittanceSampleCount);return vec4(transmittance,avg(transmittance));}\n#endif\n#if RENDER_MULTI_SCATTERING\nvec3 getSphereSample(float azimuth,float inclination,out float sinInclination) {sinInclination=sin(inclination);return vec3(sinInclination*sin(azimuth),cos(inclination),sinInclination*cos(azimuth));}\nvec4 renderMultiScattering(vec2 uv,sampler2D transmittanceLut) {float MultiScatteringAzimuthIterationAngle=TWO_PI/multiScatteringAzimuthSampleCount;float MultiScatteringInclinationIterationAngle=PI/multiScatteringInclinationSampleCount;float MultiScatteringAngleStepProduct=MultiScatteringAzimuthIterationAngle*MultiScatteringInclinationIterationAngle;vec2 unit=uvToUnit(uv,MultiScatteringLutDomainInUVSpace,MultiScatteringLutHalfTexelSize);float cosAngleLightToZenith=2.*unit.x-1.;float sinAngleLightToZenith=sqrtClamped(1.-cosAngleLightToZenith*cosAngleLightToZenith);vec3 directionToLight=normalize(vec3(0.,cosAngleLightToZenith,sinAngleLightToZenith));float rayOriginRadius=planetRadius+max(unit.y,0.001)*atmosphereThickness;vec3 rayOrigin=vec3(0.,rayOriginRadius,0.);vec3 inscattered=vec3(0.);vec3 multiScatteringTotal=vec3(0.);for (float i=0.5; i<multiScatteringAzimuthSampleCount; i+=1.) {float azimuth=MultiScatteringAzimuthIterationAngle*i;for (float j=0.5; j<multiScatteringInclinationSampleCount; j+=1.) {float inclination=MultiScatteringInclinationIterationAngle*j;float sinInclination;vec3 rayDirection=getSphereSample(azimuth,inclination,sinInclination);vec3 transmittance;vec3 multiScattering;vec3 radiance=integrateScatteredRadiance(\nfalse,\n1.,\ntransmittanceLut,\nrayOrigin,\nrayDirection,\ndirectionToLight,\n100000000.,\nmultiScatteringLutSampleCount,\n-1.,\ntransmittance,\nmultiScattering);float weight=RECIPROCAL_PI4*abs(sinInclination)*MultiScatteringAngleStepProduct;multiScatteringTotal+=multiScattering*weight;inscattered+=radiance*weight;}}\nvec3 multiScattering=inscattered/max(vec3(0.000001),vec3(1.)-multiScatteringTotal);return vec4(multiScattering,1.);}\n#endif\nfloat computeCosHorizonAngleFromZenith(float radius) {float sinAngleBetweenHorizonAndNadir=min(1.,planetRadius/radius);float cosHorizonAngleFromNadir=sqrt(1.-sinAngleBetweenHorizonAndNadir*sinAngleBetweenHorizonAndNadir);float cosHorizonAngleFromZenith=-cosHorizonAngleFromNadir;return cosHorizonAngleFromZenith;}\n#if RENDER_SKY_VIEW\nvoid getSkyViewParametersFromUV(\nfloat radius,\nvec2 uv,\nout float cosAngleBetweenViewAndZenith,\nout float cosAngleBetweenViewAndLightOnPlane) {vec2 unit=uvToUnit(uv,SkyViewLutDomainInUVSpace,SkyViewLutHalfTexelSize);float cosHorizonAngleFromZenith=computeCosHorizonAngleFromZenith(radius);if (unit.y<0.5) {float coord=2.*unit.y; \ncoord*=coord; \ncosAngleBetweenViewAndZenith=mix(-1.,cosHorizonAngleFromZenith,coord); } else {float coord=2.*unit.y-1.; \ncoord*=coord; \ncosAngleBetweenViewAndZenith=mix(cosHorizonAngleFromZenith,1.,coord); }\n{float coord=unit.x;cosAngleBetweenViewAndLightOnPlane=1.-2.*coord;}}\nvec4 renderSkyView(vec2 uv,sampler2D transmittanceLut,sampler2D multiScatteringLut) {float cosAngleBetweenViewAndZenith;float cosAngleBetweenViewAndLightOnPlane;getSkyViewParametersFromUV(clampedCameraRadius,uv,cosAngleBetweenViewAndZenith,cosAngleBetweenViewAndLightOnPlane);float sinAngleBetweenViewAndZenith=sqrtClamped(1.-cosAngleBetweenViewAndZenith*cosAngleBetweenViewAndZenith);float sinAngleBetweenViewAndLightOnPlane=sqrtClamped(1.-cosAngleBetweenViewAndLightOnPlane*cosAngleBetweenViewAndLightOnPlane);vec3 rayDirection =\nvec3(\nsinAngleBetweenViewAndZenith*cosAngleBetweenViewAndLightOnPlane,\ncosAngleBetweenViewAndZenith,\nsinAngleBetweenViewAndZenith*sinAngleBetweenViewAndLightOnPlane);bool intersectsAtmosphere=false;vec3 cameraPositionGlobalClampedToTopOfAtmosphere=vec3(0.);moveToTopAtmosphere(\nvec3(0.,clampedCameraRadius,0.),\nclampedCameraRadius,\nvec3(0.,1.,0.),\nrayDirection,\nintersectsAtmosphere,\ncameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return vec4(0.);}\nvec3 transmittance;vec3 radiance=integrateScatteredRadiance(\nfalse,\natmosphereExposure*lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\nmultiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\ndirectionToLightRelativeToCameraGeocentricNormal,\n100000000.,\nskyViewLutSampleCount,\n-1.,\ntransmittance);float transparency=1.-avg(transmittance);return vec4(radiance,transparency);}\n#endif\n#if RENDER_CAMERA_VOLUME\nvec4 renderCameraVolume(\nvec3 positionOnNearPlane,\nfloat layerIdx,\nsampler2D transmittanceLut,\nsampler2D multiScatteringLut) {vec4 result=vec4(0.);vec3 rayDirection=normalize(positionOnNearPlane);float layer=layerIdxToAerialPerspectiveLayer(layerIdx);float tMax=toAerialPerspectiveDepth(layer);float tMaxMax=tMax;vec3 cameraPositionGlobalClampedToTopOfAtmosphere=clampedCameraPositionGlobal;if (clampedCameraRadius>=atmosphereRadius) {bool intersectsAtmosphere=false;moveToTopAtmosphere(\nclampedCameraPositionGlobal,\nclampedCameraRadius,\ncameraGeocentricNormal,\nrayDirection,\nintersectsAtmosphere,\ncameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return result;}\nfloat distanceToAtmosphere=distance(clampedCameraPositionGlobal,cameraPositionGlobalClampedToTopOfAtmosphere);if (tMaxMax<distanceToAtmosphere) {return result;}\ntMaxMax=max(0.,tMaxMax-distanceToAtmosphere);}\nfloat sampleCount=min(skyViewLutSampleCount,2.*layer+2.);vec3 transmittance;vec3 radiance=integrateScatteredRadiance(\ntrue,\nlightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\nmultiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\ndirectionToLight,\ntMaxMax,\nsampleCount,\n-1.,\ntransmittance);float transparency=1.-avg(transmittance);result=vec4(radiance,transparency);return result;}\n#endif\n";
2202
+ t.ShaderStore.IncludesShadersStore[xt] || (t.ShaderStore.IncludesShadersStore[xt] = Mt);
2203
+ var It = { name: xt, shader: Mt };
2204
+ var wt = { __proto__: null, atmosphereFunctions: It };
2205
+ var bt = "atmosphereUboDeclaration", Ot = "layout(std140,column_major) uniform;uniform Atmosphere {vec3 peakRayleighScattering;float planetRadius;vec3 peakMieScattering;float atmosphereThickness;vec3 peakMieAbsorption;float planetRadiusSquared;vec3 peakMieExtinction;float atmosphereRadius;vec3 peakOzoneAbsorption;float atmosphereRadiusSquared;float horizonDistanceToAtmosphereEdge;float horizonDistanceToAtmosphereEdgeSquared;float planetRadiusWithOffset;float planetRadiusOffset;float atmosphereExposure;float aerialPerspectiveRadianceBias;float inverseAtmosphereThickness;float aerialPerspectiveTransmittanceScale;mat4 inverseViewProjectionWithoutTranslation;vec3 directionToLight;float multiScatteringIntensity;vec3 directionToLightRelativeToCameraGeocentricNormal;float cameraRadius;vec3 lightRadianceAtCamera;float diffuseSkyIrradianceDesaturationFactor;vec3 groundAlbedo;float aerialPerspectiveSaturation;vec3 minMultiScattering;float diffuseSkyIrradianceIntensity;vec3 cameraPositionGlobal;float lightIntensity;vec3 clampedCameraPositionGlobal;float aerialPerspectiveIntensity;vec3 cameraGeocentricNormal;float clampedCameraRadius;vec3 cameraForward;float clampedCameraHeight;vec3 cameraPosition;float cosCameraHorizonAngleFromZenith;vec4 viewport;vec3 additionalDiffuseSkyIrradiance;float cameraHeight;float cameraNearPlane;float originHeight;float sinCameraAtmosphereHorizonAngleFromNadir;float transmittanceSampleCount;float skyViewLutSampleCount;float multiScatteringLutSampleCount;float multiScatteringAzimuthSampleCount;float multiScatteringInclinationSampleCount;float diffuseSkyIrradianceLutSampleCount;};\n";
2206
+ t.ShaderStore.IncludesShadersStore[bt] || (t.ShaderStore.IncludesShadersStore[bt] = Ot);
2207
+ var Dt = { name: bt, shader: Ot };
2208
+ var Nt = { __proto__: null, atmosphereUboDeclaration: Dt };
2209
+ var Ut = "atmosphereFragmentDeclaration", Ft = "uniform vec3 peakRayleighScattering;uniform float planetRadius;uniform vec3 peakMieScattering;uniform float atmosphereThickness;uniform vec3 peakMieAbsorption;uniform float planetRadiusSquared;uniform vec3 peakMieExtinction;uniform float atmosphereRadius;uniform vec3 peakOzoneAbsorption;uniform float atmosphereRadiusSquared;uniform float horizonDistanceToAtmosphereEdge;uniform float horizonDistanceToAtmosphereEdgeSquared;uniform float planetRadiusWithOffset;uniform float planetRadiusOffset;uniform float atmosphereExposure;uniform float aerialPerspectiveRadianceBias;uniform float inverseAtmosphereThickness;uniform float aerialPerspectiveTransmittanceScale;uniform mat4 inverseViewProjectionWithoutTranslation;uniform vec3 directionToLight;uniform float multiScatteringIntensity;uniform vec3 directionToLightRelativeToCameraGeocentricNormal;uniform float cameraRadius;uniform vec3 lightRadianceAtCamera;uniform float diffuseSkyIrradianceDesaturationFactor;uniform vec3 groundAlbedo;uniform float aerialPerspectiveSaturation;uniform vec3 minMultiScattering;uniform float diffuseSkyIrradianceIntensity;uniform vec3 cameraPositionGlobal;uniform float lightIntensity;uniform vec3 clampedCameraPositionGlobal;uniform float aerialPerspectiveIntensity;uniform vec3 cameraGeocentricNormal;uniform float clampedCameraRadius;uniform vec3 cameraForward;uniform float clampedCameraHeight;uniform vec3 cameraPosition;uniform float cosCameraHorizonAngleFromZenith;uniform vec4 viewport;uniform vec3 additionalDiffuseSkyIrradiance;uniform float cameraHeight;uniform float cameraNearPlane;uniform float originHeight;uniform float sinCameraAtmosphereHorizonAngleFromNadir;uniform float transmittanceSampleCount;uniform float skyViewLutSampleCount;uniform float multiScatteringLutSampleCount;uniform float multiScatteringAzimuthSampleCount;uniform float multiScatteringInclinationSampleCount;uniform float diffuseSkyIrradianceLutSampleCount;\n";
2210
+ t.ShaderStore.IncludesShadersStore[Ut] || (t.ShaderStore.IncludesShadersStore[Ut] = Ft);
2211
+ var Vt = { name: Ut, shader: Ft };
2212
+ var Gt = { __proto__: null, atmosphereFragmentDeclaration: Vt };
2213
+ var kt = "fullscreenTriangleVertexShader", zt = "#include<atmosphereUboDeclaration>\n#if POSITION_VEC2\nattribute position: vec2f;\n#else\nattribute position: vec3f;\n#endif\nuniform depth: f32;varying vUV: vec2f;\n#if COMPUTE_WORLD_RAY\nvarying positionOnNearPlane: vec3f;\n#endif\n#if COMPUTE_WORLD_RAY\nconst nearPlaneNDC: f32=-1.0;\n#endif\n@vertex\nfn main(input: VertexInputs)->FragmentInputs {vertexOutputs.position=vec4f(input.position.xy,uniforms.depth,1.0);vertexOutputs.vUV=input.position.xy*vec2f(0.5,0.5)+vec2f(0.5,0.5);\n#if COMPUTE_WORLD_RAY\nvertexOutputs.positionOnNearPlane=(atmosphere.inverseViewProjectionWithoutTranslation*vec4f(input.position.xy,nearPlaneNDC,1.0)).xyz;\n#endif\n}\n";
2214
+ t.ShaderStore.ShadersStoreWGSL[kt] || (t.ShaderStore.ShadersStoreWGSL[kt] = zt);
2215
+ var Bt = [Rt];
1797
2216
  try {
1798
- for (var Vt_1 = __values(Vt), Vt_1_1 = Vt_1.next(); !Vt_1_1.done; Vt_1_1 = Vt_1.next()) {
1799
- var e_87 = Vt_1_1.value;
1800
- t.ShaderStore.IncludesShadersStoreWGSL[e_87.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_87.name] = e_87.shader);
2217
+ for (var Bt_1 = __values(Bt), Bt_1_1 = Bt_1.next(); !Bt_1_1.done; Bt_1_1 = Bt_1.next()) {
2218
+ var e_99 = Bt_1_1.value;
2219
+ t.ShaderStore.IncludesShadersStoreWGSL[e_99.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_99.name] = e_99.shader);
1801
2220
  }
1802
2221
  }
1803
2222
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
1804
2223
  finally {
1805
2224
  try {
1806
- if (Vt_1_1 && !Vt_1_1.done && (_a = Vt_1.return)) _a.call(Vt_1);
2225
+ if (Bt_1_1 && !Bt_1_1.done && (_a = Bt_1.return)) _a.call(Bt_1);
1807
2226
  }
1808
2227
  finally { if (e_1) throw e_1.error; }
1809
2228
  }
1810
- var Ft = { __proto__: null, fullscreenTriangleVertexShaderWGSL: { name: Ot, shader: Nt } };
1811
- var Ut = "diffuseSkyIrradiancePixelShader", kt = "#include<atmosphereUboDeclaration>\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nfn integrateForIrradiance(directionToLightParam: vec3f,rayDirection: vec3f,rayOrigin: vec3f)->vec3f {var transmittance: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\n1.,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\nrayOrigin,\nrayDirection.xzy,\ndirectionToLightParam.xzy,\n100000000.,\natmosphere.diffuseSkyIrradianceLutSampleCount,\n-1.,\n&transmittance);return radiance;}\n#include<importanceSampling>\n#include<pbrBRDFFunctions>\n#include<hdrFilteringFunctions>\nvarying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {let unit=uvToUnit(input.vUV,DiffuseSkyIrradianceLutDomainInUVSpace,DiffuseSkyIrradianceLutHalfTexelSize);let cosLightInclination=2.*unit.x-1.;let sinLightInclination=sqrtClamped(1.-cosLightInclination*cosLightInclination);let directionToLight=normalize(vec3f(0.,cosLightInclination,sinLightInclination));let radius=max(atmosphere.planetRadiusWithOffset,unit.y*atmosphere.atmosphereThickness+atmosphere.planetRadius);let swappedDirectionToLight=vec3f(directionToLight.x,directionToLight.z,directionToLight.y); \nvar irradianceResult=PI*irradiance(\nswappedDirectionToLight,\nvec2f(radius,0.),\n1.,\nvec3f(1.),\nvec3f(1.));let averageIrradiance=getLuminanceUnclamped(irradianceResult);let newIrradiance=mix(irradianceResult,vec3f(averageIrradiance),atmosphere.diffuseSkyIrradianceDesaturationFactor);let newIrradianceScale=getLuminanceUnclamped(newIrradiance);let rescaling=averageIrradiance/max(0.000001,newIrradianceScale);irradianceResult=newIrradiance*rescaling;fragmentOutputs.color=vec4f(irradianceResult,1.);}\n";
1812
- t.ShaderStore.ShadersStoreWGSL[Ut] || (t.ShaderStore.ShadersStoreWGSL[Ut] = kt);
1813
- var Gt = [yt, t.helperFunctionsWGSL, t.intersectionFunctionsWGSL, gt, t.importanceSamplingWGSL, t.pbrBRDFFunctionsWGSL, t.hdrFilteringFunctionsWGSL];
2229
+ var Wt = { __proto__: null, fullscreenTriangleVertexShaderWGSL: { name: kt, shader: zt } };
2230
+ var Ht = "diffuseSkyIrradiancePixelShader", qt = "#include<atmosphereUboDeclaration>\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nfn integrateForIrradiance(directionToLightParam: vec3f,rayDirection: vec3f,rayOrigin: vec3f)->vec3f {var transmittance: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\n1.,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\nrayOrigin,\nrayDirection.xzy,\ndirectionToLightParam.xzy,\n100000000.,\natmosphere.diffuseSkyIrradianceLutSampleCount,\n-1.,\n&transmittance);return radiance;}\n#include<importanceSampling>\n#include<pbrBRDFFunctions>\n#include<hdrFilteringFunctions>\nvarying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {let unit=uvToUnit(input.vUV,DiffuseSkyIrradianceLutDomainInUVSpace,DiffuseSkyIrradianceLutHalfTexelSize);let cosLightInclination=2.*unit.x-1.;let sinLightInclination=sqrtClamped(1.-cosLightInclination*cosLightInclination);let directionToLight=normalize(vec3f(0.,cosLightInclination,sinLightInclination));let radius=max(atmosphere.planetRadiusWithOffset,unit.y*atmosphere.atmosphereThickness+atmosphere.planetRadius);let swappedDirectionToLight=vec3f(directionToLight.x,directionToLight.z,directionToLight.y); \nvar irradianceResult=PI*irradiance(\nswappedDirectionToLight,\nvec2f(radius,0.),\n1.,\nvec3f(1.),\nvec3f(1.));let averageIrradiance=getLuminanceUnclamped(irradianceResult);let newIrradiance=mix(irradianceResult,vec3f(averageIrradiance),atmosphere.diffuseSkyIrradianceDesaturationFactor);let newIrradianceScale=getLuminanceUnclamped(newIrradiance);let rescaling=averageIrradiance/max(0.000001,newIrradianceScale);irradianceResult=newIrradiance*rescaling;fragmentOutputs.color=vec4f(irradianceResult,1.);}\n";
2231
+ t.ShaderStore.ShadersStoreWGSL[Ht] || (t.ShaderStore.ShadersStoreWGSL[Ht] = qt);
2232
+ var Zt = [Rt, t.helperFunctionsWGSL, t.intersectionFunctionsWGSL, At, t.importanceSamplingWGSL, t.pbrBRDFFunctionsWGSL, t.hdrFilteringFunctionsWGSL];
1814
2233
  try {
1815
- for (var Gt_1 = __values(Gt), Gt_1_1 = Gt_1.next(); !Gt_1_1.done; Gt_1_1 = Gt_1.next()) {
1816
- var e_88 = Gt_1_1.value;
1817
- t.ShaderStore.IncludesShadersStoreWGSL[e_88.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_88.name] = e_88.shader);
2234
+ for (var Zt_1 = __values(Zt), Zt_1_1 = Zt_1.next(); !Zt_1_1.done; Zt_1_1 = Zt_1.next()) {
2235
+ var e_100 = Zt_1_1.value;
2236
+ t.ShaderStore.IncludesShadersStoreWGSL[e_100.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_100.name] = e_100.shader);
1818
2237
  }
1819
2238
  }
1820
2239
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
1821
2240
  finally {
1822
2241
  try {
1823
- if (Gt_1_1 && !Gt_1_1.done && (_b = Gt_1.return)) _b.call(Gt_1);
2242
+ if (Zt_1_1 && !Zt_1_1.done && (_b = Zt_1.return)) _b.call(Zt_1);
1824
2243
  }
1825
2244
  finally { if (e_2) throw e_2.error; }
1826
2245
  }
1827
- var zt = { __proto__: null, diffuseSkyIrradiancePixelShaderWGSL: { name: Ut, shader: kt } };
1828
- var Bt = "fullscreenTriangleVertexShader", Ht = "precision highp float;\n#include<__decl__atmosphereFragment>\n#if POSITION_VEC2\nattribute vec2 position;\n#else\nattribute vec3 position;\n#endif\nuniform float depth;varying vec2 uv;\n#if COMPUTE_WORLD_RAY\nvarying vec3 positionOnNearPlane;\n#endif\n#if COMPUTE_WORLD_RAY\nconst float nearPlaneNDC=-1.;\n#endif\nvoid main() {gl_Position=vec4(position.xy,depth,1.);uv=0.5*position.xy+vec2(0.5);\n#if COMPUTE_WORLD_RAY\npositionOnNearPlane=(inverseViewProjectionWithoutTranslation*vec4(position.xy,nearPlaneNDC,1.)).xyz;\n#endif\n}";
1829
- t.ShaderStore.ShadersStore[Bt] || (t.ShaderStore.ShadersStore[Bt] = Ht);
1830
- var Wt = [bt, xt];
2246
+ var $t = { __proto__: null, diffuseSkyIrradiancePixelShaderWGSL: { name: Ht, shader: qt } };
2247
+ var Yt = "fullscreenTriangleVertexShader", jt = "precision highp float;\n#include<__decl__atmosphereFragment>\n#if POSITION_VEC2\nattribute vec2 position;\n#else\nattribute vec3 position;\n#endif\nuniform float depth;varying vec2 uv;\n#if COMPUTE_WORLD_RAY\nvarying vec3 positionOnNearPlane;\n#endif\n#if COMPUTE_WORLD_RAY\nconst float nearPlaneNDC=-1.;\n#endif\nvoid main() {gl_Position=vec4(position.xy,depth,1.);uv=0.5*position.xy+vec2(0.5);\n#if COMPUTE_WORLD_RAY\npositionOnNearPlane=(inverseViewProjectionWithoutTranslation*vec4(position.xy,nearPlaneNDC,1.)).xyz;\n#endif\n}";
2248
+ t.ShaderStore.ShadersStore[Yt] || (t.ShaderStore.ShadersStore[Yt] = jt);
2249
+ var Xt = [Vt, Dt];
1831
2250
  try {
1832
- for (var Wt_1 = __values(Wt), Wt_1_1 = Wt_1.next(); !Wt_1_1.done; Wt_1_1 = Wt_1.next()) {
1833
- var e_89 = Wt_1_1.value;
1834
- t.ShaderStore.IncludesShadersStore[e_89.name] || (t.ShaderStore.IncludesShadersStore[e_89.name] = e_89.shader);
2251
+ for (var Xt_1 = __values(Xt), Xt_1_1 = Xt_1.next(); !Xt_1_1.done; Xt_1_1 = Xt_1.next()) {
2252
+ var e_101 = Xt_1_1.value;
2253
+ t.ShaderStore.IncludesShadersStore[e_101.name] || (t.ShaderStore.IncludesShadersStore[e_101.name] = e_101.shader);
1835
2254
  }
1836
2255
  }
1837
2256
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
1838
2257
  finally {
1839
2258
  try {
1840
- if (Wt_1_1 && !Wt_1_1.done && (_c = Wt_1.return)) _c.call(Wt_1);
2259
+ if (Xt_1_1 && !Xt_1_1.done && (_c = Xt_1.return)) _c.call(Xt_1);
1841
2260
  }
1842
2261
  finally { if (e_3) throw e_3.error; }
1843
2262
  }
1844
- var qt = { __proto__: null, fullscreenTriangleVertexShader: { name: Bt, shader: Ht } };
1845
- var Zt = "diffuseSkyIrradiancePixelShader", Yt = "precision highp float;\n#include<__decl__atmosphereFragment>\nuniform sampler2D transmittanceLut;uniform sampler2D multiScatteringLut;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvec3 integrateForIrradiance(vec3 directionToLight,vec3 rayDirection,vec3 rayOrigin) {vec3 transmittance;vec3 radiance=integrateScatteredRadiance(\nfalse,\n1.,\ntransmittanceLut,\nmultiScatteringLut,\nmultiScatteringIntensity,\nrayOrigin,\nrayDirection.xzy,\ndirectionToLight.xzy,\n100000000.,\ndiffuseSkyIrradianceLutSampleCount,\n-1.,\ntransmittance);return radiance;}\n#include<importanceSampling>\n#include<pbrBRDFFunctions>\n#include<hdrFilteringFunctions>\nvarying vec2 uv;void main() {vec2 unit=uvToUnit(uv,DiffuseSkyIrradianceLutDomainInUVSpace,DiffuseSkyIrradianceLutHalfTexelSize);float cosLightInclination=2.*unit.x-1.;float sinLightInclination=sqrtClamped(1.-cosLightInclination*cosLightInclination);vec3 directionToLight=normalize(vec3(0.,cosLightInclination,sinLightInclination));float radius=max(planetRadiusWithOffset,unit.y*atmosphereThickness+planetRadius);vec3 swappedDirectionToLight=vec3(directionToLight.x,directionToLight.z,directionToLight.y); \nvec3 irradiance=PI*irradiance(\nswappedDirectionToLight,\nvec2(radius,0.),\n1.,\nvec3(1.),\nvec3(1.));float averageIrradiance=getLuminanceUnclamped(irradiance);vec3 newIrradiance=mix(irradiance,vec3(averageIrradiance),diffuseSkyIrradianceDesaturationFactor);float newIrradianceScale=getLuminanceUnclamped(newIrradiance);float rescaling=averageIrradiance/max(0.000001,newIrradianceScale);irradiance=newIrradiance*rescaling;gl_FragColor=vec4(irradiance,1.);}";
1846
- t.ShaderStore.ShadersStore[Zt] || (t.ShaderStore.ShadersStore[Zt] = Yt);
1847
- var $t = [bt, xt, t.helperFunctions, t.intersectionFunctions, Lt, t.importanceSampling, t.pbrBRDFFunctions, t.hdrFilteringFunctions];
2263
+ var Qt = { __proto__: null, fullscreenTriangleVertexShader: { name: Yt, shader: jt } };
2264
+ var Kt = "diffuseSkyIrradiancePixelShader", Jt = "precision highp float;\n#include<__decl__atmosphereFragment>\nuniform sampler2D transmittanceLut;uniform sampler2D multiScatteringLut;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvec3 integrateForIrradiance(vec3 directionToLight,vec3 rayDirection,vec3 rayOrigin) {vec3 transmittance;vec3 radiance=integrateScatteredRadiance(\nfalse,\n1.,\ntransmittanceLut,\nmultiScatteringLut,\nmultiScatteringIntensity,\nrayOrigin,\nrayDirection.xzy,\ndirectionToLight.xzy,\n100000000.,\ndiffuseSkyIrradianceLutSampleCount,\n-1.,\ntransmittance);return radiance;}\n#include<importanceSampling>\n#include<pbrBRDFFunctions>\n#include<hdrFilteringFunctions>\nvarying vec2 uv;void main() {vec2 unit=uvToUnit(uv,DiffuseSkyIrradianceLutDomainInUVSpace,DiffuseSkyIrradianceLutHalfTexelSize);float cosLightInclination=2.*unit.x-1.;float sinLightInclination=sqrtClamped(1.-cosLightInclination*cosLightInclination);vec3 directionToLight=normalize(vec3(0.,cosLightInclination,sinLightInclination));float radius=max(planetRadiusWithOffset,unit.y*atmosphereThickness+planetRadius);vec3 swappedDirectionToLight=vec3(directionToLight.x,directionToLight.z,directionToLight.y); \nvec3 irradiance=PI*irradiance(\nswappedDirectionToLight,\nvec2(radius,0.),\n1.,\nvec3(1.),\nvec3(1.));float averageIrradiance=getLuminanceUnclamped(irradiance);vec3 newIrradiance=mix(irradiance,vec3(averageIrradiance),diffuseSkyIrradianceDesaturationFactor);float newIrradianceScale=getLuminanceUnclamped(newIrradiance);float rescaling=averageIrradiance/max(0.000001,newIrradianceScale);irradiance=newIrradiance*rescaling;gl_FragColor=vec4(irradiance,1.);}";
2265
+ t.ShaderStore.ShadersStore[Kt] || (t.ShaderStore.ShadersStore[Kt] = Jt);
2266
+ var ei = [Vt, Dt, t.helperFunctions, t.intersectionFunctions, It, t.importanceSampling, t.pbrBRDFFunctions, t.hdrFilteringFunctions];
1848
2267
  try {
1849
- for (var $t_1 = __values($t), $t_1_1 = $t_1.next(); !$t_1_1.done; $t_1_1 = $t_1.next()) {
1850
- var e_90 = $t_1_1.value;
1851
- t.ShaderStore.IncludesShadersStore[e_90.name] || (t.ShaderStore.IncludesShadersStore[e_90.name] = e_90.shader);
2268
+ for (var ei_1 = __values(ei), ei_1_1 = ei_1.next(); !ei_1_1.done; ei_1_1 = ei_1.next()) {
2269
+ var e_102 = ei_1_1.value;
2270
+ t.ShaderStore.IncludesShadersStore[e_102.name] || (t.ShaderStore.IncludesShadersStore[e_102.name] = e_102.shader);
1852
2271
  }
1853
2272
  }
1854
2273
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
1855
2274
  finally {
1856
2275
  try {
1857
- if ($t_1_1 && !$t_1_1.done && (_d = $t_1.return)) _d.call($t_1);
2276
+ if (ei_1_1 && !ei_1_1.done && (_d = ei_1.return)) _d.call(ei_1);
1858
2277
  }
1859
2278
  finally { if (e_4) throw e_4.error; }
1860
2279
  }
1861
- var jt = { __proto__: null, diffuseSkyIrradiancePixelShader: { name: Zt, shader: Yt } };
1862
- var Qt = "transmittancePixelShader", Kt = "#define RENDER_TRANSMITTANCE\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\n#include<atmosphereUboDeclaration>\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=renderTransmittance(input.vUV);}\n";
1863
- t.ShaderStore.ShadersStoreWGSL[Qt] || (t.ShaderStore.ShadersStoreWGSL[Qt] = Kt);
1864
- var Xt = [yt, t.helperFunctionsWGSL, t.intersectionFunctionsWGSL, gt];
2280
+ var ti = { __proto__: null, diffuseSkyIrradiancePixelShader: { name: Kt, shader: Jt } };
2281
+ var ii = "transmittancePixelShader", ri = "#define RENDER_TRANSMITTANCE\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\n#include<atmosphereUboDeclaration>\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=renderTransmittance(input.vUV);}\n";
2282
+ t.ShaderStore.ShadersStoreWGSL[ii] || (t.ShaderStore.ShadersStoreWGSL[ii] = ri);
2283
+ var ni = [Rt, t.helperFunctionsWGSL, t.intersectionFunctionsWGSL, At];
1865
2284
  try {
1866
- for (var Xt_1 = __values(Xt), Xt_1_1 = Xt_1.next(); !Xt_1_1.done; Xt_1_1 = Xt_1.next()) {
1867
- var e_91 = Xt_1_1.value;
1868
- t.ShaderStore.IncludesShadersStoreWGSL[e_91.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_91.name] = e_91.shader);
2285
+ for (var ni_1 = __values(ni), ni_1_1 = ni_1.next(); !ni_1_1.done; ni_1_1 = ni_1.next()) {
2286
+ var e_103 = ni_1_1.value;
2287
+ t.ShaderStore.IncludesShadersStoreWGSL[e_103.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_103.name] = e_103.shader);
1869
2288
  }
1870
2289
  }
1871
2290
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
1872
2291
  finally {
1873
2292
  try {
1874
- if (Xt_1_1 && !Xt_1_1.done && (_f = Xt_1.return)) _f.call(Xt_1);
2293
+ if (ni_1_1 && !ni_1_1.done && (_f = ni_1.return)) _f.call(ni_1);
1875
2294
  }
1876
2295
  finally { if (e_5) throw e_5.error; }
1877
2296
  }
1878
- var Jt = { __proto__: null, transmittancePixelShaderWGSL: { name: Qt, shader: Kt } };
1879
- var ei = "transmittancePixelShader", ti = "#define RENDER_TRANSMITTANCE\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\nprecision highp float;\n#include<__decl__atmosphereFragment>\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;void main() {gl_FragColor=renderTransmittance(uv);}";
1880
- t.ShaderStore.ShadersStore[ei] || (t.ShaderStore.ShadersStore[ei] = ti);
1881
- var ii = [bt, xt, t.helperFunctions, t.intersectionFunctions, Lt];
2297
+ var ai = { __proto__: null, transmittancePixelShaderWGSL: { name: ii, shader: ri } };
2298
+ var si = "transmittancePixelShader", oi = "#define RENDER_TRANSMITTANCE\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\nprecision highp float;\n#include<__decl__atmosphereFragment>\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;void main() {gl_FragColor=renderTransmittance(uv);}";
2299
+ t.ShaderStore.ShadersStore[si] || (t.ShaderStore.ShadersStore[si] = oi);
2300
+ var li = [Vt, Dt, t.helperFunctions, t.intersectionFunctions, It];
1882
2301
  try {
1883
- for (var ii_1 = __values(ii), ii_1_1 = ii_1.next(); !ii_1_1.done; ii_1_1 = ii_1.next()) {
1884
- var e_92 = ii_1_1.value;
1885
- t.ShaderStore.IncludesShadersStore[e_92.name] || (t.ShaderStore.IncludesShadersStore[e_92.name] = e_92.shader);
2302
+ for (var li_1 = __values(li), li_1_1 = li_1.next(); !li_1_1.done; li_1_1 = li_1.next()) {
2303
+ var e_104 = li_1_1.value;
2304
+ t.ShaderStore.IncludesShadersStore[e_104.name] || (t.ShaderStore.IncludesShadersStore[e_104.name] = e_104.shader);
1886
2305
  }
1887
2306
  }
1888
2307
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
1889
2308
  finally {
1890
2309
  try {
1891
- if (ii_1_1 && !ii_1_1.done && (_g = ii_1.return)) _g.call(ii_1);
2310
+ if (li_1_1 && !li_1_1.done && (_g = li_1.return)) _g.call(li_1);
1892
2311
  }
1893
2312
  finally { if (e_6) throw e_6.error; }
1894
2313
  }
1895
- var ni = { __proto__: null, transmittancePixelShader: { name: ei, shader: ti } };
1896
- var ri = "multiScatteringPixelShader", ai = "#define RENDER_MULTI_SCATTERING\n#define COMPUTE_MULTI_SCATTERING\n#include<atmosphereUboDeclaration>\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=renderMultiScattering(input.vUV,transmittanceLut);}\n";
1897
- t.ShaderStore.ShadersStoreWGSL[ri] || (t.ShaderStore.ShadersStoreWGSL[ri] = ai);
1898
- var si = [yt, t.helperFunctionsWGSL, t.intersectionFunctionsWGSL, gt];
2314
+ var ci = { __proto__: null, transmittancePixelShader: { name: si, shader: oi } };
2315
+ var ui = "multiScatteringPixelShader", hi = "#define RENDER_MULTI_SCATTERING\n#define COMPUTE_MULTI_SCATTERING\n#include<atmosphereUboDeclaration>\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=renderMultiScattering(input.vUV,transmittanceLut);}\n";
2316
+ t.ShaderStore.ShadersStoreWGSL[ui] || (t.ShaderStore.ShadersStoreWGSL[ui] = hi);
2317
+ var di = [Rt, t.helperFunctionsWGSL, t.intersectionFunctionsWGSL, At];
1899
2318
  try {
1900
- for (var si_1 = __values(si), si_1_1 = si_1.next(); !si_1_1.done; si_1_1 = si_1.next()) {
1901
- var e_93 = si_1_1.value;
1902
- t.ShaderStore.IncludesShadersStoreWGSL[e_93.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_93.name] = e_93.shader);
2319
+ for (var di_1 = __values(di), di_1_1 = di_1.next(); !di_1_1.done; di_1_1 = di_1.next()) {
2320
+ var e_105 = di_1_1.value;
2321
+ t.ShaderStore.IncludesShadersStoreWGSL[e_105.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_105.name] = e_105.shader);
1903
2322
  }
1904
2323
  }
1905
2324
  catch (e_7_1) { e_7 = { error: e_7_1 }; }
1906
2325
  finally {
1907
2326
  try {
1908
- if (si_1_1 && !si_1_1.done && (_h = si_1.return)) _h.call(si_1);
2327
+ if (di_1_1 && !di_1_1.done && (_h = di_1.return)) _h.call(di_1);
1909
2328
  }
1910
2329
  finally { if (e_7) throw e_7.error; }
1911
2330
  }
1912
- var oi = { __proto__: null, multiScatteringPixelShaderWGSL: { name: ri, shader: ai } };
1913
- var li = "multiScatteringPixelShader", ci = "#define RENDER_MULTI_SCATTERING\n#define COMPUTE_MULTI_SCATTERING\nprecision highp float;\n#include<__decl__atmosphereFragment>\nuniform sampler2D transmittanceLut;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;void main() {gl_FragColor=renderMultiScattering(uv,transmittanceLut);}";
1914
- t.ShaderStore.ShadersStore[li] || (t.ShaderStore.ShadersStore[li] = ci);
1915
- var di = [bt, xt, t.helperFunctions, t.intersectionFunctions, Lt];
2331
+ var mi = { __proto__: null, multiScatteringPixelShaderWGSL: { name: ui, shader: hi } };
2332
+ var pi = "multiScatteringPixelShader", fi = "#define RENDER_MULTI_SCATTERING\n#define COMPUTE_MULTI_SCATTERING\nprecision highp float;\n#include<__decl__atmosphereFragment>\nuniform sampler2D transmittanceLut;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;void main() {gl_FragColor=renderMultiScattering(uv,transmittanceLut);}";
2333
+ t.ShaderStore.ShadersStore[pi] || (t.ShaderStore.ShadersStore[pi] = fi);
2334
+ var gi = [Vt, Dt, t.helperFunctions, t.intersectionFunctions, It];
1916
2335
  try {
1917
- for (var di_1 = __values(di), di_1_1 = di_1.next(); !di_1_1.done; di_1_1 = di_1.next()) {
1918
- var e_94 = di_1_1.value;
1919
- t.ShaderStore.IncludesShadersStore[e_94.name] || (t.ShaderStore.IncludesShadersStore[e_94.name] = e_94.shader);
2336
+ for (var gi_1 = __values(gi), gi_1_1 = gi_1.next(); !gi_1_1.done; gi_1_1 = gi_1.next()) {
2337
+ var e_106 = gi_1_1.value;
2338
+ t.ShaderStore.IncludesShadersStore[e_106.name] || (t.ShaderStore.IncludesShadersStore[e_106.name] = e_106.shader);
1920
2339
  }
1921
2340
  }
1922
2341
  catch (e_8_1) { e_8 = { error: e_8_1 }; }
1923
2342
  finally {
1924
2343
  try {
1925
- if (di_1_1 && !di_1_1.done && (_j = di_1.return)) _j.call(di_1);
2344
+ if (gi_1_1 && !gi_1_1.done && (_j = gi_1.return)) _j.call(gi_1);
1926
2345
  }
1927
2346
  finally { if (e_8) throw e_8.error; }
1928
2347
  }
1929
- var hi = { __proto__: null, multiScatteringPixelShader: { name: li, shader: ci } };
1930
- var ui = "compositeSkyPixelShader", mi = "#define SAMPLE_SKY_VIEW_LUT\n#if USE_SKY_VIEW_LUT\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\n#endif\n#include<atmosphereUboDeclaration>\n#if USE_SKY_VIEW_LUT\nvar skyViewLutSampler: sampler;var skyViewLut: texture_2d<f32>;\n#else\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#endif\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;varying positionOnNearPlane: vec3f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(0.);let rayDirection=normalize(input.positionOnNearPlane);\n#if USE_SKY_VIEW_LUT\nvar cosAngleBetweenViewAndZenith: f32;var isRayIntersectingGround: bool;var skyColor=sampleSkyViewLut(\nskyViewLut,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\natmosphere.directionToLight,\natmosphere.cosCameraHorizonAngleFromZenith,\n&cosAngleBetweenViewAndZenith,\n&isRayIntersectingGround);\n#ifndef APPLY_TRANSMITTANCE_BLENDING\nskyColor=vec4f(skyColor.rgb,0.);\n#endif\nfragmentOutputs.color=skyColor;fragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,select(fragmentOutputs.color.a,1.,isRayIntersectingGround));\n#else\nvar intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return fragmentOutputs;}\nvar transmittance: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\n100000000.,\natmosphere.skyViewLutSampleCount,\n-1.,\n&transmittance);\n#if APPLY_TRANSMITTANCE_BLENDING\nlet transparency=1.-avg(transmittance);\n#else\nlet transparency=0.;\n#endif\nfragmentOutputs.color=vec4f(radiance,transparency);\n#endif\n#if OUTPUT_TO_SRGB\nfragmentOutputs.color=toGammaSpace(fragmentOutputs.color);\n#endif\n}\n";
1931
- t.ShaderStore.ShadersStoreWGSL[ui] || (t.ShaderStore.ShadersStoreWGSL[ui] = mi);
1932
- var pi = [yt, t.helperFunctionsWGSL, t.intersectionFunctionsWGSL, gt];
2348
+ var vi = { __proto__: null, multiScatteringPixelShader: { name: pi, shader: fi } };
2349
+ var _i = "compositeSkyPixelShader", Si = "#define SAMPLE_SKY_VIEW_LUT\n#if USE_SKY_VIEW_LUT\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\n#endif\n#include<atmosphereUboDeclaration>\n#if USE_SKY_VIEW_LUT\nvar skyViewLutSampler: sampler;var skyViewLut: texture_2d<f32>;\n#else\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#endif\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;varying positionOnNearPlane: vec3f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(0.);let rayDirection=normalize(input.positionOnNearPlane);\n#if USE_SKY_VIEW_LUT\nvar cosAngleBetweenViewAndZenith: f32;var isRayIntersectingGround: bool;var skyColor=sampleSkyViewLut(\nskyViewLut,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\natmosphere.directionToLight,\natmosphere.cosCameraHorizonAngleFromZenith,\n&cosAngleBetweenViewAndZenith,\n&isRayIntersectingGround);\n#ifndef APPLY_TRANSMITTANCE_BLENDING\nskyColor=vec4f(skyColor.rgb,0.);\n#endif\nfragmentOutputs.color=skyColor;fragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,select(fragmentOutputs.color.a,1.,isRayIntersectingGround));\n#else\nvar intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return fragmentOutputs;}\nvar transmittance: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\n100000000.,\natmosphere.skyViewLutSampleCount,\n-1.,\n&transmittance);\n#if APPLY_TRANSMITTANCE_BLENDING\nlet transparency=1.-avg(transmittance);\n#else\nlet transparency=0.;\n#endif\nfragmentOutputs.color=vec4f(radiance,transparency);\n#endif\n#if OUTPUT_TO_SRGB\nfragmentOutputs.color=toGammaSpace(fragmentOutputs.color);\n#endif\n}\n";
2350
+ t.ShaderStore.ShadersStoreWGSL[_i] || (t.ShaderStore.ShadersStoreWGSL[_i] = Si);
2351
+ var yi = [Rt, t.helperFunctionsWGSL, t.intersectionFunctionsWGSL, At];
1933
2352
  try {
1934
- for (var pi_1 = __values(pi), pi_1_1 = pi_1.next(); !pi_1_1.done; pi_1_1 = pi_1.next()) {
1935
- var e_95 = pi_1_1.value;
1936
- t.ShaderStore.IncludesShadersStoreWGSL[e_95.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_95.name] = e_95.shader);
2353
+ for (var yi_1 = __values(yi), yi_1_1 = yi_1.next(); !yi_1_1.done; yi_1_1 = yi_1.next()) {
2354
+ var e_107 = yi_1_1.value;
2355
+ t.ShaderStore.IncludesShadersStoreWGSL[e_107.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_107.name] = e_107.shader);
1937
2356
  }
1938
2357
  }
1939
2358
  catch (e_9_1) { e_9 = { error: e_9_1 }; }
1940
2359
  finally {
1941
2360
  try {
1942
- if (pi_1_1 && !pi_1_1.done && (_k = pi_1.return)) _k.call(pi_1);
2361
+ if (yi_1_1 && !yi_1_1.done && (_k = yi_1.return)) _k.call(yi_1);
1943
2362
  }
1944
2363
  finally { if (e_9) throw e_9.error; }
1945
2364
  }
1946
- var fi = { __proto__: null, compositeSkyPixelShaderWGSL: { name: ui, shader: mi } };
1947
- var gi = "compositeSkyPixelShader", vi = "#define SAMPLE_SKY_VIEW_LUT\n#if USE_SKY_VIEW_LUT\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\n#endif\nprecision highp float;precision highp sampler2D;\n#include<__decl__atmosphereFragment>\n#if USE_SKY_VIEW_LUT\nuniform sampler2D skyViewLut;\n#else\nuniform sampler2D transmittanceLut;uniform sampler2D multiScatteringLut;\n#endif\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;varying vec3 positionOnNearPlane;void main() {gl_FragColor=vec4(0.);vec3 rayDirection=normalize(positionOnNearPlane);\n#if USE_SKY_VIEW_LUT\nfloat cosAngleBetweenViewAndZenith;bool isRayIntersectingGround;vec4 skyColor=sampleSkyViewLut(\nskyViewLut,\nclampedCameraRadius,\ncameraGeocentricNormal,\nrayDirection,\ndirectionToLight,\ncosCameraHorizonAngleFromZenith,\ncosAngleBetweenViewAndZenith,\nisRayIntersectingGround);\n#ifndef APPLY_TRANSMITTANCE_BLENDING\nskyColor.a=0.;\n#endif\ngl_FragColor=skyColor;gl_FragColor.a=isRayIntersectingGround ? 1. : gl_FragColor.a;\n#else\nbool intersectsAtmosphere=false;vec3 cameraPositionGlobalClampedToTopOfAtmosphere=vec3(0.);moveToTopAtmosphere(\nclampedCameraPositionGlobal,\nclampedCameraRadius,\ncameraGeocentricNormal,\nrayDirection,\nintersectsAtmosphere,\ncameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return;}\nvec3 transmittance;vec3 radiance=integrateScatteredRadiance(\nfalse,\natmosphereExposure*lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\nmultiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\ndirectionToLight,\n100000000.,\nskyViewLutSampleCount,\n-1.,\ntransmittance);\n#if APPLY_TRANSMITTANCE_BLENDING\nfloat transparency=1.-avg(transmittance);\n#else\nfloat transparency=0.;\n#endif\ngl_FragColor=vec4(radiance,transparency);\n#endif\n#if OUTPUT_TO_SRGB\ngl_FragColor=toGammaSpace(gl_FragColor);\n#endif\n}";
1948
- t.ShaderStore.ShadersStore[gi] || (t.ShaderStore.ShadersStore[gi] = vi);
1949
- var Si = [bt, xt, t.helperFunctions, t.intersectionFunctions, Lt];
2365
+ var Ti = { __proto__: null, compositeSkyPixelShaderWGSL: { name: _i, shader: Si } };
2366
+ var Ai = "compositeSkyPixelShader", Li = "#define SAMPLE_SKY_VIEW_LUT\n#if USE_SKY_VIEW_LUT\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\n#endif\nprecision highp float;precision highp sampler2D;\n#include<__decl__atmosphereFragment>\n#if USE_SKY_VIEW_LUT\nuniform sampler2D skyViewLut;\n#else\nuniform sampler2D transmittanceLut;uniform sampler2D multiScatteringLut;\n#endif\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;varying vec3 positionOnNearPlane;void main() {gl_FragColor=vec4(0.);vec3 rayDirection=normalize(positionOnNearPlane);\n#if USE_SKY_VIEW_LUT\nfloat cosAngleBetweenViewAndZenith;bool isRayIntersectingGround;vec4 skyColor=sampleSkyViewLut(\nskyViewLut,\nclampedCameraRadius,\ncameraGeocentricNormal,\nrayDirection,\ndirectionToLight,\ncosCameraHorizonAngleFromZenith,\ncosAngleBetweenViewAndZenith,\nisRayIntersectingGround);\n#ifndef APPLY_TRANSMITTANCE_BLENDING\nskyColor.a=0.;\n#endif\ngl_FragColor=skyColor;gl_FragColor.a=isRayIntersectingGround ? 1. : gl_FragColor.a;\n#else\nbool intersectsAtmosphere=false;vec3 cameraPositionGlobalClampedToTopOfAtmosphere=vec3(0.);moveToTopAtmosphere(\nclampedCameraPositionGlobal,\nclampedCameraRadius,\ncameraGeocentricNormal,\nrayDirection,\nintersectsAtmosphere,\ncameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return;}\nvec3 transmittance;vec3 radiance=integrateScatteredRadiance(\nfalse,\natmosphereExposure*lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\nmultiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\ndirectionToLight,\n100000000.,\nskyViewLutSampleCount,\n-1.,\ntransmittance);\n#if APPLY_TRANSMITTANCE_BLENDING\nfloat transparency=1.-avg(transmittance);\n#else\nfloat transparency=0.;\n#endif\ngl_FragColor=vec4(radiance,transparency);\n#endif\n#if OUTPUT_TO_SRGB\ngl_FragColor=toGammaSpace(gl_FragColor);\n#endif\n}";
2367
+ t.ShaderStore.ShadersStore[Ai] || (t.ShaderStore.ShadersStore[Ai] = Li);
2368
+ var Pi = [Vt, Dt, t.helperFunctions, t.intersectionFunctions, It];
1950
2369
  try {
1951
- for (var Si_1 = __values(Si), Si_1_1 = Si_1.next(); !Si_1_1.done; Si_1_1 = Si_1.next()) {
1952
- var e_96 = Si_1_1.value;
1953
- t.ShaderStore.IncludesShadersStore[e_96.name] || (t.ShaderStore.IncludesShadersStore[e_96.name] = e_96.shader);
2370
+ for (var Pi_1 = __values(Pi), Pi_1_1 = Pi_1.next(); !Pi_1_1.done; Pi_1_1 = Pi_1.next()) {
2371
+ var e_108 = Pi_1_1.value;
2372
+ t.ShaderStore.IncludesShadersStore[e_108.name] || (t.ShaderStore.IncludesShadersStore[e_108.name] = e_108.shader);
1954
2373
  }
1955
2374
  }
1956
2375
  catch (e_10_1) { e_10 = { error: e_10_1 }; }
1957
2376
  finally {
1958
2377
  try {
1959
- if (Si_1_1 && !Si_1_1.done && (_l = Si_1.return)) _l.call(Si_1);
2378
+ if (Pi_1_1 && !Pi_1_1.done && (_l = Pi_1.return)) _l.call(Pi_1);
1960
2379
  }
1961
2380
  finally { if (e_10) throw e_10.error; }
1962
2381
  }
1963
- var _i = { __proto__: null, compositeSkyPixelShader: { name: gi, shader: vi } };
1964
- var yi = "aerialPerspectivePixelShader", Ti = "#define RENDER_CAMERA_VOLUME\n#include<atmosphereUboDeclaration>\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying positionOnNearPlane: vec3f;uniform layerIdx: f32;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=renderCameraVolume(\ninput.positionOnNearPlane,\nuniforms.layerIdx,\ntransmittanceLut,\nmultiScatteringLut\n);}\n";
1965
- t.ShaderStore.ShadersStoreWGSL[yi] || (t.ShaderStore.ShadersStoreWGSL[yi] = Ti);
1966
- var Ai = [yt, t.helperFunctionsWGSL, t.intersectionFunctionsWGSL, gt];
2382
+ var Ei = { __proto__: null, compositeSkyPixelShader: { name: Ai, shader: Li } };
2383
+ var Ri = "aerialPerspectivePixelShader", Ci = "#define RENDER_CAMERA_VOLUME\n#include<atmosphereUboDeclaration>\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying positionOnNearPlane: vec3f;uniform layerIdx: f32;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=renderCameraVolume(\ninput.positionOnNearPlane,\nuniforms.layerIdx,\ntransmittanceLut,\nmultiScatteringLut\n);}\n";
2384
+ t.ShaderStore.ShadersStoreWGSL[Ri] || (t.ShaderStore.ShadersStoreWGSL[Ri] = Ci);
2385
+ var xi = [Rt, t.helperFunctionsWGSL, t.intersectionFunctionsWGSL, At];
1967
2386
  try {
1968
- for (var Ai_1 = __values(Ai), Ai_1_1 = Ai_1.next(); !Ai_1_1.done; Ai_1_1 = Ai_1.next()) {
1969
- var e_97 = Ai_1_1.value;
1970
- t.ShaderStore.IncludesShadersStoreWGSL[e_97.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_97.name] = e_97.shader);
2387
+ for (var xi_1 = __values(xi), xi_1_1 = xi_1.next(); !xi_1_1.done; xi_1_1 = xi_1.next()) {
2388
+ var e_109 = xi_1_1.value;
2389
+ t.ShaderStore.IncludesShadersStoreWGSL[e_109.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_109.name] = e_109.shader);
1971
2390
  }
1972
2391
  }
1973
2392
  catch (e_11_1) { e_11 = { error: e_11_1 }; }
1974
2393
  finally {
1975
2394
  try {
1976
- if (Ai_1_1 && !Ai_1_1.done && (_m = Ai_1.return)) _m.call(Ai_1);
2395
+ if (xi_1_1 && !xi_1_1.done && (_m = xi_1.return)) _m.call(xi_1);
1977
2396
  }
1978
2397
  finally { if (e_11) throw e_11.error; }
1979
2398
  }
1980
- var Pi = { __proto__: null, aerialPerspectivePixelShaderWGSL: { name: yi, shader: Ti } };
1981
- var Li = "aerialPerspectivePixelShader", Ri = "#define RENDER_CAMERA_VOLUME\nprecision highp float;\n#include<__decl__atmosphereFragment>\nuniform sampler2D transmittanceLut;uniform sampler2D multiScatteringLut;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vec3 positionOnNearPlane;uniform float layerIdx;void main() {gl_FragColor=renderCameraVolume(\npositionOnNearPlane,\nlayerIdx,\ntransmittanceLut,\nmultiScatteringLut\n);}";
1982
- t.ShaderStore.ShadersStore[Li] || (t.ShaderStore.ShadersStore[Li] = Ri);
1983
- var Ei = [bt, xt, t.helperFunctions, t.intersectionFunctions, Lt];
2399
+ var Mi = { __proto__: null, aerialPerspectivePixelShaderWGSL: { name: Ri, shader: Ci } };
2400
+ var Ii = "aerialPerspectivePixelShader", wi = "#define RENDER_CAMERA_VOLUME\nprecision highp float;\n#include<__decl__atmosphereFragment>\nuniform sampler2D transmittanceLut;uniform sampler2D multiScatteringLut;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vec3 positionOnNearPlane;uniform float layerIdx;void main() {gl_FragColor=renderCameraVolume(\npositionOnNearPlane,\nlayerIdx,\ntransmittanceLut,\nmultiScatteringLut\n);}";
2401
+ t.ShaderStore.ShadersStore[Ii] || (t.ShaderStore.ShadersStore[Ii] = wi);
2402
+ var bi = [Vt, Dt, t.helperFunctions, t.intersectionFunctions, It];
1984
2403
  try {
1985
- for (var Ei_1 = __values(Ei), Ei_1_1 = Ei_1.next(); !Ei_1_1.done; Ei_1_1 = Ei_1.next()) {
1986
- var e_98 = Ei_1_1.value;
1987
- t.ShaderStore.IncludesShadersStore[e_98.name] || (t.ShaderStore.IncludesShadersStore[e_98.name] = e_98.shader);
2404
+ for (var bi_1 = __values(bi), bi_1_1 = bi_1.next(); !bi_1_1.done; bi_1_1 = bi_1.next()) {
2405
+ var e_110 = bi_1_1.value;
2406
+ t.ShaderStore.IncludesShadersStore[e_110.name] || (t.ShaderStore.IncludesShadersStore[e_110.name] = e_110.shader);
1988
2407
  }
1989
2408
  }
1990
2409
  catch (e_12_1) { e_12 = { error: e_12_1 }; }
1991
2410
  finally {
1992
2411
  try {
1993
- if (Ei_1_1 && !Ei_1_1.done && (_o = Ei_1.return)) _o.call(Ei_1);
2412
+ if (bi_1_1 && !bi_1_1.done && (_o = bi_1.return)) _o.call(bi_1);
1994
2413
  }
1995
2414
  finally { if (e_12) throw e_12.error; }
1996
2415
  }
1997
- var Ci = { __proto__: null, aerialPerspectivePixelShader: { name: Li, shader: Ri } };
1998
- var xi = "depthFunctions", Ii = "fn reconstructDistanceFromCameraPlane(depth: f32,cameraNearPlane: f32)->f32 {return cameraNearPlane/(1.-depth);}\nfn sampleDistanceFromCameraPlane(depthTex: texture_2d<f32>,depthSampler: sampler,uv: vec2f,cameraNearPlane: f32)->f32 {let depth=textureSampleLevel(depthTex,depthSampler,uv,0.).r;return select(reconstructDistanceFromCameraPlane(depth,cameraNearPlane),0.,depth>=1.);}\nfn reconstructDistanceFromCamera(depth: f32,cameraRayDirection: vec3f,cameraForward: vec3f,cameraNearPlane: f32)->f32 {let distanceFromCameraPlane=reconstructDistanceFromCameraPlane(depth,cameraNearPlane);return distanceFromCameraPlane/max(.00001,dot(cameraForward,cameraRayDirection));}\nfn reconstructDistanceFromCameraWithTexture(\ndepthTex: texture_2d<f32>,\ndepthSampler: sampler,\nuv: vec2f,\ncameraRayDirection: vec3f,\ncameraForward: vec3f,\ncameraNearPlane: f32)->f32 {let depth=textureSampleLevel(depthTex,depthSampler,uv,0.).r;return select(reconstructDistanceFromCamera(depth,cameraRayDirection,cameraForward,cameraNearPlane),0.,depth>=1.);}\n";
1999
- t.ShaderStore.IncludesShadersStoreWGSL[xi] || (t.ShaderStore.IncludesShadersStoreWGSL[xi] = Ii);
2000
- var wi = { name: xi, shader: Ii }, Mi = "compositeAerialPerspectivePixelShader", bi = "#include<atmosphereUboDeclaration>\n#if USE_AERIAL_PERSPECTIVE_LUT\nvar aerialPerspectiveLutSampler: sampler;var aerialPerspectiveLut: texture_2d_array<f32>;\n#endif\nvar depthTextureSampler: sampler;var depthTexture: texture_2d<f32>;var transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<depthFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;varying positionOnNearPlane: vec3f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(0.);let depth=textureSampleLevel(depthTexture,depthTextureSampler,input.vUV,0.).r;if (depth>=1.) {discard;}\nlet rayDirection=normalize(input.positionOnNearPlane);let distanceFromCamera =\nreconstructDistanceFromCamera(\ndepth,\nrayDirection,\natmosphere.cameraForward,\natmosphere.cameraNearPlane);let distanceToSurface=distanceFromCamera/1000.;var aerialPerspective=vec4f(0.);if (sampleAerialPerspectiveLut(\ninput.vUV,\nfalse,\ndistanceToSurface,\nNumAerialPerspectiveLutLayers,\nAerialPerspectiveLutKMPerSlice,\nAerialPerspectiveLutRangeKM,\n&aerialPerspective)) {\n#ifndef APPLY_TRANSMITTANCE_BLENDING\naerialPerspective=vec4f(aerialPerspective.rgb,0.);\n#endif\nfragmentOutputs.color=aerialPerspective;} else {var intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {fragmentOutputs.color=vec4f(0.);return fragmentOutputs;}\nlet isAerialPerspectiveLut=atmosphere.clampedCameraRadius<atmosphere.atmosphereRadius;var transmittance: vec3f;let radiance=integrateScatteredRadiance(\nisAerialPerspectiveLut,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\n100000000.,\natmosphere.skyViewLutSampleCount,\ndistanceToSurface,\n&transmittance);let transparency=1.-avg(transmittance);fragmentOutputs.color =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(vec4f(radiance,transparency))));\n#ifndef APPLY_TRANSMITTANCE_BLENDING\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,0.);\n#endif\n}\n#if OUTPUT_TO_SRGB\nfragmentOutputs.color=toGammaSpace(fragmentOutputs.color);\n#endif\n}\n";
2001
- t.ShaderStore.ShadersStoreWGSL[Mi] || (t.ShaderStore.ShadersStoreWGSL[Mi] = bi);
2002
- var Di = [yt, t.helperFunctionsWGSL, wi, t.intersectionFunctionsWGSL, gt];
2416
+ var Oi = { __proto__: null, aerialPerspectivePixelShader: { name: Ii, shader: wi } };
2417
+ var Di = "depthFunctions", Ni = "fn reconstructDistanceFromCameraPlane(depth: f32,cameraNearPlane: f32)->f32 {return cameraNearPlane/(1.-depth);}\nfn sampleDistanceFromCameraPlane(depthTex: texture_2d<f32>,depthSampler: sampler,uv: vec2f,cameraNearPlane: f32)->f32 {let depth=textureSampleLevel(depthTex,depthSampler,uv,0.).r;return select(reconstructDistanceFromCameraPlane(depth,cameraNearPlane),0.,depth>=1.);}\nfn reconstructDistanceFromCamera(depth: f32,cameraRayDirection: vec3f,cameraForward: vec3f,cameraNearPlane: f32)->f32 {let distanceFromCameraPlane=reconstructDistanceFromCameraPlane(depth,cameraNearPlane);return distanceFromCameraPlane/max(.00001,dot(cameraForward,cameraRayDirection));}\nfn reconstructDistanceFromCameraWithTexture(\ndepthTex: texture_2d<f32>,\ndepthSampler: sampler,\nuv: vec2f,\ncameraRayDirection: vec3f,\ncameraForward: vec3f,\ncameraNearPlane: f32)->f32 {let depth=textureSampleLevel(depthTex,depthSampler,uv,0.).r;return select(reconstructDistanceFromCamera(depth,cameraRayDirection,cameraForward,cameraNearPlane),0.,depth>=1.);}\n";
2418
+ t.ShaderStore.IncludesShadersStoreWGSL[Di] || (t.ShaderStore.IncludesShadersStoreWGSL[Di] = Ni);
2419
+ var Ui = { name: Di, shader: Ni }, Fi = "compositeAerialPerspectivePixelShader", Vi = "#include<atmosphereUboDeclaration>\n#if USE_AERIAL_PERSPECTIVE_LUT\nvar aerialPerspectiveLutSampler: sampler;var aerialPerspectiveLut: texture_2d_array<f32>;\n#endif\nvar depthTextureSampler: sampler;var depthTexture: texture_2d<f32>;var transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<depthFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;varying positionOnNearPlane: vec3f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(0.);let depth=textureSampleLevel(depthTexture,depthTextureSampler,input.vUV,0.).r;if (depth>=1.) {discard;}\nlet rayDirection=normalize(input.positionOnNearPlane);let distanceFromCamera =\nreconstructDistanceFromCamera(\ndepth,\nrayDirection,\natmosphere.cameraForward,\natmosphere.cameraNearPlane);let distanceToSurface=distanceFromCamera/1000.;var aerialPerspective=vec4f(0.);if (sampleAerialPerspectiveLut(\ninput.vUV,\nfalse,\ndistanceToSurface,\nNumAerialPerspectiveLutLayers,\nAerialPerspectiveLutKMPerSlice,\nAerialPerspectiveLutRangeKM,\n&aerialPerspective)) {\n#ifndef APPLY_TRANSMITTANCE_BLENDING\naerialPerspective=vec4f(aerialPerspective.rgb,0.);\n#endif\nfragmentOutputs.color=aerialPerspective;} else {var intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {fragmentOutputs.color=vec4f(0.);return fragmentOutputs;}\nlet isAerialPerspectiveLut=atmosphere.clampedCameraRadius<atmosphere.atmosphereRadius;var transmittance: vec3f;let radiance=integrateScatteredRadiance(\nisAerialPerspectiveLut,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\n100000000.,\natmosphere.skyViewLutSampleCount,\ndistanceToSurface,\n&transmittance);let transparency=1.-avg(transmittance);fragmentOutputs.color =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(vec4f(radiance,transparency))));\n#ifndef APPLY_TRANSMITTANCE_BLENDING\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,0.);\n#endif\n}\n#if OUTPUT_TO_SRGB\nfragmentOutputs.color=toGammaSpace(fragmentOutputs.color);\n#endif\n}\n";
2420
+ t.ShaderStore.ShadersStoreWGSL[Fi] || (t.ShaderStore.ShadersStoreWGSL[Fi] = Vi);
2421
+ var Gi = [Rt, t.helperFunctionsWGSL, Ui, t.intersectionFunctionsWGSL, At];
2003
2422
  try {
2004
- for (var Di_1 = __values(Di), Di_1_1 = Di_1.next(); !Di_1_1.done; Di_1_1 = Di_1.next()) {
2005
- var e_99 = Di_1_1.value;
2006
- t.ShaderStore.IncludesShadersStoreWGSL[e_99.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_99.name] = e_99.shader);
2423
+ for (var Gi_1 = __values(Gi), Gi_1_1 = Gi_1.next(); !Gi_1_1.done; Gi_1_1 = Gi_1.next()) {
2424
+ var e_111 = Gi_1_1.value;
2425
+ t.ShaderStore.IncludesShadersStoreWGSL[e_111.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_111.name] = e_111.shader);
2007
2426
  }
2008
2427
  }
2009
2428
  catch (e_13_1) { e_13 = { error: e_13_1 }; }
2010
2429
  finally {
2011
2430
  try {
2012
- if (Di_1_1 && !Di_1_1.done && (_p = Di_1.return)) _p.call(Di_1);
2431
+ if (Gi_1_1 && !Gi_1_1.done && (_p = Gi_1.return)) _p.call(Gi_1);
2013
2432
  }
2014
2433
  finally { if (e_13) throw e_13.error; }
2015
2434
  }
2016
- var Oi = { __proto__: null, compositeAerialPerspectivePixelShaderWGSL: { name: Mi, shader: bi } };
2017
- var Ni = "depthFunctions", Vi = "float reconstructDistanceFromCameraPlane(float depth,float cameraNearPlane) {return cameraNearPlane/(1.-depth);}\nfloat sampleDistanceFromCameraPlane(sampler2D depthTexture,vec2 uv,float cameraNearPlane) {float depth=textureLod(depthTexture,uv,0.).r;return depth>=1. ? 0. : reconstructDistanceFromCameraPlane(depth,cameraNearPlane);}\nfloat reconstructDistanceFromCamera(float depth,vec3 cameraRayDirection,vec3 cameraForward,float cameraNearPlane) {float distanceFromCameraPlane=reconstructDistanceFromCameraPlane(depth,cameraNearPlane);return distanceFromCameraPlane/max(0.00001,dot(cameraForward,cameraRayDirection));}\nfloat reconstructDistanceFromCamera(\nsampler2D depthTexture,\nvec2 uv,\nvec3 cameraRayDirection,\nvec3 cameraForward,\nfloat cameraNearPlane) {float depth=textureLod(depthTexture,uv,0.).r;return depth>=1. ? 0. : reconstructDistanceFromCamera(depth,cameraRayDirection,cameraForward,cameraNearPlane);}";
2018
- t.ShaderStore.IncludesShadersStore[Ni] || (t.ShaderStore.IncludesShadersStore[Ni] = Vi);
2019
- var Fi = { name: Ni, shader: Vi }, Ui = "compositeAerialPerspectivePixelShader", ki = "precision highp float;precision highp sampler2D;precision highp sampler2DArray;\n#include<__decl__atmosphereFragment>\n#if USE_AERIAL_PERSPECTIVE_LUT\nuniform sampler2DArray aerialPerspectiveLut;\n#endif\nuniform sampler2D depthTexture;uniform sampler2D transmittanceLut;uniform sampler2D multiScatteringLut;\n#include<helperFunctions>\n#include<depthFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;varying vec3 positionOnNearPlane;void main() {gl_FragColor=vec4(0.);float depth=textureLod(depthTexture,uv,0.).r;if (depth>=1.) {discard;}\nvec3 rayDirection=normalize(positionOnNearPlane);float distanceFromCamera =\nreconstructDistanceFromCamera(\ndepth,\nrayDirection,\ncameraForward,\ncameraNearPlane);float distanceToSurface=distanceFromCamera/1000.;vec4 aerialPerspective=vec4(0.);if (sampleAerialPerspectiveLut(\nuv,\nfalse,\ndistanceToSurface,\nNumAerialPerspectiveLutLayers,\nAerialPerspectiveLutKMPerSlice,\nAerialPerspectiveLutRangeKM,\naerialPerspective)) {\n#ifndef APPLY_TRANSMITTANCE_BLENDING\naerialPerspective.a=0.;\n#endif\ngl_FragColor=aerialPerspective;} else {bool intersectsAtmosphere=false;vec3 cameraPositionGlobalClampedToTopOfAtmosphere=vec3(0.);moveToTopAtmosphere(\nclampedCameraPositionGlobal,\nclampedCameraRadius,\ncameraGeocentricNormal,\nrayDirection,\nintersectsAtmosphere,\ncameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {gl_FragColor=vec4(0.);return;}\nbool isAerialPerspectiveLut=clampedCameraRadius<atmosphereRadius;vec3 transmittance;vec3 radiance=integrateScatteredRadiance(\nisAerialPerspectiveLut,\natmosphereExposure*lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\nmultiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\ndirectionToLight,\n100000000.,\nskyViewLutSampleCount,\ndistanceToSurface,\ntransmittance);float transparency=1.-avg(transmittance);gl_FragColor =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(vec4(radiance,transparency))));\n#ifndef APPLY_TRANSMITTANCE_BLENDING\ngl_FragColor.a=0.;\n#endif\n}\n#if OUTPUT_TO_SRGB\ngl_FragColor=toGammaSpace(gl_FragColor);\n#endif\n}";
2020
- t.ShaderStore.ShadersStore[Ui] || (t.ShaderStore.ShadersStore[Ui] = ki);
2021
- var Gi = [bt, xt, t.helperFunctions, Fi, t.intersectionFunctions, Lt];
2435
+ var ki = { __proto__: null, compositeAerialPerspectivePixelShaderWGSL: { name: Fi, shader: Vi } };
2436
+ var zi = "depthFunctions", Bi = "float reconstructDistanceFromCameraPlane(float depth,float cameraNearPlane) {return cameraNearPlane/(1.-depth);}\nfloat sampleDistanceFromCameraPlane(sampler2D depthTexture,vec2 uv,float cameraNearPlane) {float depth=textureLod(depthTexture,uv,0.).r;return depth>=1. ? 0. : reconstructDistanceFromCameraPlane(depth,cameraNearPlane);}\nfloat reconstructDistanceFromCamera(float depth,vec3 cameraRayDirection,vec3 cameraForward,float cameraNearPlane) {float distanceFromCameraPlane=reconstructDistanceFromCameraPlane(depth,cameraNearPlane);return distanceFromCameraPlane/max(0.00001,dot(cameraForward,cameraRayDirection));}\nfloat reconstructDistanceFromCamera(\nsampler2D depthTexture,\nvec2 uv,\nvec3 cameraRayDirection,\nvec3 cameraForward,\nfloat cameraNearPlane) {float depth=textureLod(depthTexture,uv,0.).r;return depth>=1. ? 0. : reconstructDistanceFromCamera(depth,cameraRayDirection,cameraForward,cameraNearPlane);}";
2437
+ t.ShaderStore.IncludesShadersStore[zi] || (t.ShaderStore.IncludesShadersStore[zi] = Bi);
2438
+ var Wi = { name: zi, shader: Bi }, Hi = "compositeAerialPerspectivePixelShader", qi = "precision highp float;precision highp sampler2D;precision highp sampler2DArray;\n#include<__decl__atmosphereFragment>\n#if USE_AERIAL_PERSPECTIVE_LUT\nuniform sampler2DArray aerialPerspectiveLut;\n#endif\nuniform sampler2D depthTexture;uniform sampler2D transmittanceLut;uniform sampler2D multiScatteringLut;\n#include<helperFunctions>\n#include<depthFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;varying vec3 positionOnNearPlane;void main() {gl_FragColor=vec4(0.);float depth=textureLod(depthTexture,uv,0.).r;if (depth>=1.) {discard;}\nvec3 rayDirection=normalize(positionOnNearPlane);float distanceFromCamera =\nreconstructDistanceFromCamera(\ndepth,\nrayDirection,\ncameraForward,\ncameraNearPlane);float distanceToSurface=distanceFromCamera/1000.;vec4 aerialPerspective=vec4(0.);if (sampleAerialPerspectiveLut(\nuv,\nfalse,\ndistanceToSurface,\nNumAerialPerspectiveLutLayers,\nAerialPerspectiveLutKMPerSlice,\nAerialPerspectiveLutRangeKM,\naerialPerspective)) {\n#ifndef APPLY_TRANSMITTANCE_BLENDING\naerialPerspective.a=0.;\n#endif\ngl_FragColor=aerialPerspective;} else {bool intersectsAtmosphere=false;vec3 cameraPositionGlobalClampedToTopOfAtmosphere=vec3(0.);moveToTopAtmosphere(\nclampedCameraPositionGlobal,\nclampedCameraRadius,\ncameraGeocentricNormal,\nrayDirection,\nintersectsAtmosphere,\ncameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {gl_FragColor=vec4(0.);return;}\nbool isAerialPerspectiveLut=clampedCameraRadius<atmosphereRadius;vec3 transmittance;vec3 radiance=integrateScatteredRadiance(\nisAerialPerspectiveLut,\natmosphereExposure*lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\nmultiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\ndirectionToLight,\n100000000.,\nskyViewLutSampleCount,\ndistanceToSurface,\ntransmittance);float transparency=1.-avg(transmittance);gl_FragColor =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(vec4(radiance,transparency))));\n#ifndef APPLY_TRANSMITTANCE_BLENDING\ngl_FragColor.a=0.;\n#endif\n}\n#if OUTPUT_TO_SRGB\ngl_FragColor=toGammaSpace(gl_FragColor);\n#endif\n}";
2439
+ t.ShaderStore.ShadersStore[Hi] || (t.ShaderStore.ShadersStore[Hi] = qi);
2440
+ var Zi = [Vt, Dt, t.helperFunctions, Wi, t.intersectionFunctions, It];
2022
2441
  try {
2023
- for (var Gi_1 = __values(Gi), Gi_1_1 = Gi_1.next(); !Gi_1_1.done; Gi_1_1 = Gi_1.next()) {
2024
- var e_100 = Gi_1_1.value;
2025
- t.ShaderStore.IncludesShadersStore[e_100.name] || (t.ShaderStore.IncludesShadersStore[e_100.name] = e_100.shader);
2442
+ for (var Zi_1 = __values(Zi), Zi_1_1 = Zi_1.next(); !Zi_1_1.done; Zi_1_1 = Zi_1.next()) {
2443
+ var e_112 = Zi_1_1.value;
2444
+ t.ShaderStore.IncludesShadersStore[e_112.name] || (t.ShaderStore.IncludesShadersStore[e_112.name] = e_112.shader);
2026
2445
  }
2027
2446
  }
2028
2447
  catch (e_14_1) { e_14 = { error: e_14_1 }; }
2029
2448
  finally {
2030
2449
  try {
2031
- if (Gi_1_1 && !Gi_1_1.done && (_q = Gi_1.return)) _q.call(Gi_1);
2450
+ if (Zi_1_1 && !Zi_1_1.done && (_q = Zi_1.return)) _q.call(Zi_1);
2032
2451
  }
2033
2452
  finally { if (e_14) throw e_14.error; }
2034
2453
  }
2035
- var zi = { __proto__: null, compositeAerialPerspectivePixelShader: { name: Ui, shader: ki } };
2036
- var Bi = "compositeGlobeAtmospherePixelShader", Hi = "#define SAMPLE_SKY_VIEW_LUT\n#if USE_SKY_VIEW_LUT\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\n#endif\n#include<atmosphereUboDeclaration>\n#if HAS_DEPTH_TEXTURE\nvar depthTextureSampler: sampler;var depthTexture: texture_2d<f32>;\n#endif\n#if USE_SKY_VIEW_LUT\nvar skyViewLutSampler: sampler;var skyViewLut: texture_2d<f32>;\n#else\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#endif\n#include<helperFunctions>\n#include<depthFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;varying positionOnNearPlane: vec3f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(0.);\n#if HAS_DEPTH_TEXTURE\nlet depth=textureSampleLevel(depthTexture,depthTextureSampler,input.vUV,0.).r;\n#endif\nlet rayDirection=normalize(input.positionOnNearPlane);\n#if USE_SKY_VIEW_LUT\nvar cosAngleBetweenViewAndZenith: f32;var isRayIntersectingGround: bool;var skyColor=sampleSkyViewLut(\nskyViewLut,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\natmosphere.directionToLight,\natmosphere.cosCameraHorizonAngleFromZenith,\n&cosAngleBetweenViewAndZenith,\n&isRayIntersectingGround);fragmentOutputs.color=skyColor;if (isRayIntersectingGround) {fragmentOutputs.color =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(fragmentOutputs.color)));\n#if HAS_DEPTH_TEXTURE\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,select(fragmentOutputs.color.a,1.,depth>=1.));\n#endif\n}\n#else\nvar intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return fragmentOutputs;}\n#if HAS_DEPTH_TEXTURE\nlet distanceFromCamera =\nreconstructDistanceFromCamera(\ndepth,\nrayDirection,\natmosphere.cameraForward,\natmosphere.cameraNearPlane);let distanceToSurface=distanceFromCamera/1000.;\n#else\nlet distanceToSurface=0.;\n#endif\nvar transmittance: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\n100000000.,\natmosphere.skyViewLutSampleCount,\ndistanceToSurface,\n&transmittance);let transparency=1.-avg(transmittance);fragmentOutputs.color=vec4f(radiance,transparency);if (distanceToSurface>0.) {fragmentOutputs.color =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(fragmentOutputs.color)));\n#if HAS_DEPTH_TEXTURE\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,select(fragmentOutputs.color.a,1.,depth>=1.));\n#endif\n}\n#endif\n#if OUTPUT_TO_SRGB\nfragmentOutputs.color=toGammaSpace(fragmentOutputs.color);\n#endif\n}\n";
2037
- t.ShaderStore.ShadersStoreWGSL[Bi] || (t.ShaderStore.ShadersStoreWGSL[Bi] = Hi);
2038
- var Wi = [yt, t.helperFunctionsWGSL, wi, t.intersectionFunctionsWGSL, gt];
2454
+ var $i = { __proto__: null, compositeAerialPerspectivePixelShader: { name: Hi, shader: qi } };
2455
+ var Yi = "compositeGlobeAtmospherePixelShader", ji = "#define SAMPLE_SKY_VIEW_LUT\n#if USE_SKY_VIEW_LUT\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\n#endif\n#include<atmosphereUboDeclaration>\n#if HAS_DEPTH_TEXTURE\nvar depthTextureSampler: sampler;var depthTexture: texture_2d<f32>;\n#endif\n#if USE_SKY_VIEW_LUT\nvar skyViewLutSampler: sampler;var skyViewLut: texture_2d<f32>;\n#else\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#endif\n#include<helperFunctions>\n#include<depthFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;varying positionOnNearPlane: vec3f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(0.);\n#if HAS_DEPTH_TEXTURE\nlet depth=textureSampleLevel(depthTexture,depthTextureSampler,input.vUV,0.).r;\n#endif\nlet rayDirection=normalize(input.positionOnNearPlane);\n#if USE_SKY_VIEW_LUT\nvar cosAngleBetweenViewAndZenith: f32;var isRayIntersectingGround: bool;var skyColor=sampleSkyViewLut(\nskyViewLut,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\natmosphere.directionToLight,\natmosphere.cosCameraHorizonAngleFromZenith,\n&cosAngleBetweenViewAndZenith,\n&isRayIntersectingGround);fragmentOutputs.color=skyColor;if (isRayIntersectingGround) {fragmentOutputs.color =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(fragmentOutputs.color)));\n#if HAS_DEPTH_TEXTURE\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,select(fragmentOutputs.color.a,1.,depth>=1.));\n#endif\n}\n#else\nvar intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return fragmentOutputs;}\n#if HAS_DEPTH_TEXTURE\nlet distanceFromCamera =\nreconstructDistanceFromCamera(\ndepth,\nrayDirection,\natmosphere.cameraForward,\natmosphere.cameraNearPlane);let distanceToSurface=distanceFromCamera/1000.;\n#else\nlet distanceToSurface=0.;\n#endif\nvar transmittance: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\n100000000.,\natmosphere.skyViewLutSampleCount,\ndistanceToSurface,\n&transmittance);let transparency=1.-avg(transmittance);fragmentOutputs.color=vec4f(radiance,transparency);if (distanceToSurface>0.) {fragmentOutputs.color =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(fragmentOutputs.color)));\n#if HAS_DEPTH_TEXTURE\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,select(fragmentOutputs.color.a,1.,depth>=1.));\n#endif\n}\n#endif\n#if OUTPUT_TO_SRGB\nfragmentOutputs.color=toGammaSpace(fragmentOutputs.color);\n#endif\n}\n";
2456
+ t.ShaderStore.ShadersStoreWGSL[Yi] || (t.ShaderStore.ShadersStoreWGSL[Yi] = ji);
2457
+ var Xi = [Rt, t.helperFunctionsWGSL, Ui, t.intersectionFunctionsWGSL, At];
2039
2458
  try {
2040
- for (var Wi_1 = __values(Wi), Wi_1_1 = Wi_1.next(); !Wi_1_1.done; Wi_1_1 = Wi_1.next()) {
2041
- var e_101 = Wi_1_1.value;
2042
- t.ShaderStore.IncludesShadersStoreWGSL[e_101.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_101.name] = e_101.shader);
2459
+ for (var Xi_1 = __values(Xi), Xi_1_1 = Xi_1.next(); !Xi_1_1.done; Xi_1_1 = Xi_1.next()) {
2460
+ var e_113 = Xi_1_1.value;
2461
+ t.ShaderStore.IncludesShadersStoreWGSL[e_113.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_113.name] = e_113.shader);
2043
2462
  }
2044
2463
  }
2045
2464
  catch (e_15_1) { e_15 = { error: e_15_1 }; }
2046
2465
  finally {
2047
2466
  try {
2048
- if (Wi_1_1 && !Wi_1_1.done && (_r = Wi_1.return)) _r.call(Wi_1);
2467
+ if (Xi_1_1 && !Xi_1_1.done && (_s = Xi_1.return)) _s.call(Xi_1);
2049
2468
  }
2050
2469
  finally { if (e_15) throw e_15.error; }
2051
2470
  }
2052
- var qi = { __proto__: null, compositeGlobeAtmospherePixelShaderWGSL: { name: Bi, shader: Hi } };
2053
- var Zi = "compositeGlobeAtmospherePixelShader", Yi = "#define SAMPLE_SKY_VIEW_LUT\n#if USE_SKY_VIEW_LUT\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\n#endif\nprecision highp float;precision highp sampler2D;\n#include<__decl__atmosphereFragment>\n#if HAS_DEPTH_TEXTURE\nuniform sampler2D depthTexture;\n#endif\n#if USE_SKY_VIEW_LUT\nuniform sampler2D skyViewLut;\n#else\nuniform sampler2D transmittanceLut;uniform sampler2D multiScatteringLut;\n#endif\n#include<helperFunctions>\n#include<depthFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;varying vec3 positionOnNearPlane;void main() {gl_FragColor=vec4(0.);\n#if HAS_DEPTH_TEXTURE\nfloat depth=textureLod(depthTexture,uv,0.).r;\n#endif\nvec3 rayDirection=normalize(positionOnNearPlane);\n#if USE_SKY_VIEW_LUT\nfloat cosAngleBetweenViewAndZenith;bool isRayIntersectingGround;vec4 skyColor=sampleSkyViewLut(\nskyViewLut,\nclampedCameraRadius,\ncameraGeocentricNormal,\nrayDirection,\ndirectionToLight,\ncosCameraHorizonAngleFromZenith,\ncosAngleBetweenViewAndZenith,\nisRayIntersectingGround);gl_FragColor=skyColor;if (isRayIntersectingGround) {gl_FragColor =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(gl_FragColor)));\n#if HAS_DEPTH_TEXTURE\ngl_FragColor.a=depth>=1. ? 1. : gl_FragColor.a;\n#endif\n}\n#else\nbool intersectsAtmosphere=false;vec3 cameraPositionGlobalClampedToTopOfAtmosphere=vec3(0.);moveToTopAtmosphere(\nclampedCameraPositionGlobal,\nclampedCameraRadius,\ncameraGeocentricNormal,\nrayDirection,\nintersectsAtmosphere,\ncameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return;}\n#if HAS_DEPTH_TEXTURE\nfloat distanceFromCamera =\nreconstructDistanceFromCamera(\ndepth,\nrayDirection,\ncameraForward,\ncameraNearPlane);float distanceToSurface=distanceFromCamera/1000.;\n#else\nfloat distanceToSurface=0.;\n#endif\nvec3 transmittance;vec3 radiance=integrateScatteredRadiance(\nfalse,\natmosphereExposure*lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\nmultiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\ndirectionToLight,\n100000000.,\nskyViewLutSampleCount,\ndistanceToSurface,\ntransmittance);float transparency=1.-avg(transmittance);gl_FragColor=vec4(radiance,transparency);if (distanceToSurface>0.) {gl_FragColor =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(gl_FragColor)));\n#if HAS_DEPTH_TEXTURE\ngl_FragColor.a=depth>=1. ? 1. : gl_FragColor.a;\n#endif\n}\n#endif\n#if OUTPUT_TO_SRGB\ngl_FragColor=toGammaSpace(gl_FragColor);\n#endif\n}";
2054
- t.ShaderStore.ShadersStore[Zi] || (t.ShaderStore.ShadersStore[Zi] = Yi);
2055
- var $i = [bt, xt, t.helperFunctions, Fi, t.intersectionFunctions, Lt];
2471
+ var Qi = { __proto__: null, compositeGlobeAtmospherePixelShaderWGSL: { name: Yi, shader: ji } };
2472
+ var Ki = "compositeGlobeAtmospherePixelShader", Ji = "#define SAMPLE_SKY_VIEW_LUT\n#if USE_SKY_VIEW_LUT\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\n#endif\nprecision highp float;precision highp sampler2D;\n#include<__decl__atmosphereFragment>\n#if HAS_DEPTH_TEXTURE\nuniform sampler2D depthTexture;\n#endif\n#if USE_SKY_VIEW_LUT\nuniform sampler2D skyViewLut;\n#else\nuniform sampler2D transmittanceLut;uniform sampler2D multiScatteringLut;\n#endif\n#include<helperFunctions>\n#include<depthFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;varying vec3 positionOnNearPlane;void main() {gl_FragColor=vec4(0.);\n#if HAS_DEPTH_TEXTURE\nfloat depth=textureLod(depthTexture,uv,0.).r;\n#endif\nvec3 rayDirection=normalize(positionOnNearPlane);\n#if USE_SKY_VIEW_LUT\nfloat cosAngleBetweenViewAndZenith;bool isRayIntersectingGround;vec4 skyColor=sampleSkyViewLut(\nskyViewLut,\nclampedCameraRadius,\ncameraGeocentricNormal,\nrayDirection,\ndirectionToLight,\ncosCameraHorizonAngleFromZenith,\ncosAngleBetweenViewAndZenith,\nisRayIntersectingGround);gl_FragColor=skyColor;if (isRayIntersectingGround) {gl_FragColor =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(gl_FragColor)));\n#if HAS_DEPTH_TEXTURE\ngl_FragColor.a=depth>=1. ? 1. : gl_FragColor.a;\n#endif\n}\n#else\nbool intersectsAtmosphere=false;vec3 cameraPositionGlobalClampedToTopOfAtmosphere=vec3(0.);moveToTopAtmosphere(\nclampedCameraPositionGlobal,\nclampedCameraRadius,\ncameraGeocentricNormal,\nrayDirection,\nintersectsAtmosphere,\ncameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return;}\n#if HAS_DEPTH_TEXTURE\nfloat distanceFromCamera =\nreconstructDistanceFromCamera(\ndepth,\nrayDirection,\ncameraForward,\ncameraNearPlane);float distanceToSurface=distanceFromCamera/1000.;\n#else\nfloat distanceToSurface=0.;\n#endif\nvec3 transmittance;vec3 radiance=integrateScatteredRadiance(\nfalse,\natmosphereExposure*lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\nmultiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\ndirectionToLight,\n100000000.,\nskyViewLutSampleCount,\ndistanceToSurface,\ntransmittance);float transparency=1.-avg(transmittance);gl_FragColor=vec4(radiance,transparency);if (distanceToSurface>0.) {gl_FragColor =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(gl_FragColor)));\n#if HAS_DEPTH_TEXTURE\ngl_FragColor.a=depth>=1. ? 1. : gl_FragColor.a;\n#endif\n}\n#endif\n#if OUTPUT_TO_SRGB\ngl_FragColor=toGammaSpace(gl_FragColor);\n#endif\n}";
2473
+ t.ShaderStore.ShadersStore[Ki] || (t.ShaderStore.ShadersStore[Ki] = Ji);
2474
+ var er = [Vt, Dt, t.helperFunctions, Wi, t.intersectionFunctions, It];
2056
2475
  try {
2057
- for (var $i_1 = __values($i), $i_1_1 = $i_1.next(); !$i_1_1.done; $i_1_1 = $i_1.next()) {
2058
- var e_102 = $i_1_1.value;
2059
- t.ShaderStore.IncludesShadersStore[e_102.name] || (t.ShaderStore.IncludesShadersStore[e_102.name] = e_102.shader);
2476
+ for (var er_1 = __values(er), er_1_1 = er_1.next(); !er_1_1.done; er_1_1 = er_1.next()) {
2477
+ var e_114 = er_1_1.value;
2478
+ t.ShaderStore.IncludesShadersStore[e_114.name] || (t.ShaderStore.IncludesShadersStore[e_114.name] = e_114.shader);
2060
2479
  }
2061
2480
  }
2062
2481
  catch (e_16_1) { e_16 = { error: e_16_1 }; }
2063
2482
  finally {
2064
2483
  try {
2065
- if ($i_1_1 && !$i_1_1.done && (_s = $i_1.return)) _s.call($i_1);
2484
+ if (er_1_1 && !er_1_1.done && (_u = er_1.return)) _u.call(er_1);
2066
2485
  }
2067
2486
  finally { if (e_16) throw e_16.error; }
2068
2487
  }
2069
- var ji = { __proto__: null, compositeGlobeAtmospherePixelShader: { name: Zi, shader: Yi } };
2070
- var Qi = "skyViewPixelShader", Ki = "#define RENDER_SKY_VIEW\n#include<atmosphereUboDeclaration>\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=renderSkyView(input.vUV,transmittanceLut,multiScatteringLut);}\n";
2071
- t.ShaderStore.ShadersStoreWGSL[Qi] || (t.ShaderStore.ShadersStoreWGSL[Qi] = Ki);
2072
- var Xi = [yt, t.helperFunctionsWGSL, t.intersectionFunctionsWGSL, gt];
2488
+ var tr = { __proto__: null, compositeGlobeAtmospherePixelShader: { name: Ki, shader: Ji } };
2489
+ var ir = "skyViewPixelShader", rr = "#define RENDER_SKY_VIEW\n#include<atmosphereUboDeclaration>\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=renderSkyView(input.vUV,transmittanceLut,multiScatteringLut);}\n";
2490
+ t.ShaderStore.ShadersStoreWGSL[ir] || (t.ShaderStore.ShadersStoreWGSL[ir] = rr);
2491
+ var nr = [Rt, t.helperFunctionsWGSL, t.intersectionFunctionsWGSL, At];
2073
2492
  try {
2074
- for (var Xi_1 = __values(Xi), Xi_1_1 = Xi_1.next(); !Xi_1_1.done; Xi_1_1 = Xi_1.next()) {
2075
- var e_103 = Xi_1_1.value;
2076
- t.ShaderStore.IncludesShadersStoreWGSL[e_103.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_103.name] = e_103.shader);
2493
+ for (var nr_1 = __values(nr), nr_1_1 = nr_1.next(); !nr_1_1.done; nr_1_1 = nr_1.next()) {
2494
+ var e_115 = nr_1_1.value;
2495
+ t.ShaderStore.IncludesShadersStoreWGSL[e_115.name] || (t.ShaderStore.IncludesShadersStoreWGSL[e_115.name] = e_115.shader);
2077
2496
  }
2078
2497
  }
2079
2498
  catch (e_17_1) { e_17 = { error: e_17_1 }; }
2080
2499
  finally {
2081
2500
  try {
2082
- if (Xi_1_1 && !Xi_1_1.done && (_u = Xi_1.return)) _u.call(Xi_1);
2501
+ if (nr_1_1 && !nr_1_1.done && (_v = nr_1.return)) _v.call(nr_1);
2083
2502
  }
2084
2503
  finally { if (e_17) throw e_17.error; }
2085
2504
  }
2086
- var Ji = { __proto__: null, skyViewPixelShaderWGSL: { name: Qi, shader: Ki } };
2087
- var en = "skyViewPixelShader", tn = "#define RENDER_SKY_VIEW\nprecision highp float;precision highp sampler2D;\n#include<__decl__atmosphereFragment>\nuniform sampler2D transmittanceLut;uniform sampler2D multiScatteringLut;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;void main() {gl_FragColor=renderSkyView(uv,transmittanceLut,multiScatteringLut);}";
2088
- t.ShaderStore.ShadersStore[en] || (t.ShaderStore.ShadersStore[en] = tn);
2089
- var nn = [bt, xt, t.helperFunctions, t.intersectionFunctions, Lt];
2505
+ var ar = { __proto__: null, skyViewPixelShaderWGSL: { name: ir, shader: rr } };
2506
+ var sr = "skyViewPixelShader", or = "#define RENDER_SKY_VIEW\nprecision highp float;precision highp sampler2D;\n#include<__decl__atmosphereFragment>\nuniform sampler2D transmittanceLut;uniform sampler2D multiScatteringLut;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;void main() {gl_FragColor=renderSkyView(uv,transmittanceLut,multiScatteringLut);}";
2507
+ t.ShaderStore.ShadersStore[sr] || (t.ShaderStore.ShadersStore[sr] = or);
2508
+ var lr = [Vt, Dt, t.helperFunctions, t.intersectionFunctions, It];
2090
2509
  try {
2091
- for (var nn_1 = __values(nn), nn_1_1 = nn_1.next(); !nn_1_1.done; nn_1_1 = nn_1.next()) {
2092
- var e_104 = nn_1_1.value;
2093
- t.ShaderStore.IncludesShadersStore[e_104.name] || (t.ShaderStore.IncludesShadersStore[e_104.name] = e_104.shader);
2510
+ for (var lr_1 = __values(lr), lr_1_1 = lr_1.next(); !lr_1_1.done; lr_1_1 = lr_1.next()) {
2511
+ var e_116 = lr_1_1.value;
2512
+ t.ShaderStore.IncludesShadersStore[e_116.name] || (t.ShaderStore.IncludesShadersStore[e_116.name] = e_116.shader);
2094
2513
  }
2095
2514
  }
2096
2515
  catch (e_18_1) { e_18 = { error: e_18_1 }; }
2097
2516
  finally {
2098
2517
  try {
2099
- if (nn_1_1 && !nn_1_1.done && (_v = nn_1.return)) _v.call(nn_1);
2518
+ if (lr_1_1 && !lr_1_1.done && (_w = lr_1.return)) _w.call(lr_1);
2100
2519
  }
2101
2520
  finally { if (e_18) throw e_18.error; }
2102
2521
  }
2103
- var rn = { __proto__: null, skyViewPixelShader: { name: en, shader: tn } };
2522
+ var cr = { __proto__: null, skyViewPixelShader: { name: sr, shader: or } };
2523
+ var ur = "multiTextureCompositeAlphaBlendPixelShader", hr = "var uLayers: texture_2d_array<f32>;var uLayersSampler: sampler;uniform uLayerCount: i32;varying vUV: vec2f;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var result: vec4f=vec4f(0.0);for (var i: i32=0; i<MULTITEXTURE_MAXLAYERS; i++) {if (i>=uniforms.uLayerCount) { break; }\nlet s: vec4f=textureSampleLevel(uLayers,uLayersSampler,input.vUV,i,0.0);\n#ifdef MULTITEXTURE_PREMULTIPLY\nresult=s+result*(1.0-s.a);\n#else\nlet pm: vec4f=vec4f(s.rgb*s.a,s.a);result=pm+result*(1.0-s.a);\n#endif\n}\nlet outA: f32=result.a;fragmentOutputs.color=vec4f(select(vec3f(0.0),result.rgb/outA,outA>0.0),outA);}\n";
2524
+ t.ShaderStore.ShadersStoreWGSL[ur] || (t.ShaderStore.ShadersStoreWGSL[ur] = hr);
2525
+ var dr = { __proto__: null, multiTextureCompositeAlphaBlendPixelShaderWGSL: { name: ur, shader: hr } };
2526
+ var mr = "multiTextureCompositeAlphaMaxPixelShader", pr = "var uLayers: texture_2d_array<f32>;var uLayersSampler: sampler;uniform uLayerCount: i32;varying vUV: vec2f;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var result: vec4f=vec4f(0.0);for (var i: i32=0; i<MULTITEXTURE_MAXLAYERS; i++) {if (i>=uniforms.uLayerCount) { break; }\nlet s: vec4f=textureSampleLevel(uLayers,uLayersSampler,input.vUV,i,0.0);if (s.a>=result.a) {result=s;}}\nfragmentOutputs.color=result;}\n";
2527
+ t.ShaderStore.ShadersStoreWGSL[mr] || (t.ShaderStore.ShadersStoreWGSL[mr] = pr);
2528
+ var fr = { __proto__: null, multiTextureCompositeAlphaMaxPixelShaderWGSL: { name: mr, shader: pr } };
2529
+ var gr = "multiTextureCompositeAddPixelShader", vr = "var uLayers: texture_2d_array<f32>;var uLayersSampler: sampler;uniform uLayerCount: i32;varying vUV: vec2f;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var result: vec4f=vec4f(0.0);for (var i: i32=0; i<MULTITEXTURE_MAXLAYERS; i++) {if (i>=uniforms.uLayerCount) { break; }\nlet s: vec4f=textureSampleLevel(uLayers,uLayersSampler,input.vUV,i,0.0);result=min(result+s,vec4f(1.0));}\nfragmentOutputs.color=result;}\n";
2530
+ t.ShaderStore.ShadersStoreWGSL[gr] || (t.ShaderStore.ShadersStoreWGSL[gr] = vr);
2531
+ var _r = { __proto__: null, multiTextureCompositeAddPixelShaderWGSL: { name: gr, shader: vr } };
2532
+ var Sr = "multiTextureCompositeMultiplyPixelShader", yr = "var uLayers: texture_2d_array<f32>;var uLayersSampler: sampler;uniform uLayerCount: i32;varying vUV: vec2f;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var result: vec4f=vec4f(1.0);for (var i: i32=0; i<MULTITEXTURE_MAXLAYERS; i++) {if (i>=uniforms.uLayerCount) { break; }\nlet s: vec4f=textureSampleLevel(uLayers,uLayersSampler,input.vUV,i,0.0);result=result*s;if (dot(result,vec4f(1.0))==0.0) { break; }}\nfragmentOutputs.color=result;} ";
2533
+ t.ShaderStore.ShadersStoreWGSL[Sr] || (t.ShaderStore.ShadersStoreWGSL[Sr] = yr);
2534
+ var Tr = { __proto__: null, multiTextureCompositeMultiplyPixelShaderWGSL: { name: Sr, shader: yr } };
2535
+ var Ar = "multiTextureCompositeSubtractPixelShader", Lr = "var uLayers: texture_2d_array<f32>;var uLayersSampler: sampler;uniform uLayerCount: i32;varying vUV: vec2f;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var result: vec4f=textureSampleLevel(uLayers,uLayersSampler,input.vUV,0,0.0);for (var i: i32=1; i<MULTITEXTURE_MAXLAYERS; i++) {if (i>=uniforms.uLayerCount) { break; }\nlet s: vec4f=textureSampleLevel(uLayers,uLayersSampler,input.vUV,i,0.0);result=max(result-s,vec4f(0.0));if (dot(result,vec4f(1.0))==0.0) { break; }}\nfragmentOutputs.color=result;}\n";
2536
+ t.ShaderStore.ShadersStoreWGSL[Ar] || (t.ShaderStore.ShadersStoreWGSL[Ar] = Lr);
2537
+ var Pr = { __proto__: null, multiTextureCompositeSubtractPixelShaderWGSL: { name: Ar, shader: Lr } };
2538
+ var Er = "multiTextureCompositeScreenPixelShader", Rr = "var uLayers: texture_2d_array<f32>;var uLayersSampler: sampler;uniform uLayerCount: i32;varying vUV: vec2f;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var result: vec4f=vec4f(0.0);for (var i: i32=0; i<MULTITEXTURE_MAXLAYERS; i++) {if (i>=uniforms.uLayerCount) { break; }\nlet s: vec4f=textureSampleLevel(uLayers,uLayersSampler,input.vUV,i,0.0);result=vec4f(1.0)-(vec4f(1.0)-result)*(vec4f(1.0)-s);if (all(result==vec4f(1.0))) { break; }}\nfragmentOutputs.color=result;}\n";
2539
+ t.ShaderStore.ShadersStoreWGSL[Er] || (t.ShaderStore.ShadersStoreWGSL[Er] = Rr);
2540
+ var Cr = { __proto__: null, multiTextureCompositeScreenPixelShaderWGSL: { name: Er, shader: Rr } };
2541
+ var xr = "multiTextureCompositeAlphaBlendPixelShader", Mr = "uniform highp sampler2DArray uLayers;uniform int uLayerCount;varying vec2 vUV;void main() {vec4 result=vec4(0.0);for (int i=0; i<MULTITEXTURE_MAXLAYERS; ++i) {if (i>=uLayerCount) break;vec4 s=texture(uLayers,vec3(vUV,float(i)));\n#ifdef MULTITEXTURE_PREMULTIPLY\nresult=s+result*(1.0-s.a);\n#else\nresult=vec4(s.rgb*s.a,s.a)+result*(1.0-s.a);\n#endif\n}\ngl_FragColor=vec4((result.a>0.0) ? result.rgb/result.a : vec3(0.0),result.a);}\n";
2542
+ t.ShaderStore.ShadersStore[xr] || (t.ShaderStore.ShadersStore[xr] = Mr);
2543
+ var Ir = { __proto__: null, multiTextureCompositeAlphaBlendPixelShader: { name: xr, shader: Mr } };
2544
+ var wr = "multiTextureCompositeAlphaMaxPixelShader", br = "uniform highp sampler2DArray uLayers;uniform int uLayerCount;varying vec2 vUV;void main() {vec4 result=vec4(0.0);for (int i=0; i<MULTITEXTURE_MAXLAYERS; ++i) {if (i>=uLayerCount) break;vec4 s=texture(uLayers,vec3(vUV,float(i)));if (s.a>=result.a) {result=s;}}\ngl_FragColor=result;}\n";
2545
+ t.ShaderStore.ShadersStore[wr] || (t.ShaderStore.ShadersStore[wr] = br);
2546
+ var Or = { __proto__: null, multiTextureCompositeAlphaMaxPixelShader: { name: wr, shader: br } };
2547
+ var Dr = "multiTextureCompositeAddPixelShader", Nr = "uniform highp sampler2DArray uLayers;uniform int uLayerCount;varying vec2 vUV;void main() {vec4 result=vec4(0.0);for (int i=0; i<MULTITEXTURE_MAXLAYERS; ++i) {if (i>=uLayerCount) break;vec4 s=texture(uLayers,vec3(vUV,float(i)));result=min(result+s,vec4(1.0));}\ngl_FragColor=result;}\n";
2548
+ t.ShaderStore.ShadersStore[Dr] || (t.ShaderStore.ShadersStore[Dr] = Nr);
2549
+ var Ur = { __proto__: null, multiTextureCompositeAddPixelShader: { name: Dr, shader: Nr } };
2550
+ var Fr = "multiTextureCompositeMultiplyPixelShader", Vr = "uniform highp sampler2DArray uLayers;uniform int uLayerCount;varying vec2 vUV;void main() {vec4 result=vec4(1.0);for (int i=0; i<MULTITEXTURE_MAXLAYERS; ++i) {if (i>=uLayerCount) break;vec4 s=texture(uLayers,vec3(vUV,float(i)));result=result*s;if (dot(result,vec4(1.0))==0.0) break;}\ngl_FragColor=result;}\n";
2551
+ t.ShaderStore.ShadersStore[Fr] || (t.ShaderStore.ShadersStore[Fr] = Vr);
2552
+ var Gr = { __proto__: null, multiTextureCompositeMultiplyPixelShader: { name: Fr, shader: Vr } };
2553
+ var kr = "multiTextureCompositeSubtractPixelShader", zr = "uniform highp sampler2DArray uLayers;uniform int uLayerCount;varying vec2 vUV;void main() {vec4 result=texture(uLayers,vec3(vUV,0.0));for (int i=1; i<MULTITEXTURE_MAXLAYERS; ++i) {if (i>=uLayerCount) break;vec4 s=texture(uLayers,vec3(vUV,float(i)));result=max(result-s,vec4(0.0));if (dot(result,vec4(1.0))==0.0) break;}\ngl_FragColor=result;}\n";
2554
+ t.ShaderStore.ShadersStore[kr] || (t.ShaderStore.ShadersStore[kr] = zr);
2555
+ var Br = { __proto__: null, multiTextureCompositeSubtractPixelShader: { name: kr, shader: zr } };
2556
+ var Wr = "multiTextureCompositeScreenPixelShader", Hr = "uniform highp sampler2DArray uLayers;uniform int uLayerCount;varying vec2 vUV;void main() {vec4 result=vec4(0.0);for (int i=0; i<MULTITEXTURE_MAXLAYERS; ++i) {if (i>=uLayerCount) break;vec4 s=texture(uLayers,vec3(vUV,float(i)));result=1.0-(1.0-result)*(1.0-s);if (all(equal(result,vec4(1.0)))) break;}\ngl_FragColor=result;}\n";
2557
+ t.ShaderStore.ShadersStore[Wr] || (t.ShaderStore.ShadersStore[Wr] = Hr);
2558
+ var qr = { __proto__: null, multiTextureCompositeScreenPixelShader: { name: Wr, shader: Hr } };
2104
2559
  e.Atmosphere = /** @class */ (function () {
2105
- function Atmosphere(e, i, n, r) {
2560
+ function Atmosphere(e, i, r, n) {
2106
2561
  var _this = this;
2107
- var a, s, o, l, c, d, h, u, m, f, v, S, _, y, T, P, L, R, E, C, x, I;
2108
- this.name = e, this.scene = i, this._directionToLight = t.Vector3.Zero(), this._tempSceneAmbient = new t.Color3, this._additionalDiffuseSkyIrradiance = new t.Color3, this._atmosphereUbo = null, this._minimumMultiScattering = new t.Vector3, this._cameraAtmosphereVariables = new g, this._lightRadianceAtCamera = new t.Vector3, this._linearLightColor = new t.Color3, this._atmosphereUniformBufferAsArray = [], this._effectRenderer = null, this._isEnabled = !0, this._aerialPerspectiveLutHasBeenRendered = !1, this._hasRenderedMultiScatteringLut = !1, this._hasEverRenderedMultiScatteringLut = !1, this._multiScatteringEffectWrapper = null, this._multiScatteringLutRenderTarget = null, this._aerialPerspectiveLutEffectWrapper = null, this._aerialPerspectiveLutEffectRenderer = null, this._aerialPerspectiveLutRenderTarget = null, this._skyViewLutEffectWrapper = null, this._skyViewLutEffectRenderer = null, this._skyViewLutRenderTarget = null, this._aerialPerspectiveCompositorEffectWrapper = null, this._skyCompositorEffectWrapper = null, this._globeAtmosphereCompositorEffectWrapper = null, this._onBeforeCameraRenderObserver = null, this._onBeforeRenderObserver = null, this._onBeforeDrawPhaseObserver = null, this._onAfterRenderingGroupObserver = null, this.uniqueId = B++, this.onAfterUpdateVariablesForCameraObservable = new t.Observable, this.onBeforeLightVariablesUpdateObservable = new t.Observable, this.onBeforeRenderLutsForCameraObservable = new t.Observable, this.onAfterRenderLutsForCameraObservable = new t.Observable, this.depthTexture = null, this.getTransmittedColorToRef = function (e, t, i, n) { return _this._transmittanceLut.getTransmittedColorToRef(e, t, i, n); }, this.getDiffuseSkyIrradianceToRef = function (e, t, i, n, r) { var a, s; return null !== (s = null === (a = _this._diffuseSkyIrradianceLut) || void 0 === a ? void 0 : a.getDiffuseSkyIrradianceToRef(e, t, i, n, r)) && void 0 !== s ? s : (r.r = 0, r.g = 0, r.b = 0, r); }, t.RegisterEngineUniformBuffer(), t.RegisterEnginesExtensionsEngineRenderTarget();
2109
- var w = this._engine = i.getEngine();
2110
- if (!w.isWebGPU && w.version < 2)
2111
- throw new Error("Atmosphere is not supported on WebGL ".concat(w.version, "."));
2112
- if (this._physicalProperties = null !== (a = null == r ? void 0 : r.physicalProperties) && void 0 !== a ? a : new A, this._physicalProperties.onChangedObservable.add(function () { var e; null === (e = _this._transmittanceLut) || void 0 === e || e.markDirty(); }), 1 !== n.length)
2562
+ var a, s, o, l, c, u, h, d, m, f, v, _, S, y, T, L, P, E, R, C, x, M;
2563
+ this.name = e, this.scene = i, this._directionToLight = t.Vector3.Zero(), this._tempSceneAmbient = new t.Color3, this._additionalDiffuseSkyIrradiance = new t.Color3, this._atmosphereUbo = null, this._minimumMultiScattering = new t.Vector3, this._cameraAtmosphereVariables = new g, this._lightRadianceAtCamera = new t.Vector3, this._linearLightColor = new t.Color3, this._atmosphereUniformBufferAsArray = [], this._effectRenderer = null, this._isEnabled = !0, this._aerialPerspectiveLutHasBeenRendered = !1, this._hasRenderedMultiScatteringLut = !1, this._hasEverRenderedMultiScatteringLut = !1, this._multiScatteringEffectWrapper = null, this._multiScatteringLutRenderTarget = null, this._aerialPerspectiveLutEffectWrapper = null, this._aerialPerspectiveLutEffectRenderer = null, this._aerialPerspectiveLutRenderTarget = null, this._skyViewLutEffectWrapper = null, this._skyViewLutEffectRenderer = null, this._skyViewLutRenderTarget = null, this._aerialPerspectiveCompositorEffectWrapper = null, this._skyCompositorEffectWrapper = null, this._globeAtmosphereCompositorEffectWrapper = null, this._onBeforeCameraRenderObserver = null, this._onBeforeRenderObserver = null, this._onBeforeDrawPhaseObserver = null, this._onAfterRenderingGroupObserver = null, this.uniqueId = B++, this.onAfterUpdateVariablesForCameraObservable = new t.Observable, this.onBeforeLightVariablesUpdateObservable = new t.Observable, this.onBeforeRenderLutsForCameraObservable = new t.Observable, this.onAfterRenderLutsForCameraObservable = new t.Observable, this.depthTexture = null, this.getTransmittedColorToRef = function (e, t, i, r) { return _this._transmittanceLut.getTransmittedColorToRef(e, t, i, r); }, this.getDiffuseSkyIrradianceToRef = function (e, t, i, r, n) { var a, s; return null !== (s = null === (a = _this._diffuseSkyIrradianceLut) || void 0 === a ? void 0 : a.getDiffuseSkyIrradianceToRef(e, t, i, r, n)) && void 0 !== s ? s : (n.r = 0, n.g = 0, n.b = 0, n); }, t.RegisterEngineUniformBuffer(), t.RegisterEnginesExtensionsEngineRenderTarget();
2564
+ var I = this._engine = i.getEngine();
2565
+ if (!I.isWebGPU && I.version < 2)
2566
+ throw new Error("Atmosphere is not supported on WebGL ".concat(I.version, "."));
2567
+ if (this._physicalProperties = null !== (a = null == n ? void 0 : n.physicalProperties) && void 0 !== a ? a : new A, this._physicalProperties.onChangedObservable.add(function () { var e; null === (e = _this._transmittanceLut) || void 0 === e || e.markDirty(); }), 1 !== r.length)
2113
2568
  throw new Error("Atmosphere only supports one light source currently.");
2114
- this._lights = n, this.depthTexture = null !== (s = null == r ? void 0 : r.depthTexture) && void 0 !== s ? s : null, this._exposure = null !== (o = null == r ? void 0 : r.exposure) && void 0 !== o ? o : 1, this._isLinearSpaceLight = null !== (l = null == r ? void 0 : r.isLinearSpaceLight) && void 0 !== l && l, this._isLinearSpaceComposition = null !== (c = null == r ? void 0 : r.isLinearSpaceComposition) && void 0 !== c && c, this._applyApproximateTransmittance = null === (d = null == r ? void 0 : r.applyApproximateTransmittance) || void 0 === d || d, this._aerialPerspectiveRadianceBias = null !== (h = null == r ? void 0 : r.aerialPerspectiveRadianceBias) && void 0 !== h ? h : 0, this._aerialPerspectiveTransmittanceScale = null !== (u = null == r ? void 0 : r.aerialPerspectiveTransmittanceScale) && void 0 !== u ? u : 1, this._aerialPerspectiveSaturation = null !== (m = null == r ? void 0 : r.aerialPerspectiveSaturation) && void 0 !== m ? m : 1, this._aerialPerspectiveIntensity = null !== (f = null == r ? void 0 : r.aerialPerspectiveIntensity) && void 0 !== f ? f : 1, this._diffuseSkyIrradianceDesaturationFactor = null !== (v = null == r ? void 0 : r.diffuseSkyIrradianceDesaturationFactor) && void 0 !== v ? v : .5, this._diffuseSkyIrradianceIntensity = null !== (S = null == r ? void 0 : r.diffuseSkyIrradianceIntensity) && void 0 !== S ? S : 1, this._additionalDiffuseSkyIrradianceIntensity = null !== (_ = null == r ? void 0 : r.additionalDiffuseSkyIrradianceIntensity) && void 0 !== _ ? _ : .01, this._multiScatteringIntensity = null !== (y = null == r ? void 0 : r.multiScatteringIntensity) && void 0 !== y ? y : 1, this._minimumMultiScatteringIntensity = null !== (T = null == r ? void 0 : r.minimumMultiScatteringIntensity) && void 0 !== T ? T : 618e-6, this._isSkyViewLutEnabled = null === (P = null == r ? void 0 : r.isSkyViewLutEnabled) || void 0 === P || P, this._isAerialPerspectiveLutEnabled = null === (L = null == r ? void 0 : r.isAerialPerspectiveLutEnabled) || void 0 === L || L, this._originHeight = null !== (R = null == r ? void 0 : r.originHeight) && void 0 !== R ? R : 0, this._additionalDiffuseSkyIrradianceColor = (null == r ? void 0 : r.additionalDiffuseSkyIrradianceColor) ? (new t.Color3).copyFrom(r.additionalDiffuseSkyIrradianceColor) : new t.Color3(163 / 255, 199 / 255, 1), this._groundAlbedo = (null == r ? void 0 : r.groundAlbedo) ? (new t.Color3).copyFrom(r.groundAlbedo) : (new t.Color3).set(124 / 255, 165 / 255, 1);
2115
- var M = this._minimumMultiScatteringColor = (null == r ? void 0 : r.minimumMultiScatteringColor) ? (new t.Color3).copyFrom(r.minimumMultiScatteringColor) : new t.Color3(30 / 255, 40 / 255, 77 / 255);
2116
- this._skyRenderingGroup = null !== (E = null == r ? void 0 : r.skyRenderingGroup) && void 0 !== E ? E : 0, this._aerialPerspectiveRenderingGroup = null !== (C = null == r ? void 0 : r.aerialPerspectiveRenderingGroup) && void 0 !== C ? C : 0, this._globeAtmosphereRenderingGroup = null !== (x = null == r ? void 0 : r.globeAtmosphereRenderingGroup) && void 0 !== x ? x : 0, this._additionalDiffuseSkyIrradianceColor.scaleToRef(this._additionalDiffuseSkyIrradianceIntensity, this._additionalDiffuseSkyIrradiance), this._minimumMultiScattering.x = M.r * this._minimumMultiScatteringIntensity, this._minimumMultiScattering.y = M.g * this._minimumMultiScatteringIntensity, this._minimumMultiScattering.z = M.b * this._minimumMultiScatteringIntensity;
2569
+ this._lights = r, this.depthTexture = null !== (s = null == n ? void 0 : n.depthTexture) && void 0 !== s ? s : null, this._exposure = null !== (o = null == n ? void 0 : n.exposure) && void 0 !== o ? o : 1, this._isLinearSpaceLight = null !== (l = null == n ? void 0 : n.isLinearSpaceLight) && void 0 !== l && l, this._isLinearSpaceComposition = null !== (c = null == n ? void 0 : n.isLinearSpaceComposition) && void 0 !== c && c, this._applyApproximateTransmittance = null === (u = null == n ? void 0 : n.applyApproximateTransmittance) || void 0 === u || u, this._aerialPerspectiveRadianceBias = null !== (h = null == n ? void 0 : n.aerialPerspectiveRadianceBias) && void 0 !== h ? h : 0, this._aerialPerspectiveTransmittanceScale = null !== (d = null == n ? void 0 : n.aerialPerspectiveTransmittanceScale) && void 0 !== d ? d : 1, this._aerialPerspectiveSaturation = null !== (m = null == n ? void 0 : n.aerialPerspectiveSaturation) && void 0 !== m ? m : 1, this._aerialPerspectiveIntensity = null !== (f = null == n ? void 0 : n.aerialPerspectiveIntensity) && void 0 !== f ? f : 1, this._diffuseSkyIrradianceDesaturationFactor = null !== (v = null == n ? void 0 : n.diffuseSkyIrradianceDesaturationFactor) && void 0 !== v ? v : .5, this._diffuseSkyIrradianceIntensity = null !== (_ = null == n ? void 0 : n.diffuseSkyIrradianceIntensity) && void 0 !== _ ? _ : 1, this._additionalDiffuseSkyIrradianceIntensity = null !== (S = null == n ? void 0 : n.additionalDiffuseSkyIrradianceIntensity) && void 0 !== S ? S : .01, this._multiScatteringIntensity = null !== (y = null == n ? void 0 : n.multiScatteringIntensity) && void 0 !== y ? y : 1, this._minimumMultiScatteringIntensity = null !== (T = null == n ? void 0 : n.minimumMultiScatteringIntensity) && void 0 !== T ? T : 618e-6, this._isSkyViewLutEnabled = null === (L = null == n ? void 0 : n.isSkyViewLutEnabled) || void 0 === L || L, this._isAerialPerspectiveLutEnabled = null === (P = null == n ? void 0 : n.isAerialPerspectiveLutEnabled) || void 0 === P || P, this._originHeight = null !== (E = null == n ? void 0 : n.originHeight) && void 0 !== E ? E : 0, this._additionalDiffuseSkyIrradianceColor = (null == n ? void 0 : n.additionalDiffuseSkyIrradianceColor) ? (new t.Color3).copyFrom(n.additionalDiffuseSkyIrradianceColor) : new t.Color3(163 / 255, 199 / 255, 1), this._groundAlbedo = (null == n ? void 0 : n.groundAlbedo) ? (new t.Color3).copyFrom(n.groundAlbedo) : (new t.Color3).set(124 / 255, 165 / 255, 1);
2570
+ var w = this._minimumMultiScatteringColor = (null == n ? void 0 : n.minimumMultiScatteringColor) ? (new t.Color3).copyFrom(n.minimumMultiScatteringColor) : new t.Color3(30 / 255, 40 / 255, 77 / 255);
2571
+ this._skyRenderingGroup = null !== (R = null == n ? void 0 : n.skyRenderingGroup) && void 0 !== R ? R : 0, this._aerialPerspectiveRenderingGroup = null !== (C = null == n ? void 0 : n.aerialPerspectiveRenderingGroup) && void 0 !== C ? C : 0, this._globeAtmosphereRenderingGroup = null !== (x = null == n ? void 0 : n.globeAtmosphereRenderingGroup) && void 0 !== x ? x : 0, this._additionalDiffuseSkyIrradianceColor.scaleToRef(this._additionalDiffuseSkyIrradianceIntensity, this._additionalDiffuseSkyIrradiance), this._minimumMultiScattering.x = w.r * this._minimumMultiScatteringIntensity, this._minimumMultiScattering.y = w.g * this._minimumMultiScatteringIntensity, this._minimumMultiScattering.z = w.b * this._minimumMultiScatteringIntensity;
2117
2572
  {
2118
- var e_105 = n[0];
2119
- this._directionToLight.copyFrom(e_105.direction).scaleInPlace(-1);
2120
- var t_21 = this._linearLightColor.copyFrom(e_105.diffuse);
2121
- this._isLinearSpaceLight || t_21.toLinearSpaceToRef(t_21);
2122
- var i_16 = e_105.intensity;
2123
- this._lightRadianceAtCamera.set(i_16 * t_21.r, i_16 * t_21.g, i_16 * t_21.b);
2573
+ var e_117 = r[0];
2574
+ this._directionToLight.copyFrom(e_117.direction).scaleInPlace(-1);
2575
+ var t_26 = this._linearLightColor.copyFrom(e_117.diffuse);
2576
+ this._isLinearSpaceLight || t_26.toLinearSpaceToRef(t_26);
2577
+ var i_16 = e_117.intensity;
2578
+ this._lightRadianceAtCamera.set(i_16 * t_26.r, i_16 * t_26.g, i_16 * t_26.b);
2124
2579
  }
2125
- this._effectRenderer = new t.EffectRenderer(w, { indices: [0, 2, 1], positions: [-1, -1, -1, 3, 3, -1] }), this._transmittanceLut = new G(this), this._multiScatteringLutRenderTarget = q("atmo-multiScattering", { width: 32, height: 32 }, i), this._multiScatteringEffectWrapper = W(w, this.uniformBuffer, this._groundAlbedo), this._isDiffuseSkyIrradianceLutEnabled = null === (I = null == r ? void 0 : r.isDiffuseSkyIrradianceLutEnabled) || void 0 === I || I, this._isDiffuseSkyIrradianceLutEnabled && (this._diffuseSkyIrradianceLut = new D(this)), this._isSkyViewLutEnabled && this.skyViewLutRenderTarget, this._isAerialPerspectiveLutEnabled && this.aerialPerspectiveLutRenderTarget, this._onBeforeRenderObserver = i.onBeforeRenderObservable.add(function () { _this.renderGlobalLuts(); }), this._onBeforeCameraRenderObserver = i.onBeforeCameraRenderObservable.add(function (e) { _this._updatePerCameraVariables(e), _this._renderLutsForCamera(e); });
2580
+ this._effectRenderer = new t.EffectRenderer(I, { indices: [0, 2, 1], positions: [-1, -1, -1, 3, 3, -1] }), this._transmittanceLut = new k(this), this._multiScatteringLutRenderTarget = q("atmo-multiScattering", { width: 32, height: 32 }, i), this._multiScatteringEffectWrapper = H(I, this.uniformBuffer, this._groundAlbedo), this._isDiffuseSkyIrradianceLutEnabled = null === (M = null == n ? void 0 : n.isDiffuseSkyIrradianceLutEnabled) || void 0 === M || M, this._isDiffuseSkyIrradianceLutEnabled && (this._diffuseSkyIrradianceLut = new O(this)), this._isSkyViewLutEnabled && this.skyViewLutRenderTarget, this._isAerialPerspectiveLutEnabled && this.aerialPerspectiveLutRenderTarget, this._onBeforeRenderObserver = i.onBeforeRenderObservable.add(function () { _this.renderGlobalLuts(); }), this._onBeforeCameraRenderObserver = i.onBeforeCameraRenderObservable.add(function (e) { _this._updatePerCameraVariables(e), _this._renderLutsForCamera(e); });
2126
2581
  {
2127
- var e_106 = i.renderingManager;
2128
- this._skyRenderingGroup >= 0 && e_106.getRenderingGroup(this._skyRenderingGroup), this._aerialPerspectiveRenderingGroup >= 0 && e_106.getRenderingGroup(this._aerialPerspectiveRenderingGroup), this._globeAtmosphereRenderingGroup >= 0 && e_106.getRenderingGroup(this._globeAtmosphereRenderingGroup), this._onBeforeDrawPhaseObserver = i.onBeforeDrawPhaseObservable.add(function () { _this._skyRenderingGroup >= 0 && (e_106.getRenderingGroup(_this._skyRenderingGroup)._empty = !1), _this._aerialPerspectiveRenderingGroup >= 0 && (e_106.getRenderingGroup(_this._aerialPerspectiveRenderingGroup)._empty = !1), _this._globeAtmosphereRenderingGroup >= 0 && (e_106.getRenderingGroup(_this._globeAtmosphereRenderingGroup)._empty = !1); }), this._onAfterRenderingGroupObserver = i.onAfterRenderingGroupObservable.add(function (e) { if (e.renderingManager !== i.renderingManager)
2582
+ var e_118 = i.renderingManager;
2583
+ this._skyRenderingGroup >= 0 && e_118.getRenderingGroup(this._skyRenderingGroup), this._aerialPerspectiveRenderingGroup >= 0 && e_118.getRenderingGroup(this._aerialPerspectiveRenderingGroup), this._globeAtmosphereRenderingGroup >= 0 && e_118.getRenderingGroup(this._globeAtmosphereRenderingGroup), this._onBeforeDrawPhaseObserver = i.onBeforeDrawPhaseObservable.add(function () { _this._skyRenderingGroup >= 0 && (e_118.getRenderingGroup(_this._skyRenderingGroup)._empty = !1), _this._aerialPerspectiveRenderingGroup >= 0 && (e_118.getRenderingGroup(_this._aerialPerspectiveRenderingGroup)._empty = !1), _this._globeAtmosphereRenderingGroup >= 0 && (e_118.getRenderingGroup(_this._globeAtmosphereRenderingGroup)._empty = !1); }), this._onAfterRenderingGroupObserver = i.onAfterRenderingGroupObservable.add(function (e) { if (e.renderingManager !== i.renderingManager)
2129
2584
  return; var t = e.renderingGroupId; _this._skyRenderingGroup === t && _this.drawSkyCompositor(), _this._aerialPerspectiveRenderingGroup === t && _this.drawAerialPerspectiveCompositor(), _this._globeAtmosphereRenderingGroup === t && _this.drawGlobeAtmosphereCompositor(); });
2130
2585
  }
2131
2586
  i.onDisposeObservable.addOnce(function () { i.removeExternalData("atmosphere"), _this.dispose(); }), i.addExternalData("atmosphere", this), t.UnregisterMaterialPlugin(z), t.RegisterMaterialPlugin(z, function (e) { return "PBRMaterial" === e.getClassName() ? new p(e, _this, null === _this.depthTexture) : null; }), this._eagerlyPreloadMaterialPluginShaderIncludesAsync(), i.addIsReadyCheck(this);
@@ -2202,7 +2657,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2202
2657
  Object.defineProperty(Atmosphere.prototype, "skyViewLutRenderTarget", {
2203
2658
  get: function () { if (!this._isSkyViewLutEnabled)
2204
2659
  return null; if (null !== this._skyViewLutRenderTarget)
2205
- return this._skyViewLutRenderTarget; var e = this._skyViewLutRenderTarget = q("atmo-skyView", { width: 128, height: 128 }, this.scene); return e.coordinatesMode = t.Constants.TEXTURE_EQUIRECTANGULAR_MODE, this._skyViewLutEffectWrapper = (function (e, i) { var n = e.isWebGPU && !t.EffectWrapper.ForceGLSL, r = n ? "atmosphere" : i.name; return H(e, "atmo-skyView", "skyView", __spreadArray(["depth"], __read(i.useUbo ? [] : i.getUniformNames()), false), ["transmittanceLut", "multiScatteringLut"], i.useUbo ? [r] : [], ["POSITION_VEC2"], n, function (e, t) { t.push.apply(t, __spreadArray([], __read(n ? [Promise.resolve().then(function () { return Ft; }), Promise.resolve().then(function () { return Ji; })] : [Promise.resolve().then(function () { return qt; }), Promise.resolve().then(function () { return rn; })]), false)); }); })(this._engine, this.uniformBuffer), e; },
2660
+ return this._skyViewLutRenderTarget; var e = this._skyViewLutRenderTarget = q("atmo-skyView", { width: 128, height: 128 }, this.scene); return e.coordinatesMode = t.Constants.TEXTURE_EQUIRECTANGULAR_MODE, this._skyViewLutEffectWrapper = (function (e, i) { var r = e.isWebGPU && !t.EffectWrapper.ForceGLSL, n = r ? "atmosphere" : i.name; return W(e, "atmo-skyView", "skyView", __spreadArray(["depth"], __read(i.useUbo ? [] : i.getUniformNames()), false), ["transmittanceLut", "multiScatteringLut"], i.useUbo ? [n] : [], ["POSITION_VEC2"], r, function (e, t) { t.push.apply(t, __spreadArray([], __read(r ? [Promise.resolve().then(function () { return Wt; }), Promise.resolve().then(function () { return ar; })] : [Promise.resolve().then(function () { return Qt; }), Promise.resolve().then(function () { return cr; })]), false)); }); })(this._engine, this.uniformBuffer), e; },
2206
2661
  enumerable: false,
2207
2662
  configurable: true
2208
2663
  });
@@ -2215,15 +2670,15 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2215
2670
  Object.defineProperty(Atmosphere.prototype, "aerialPerspectiveLutRenderTarget", {
2216
2671
  get: function () { if (!this._isAerialPerspectiveLutEnabled)
2217
2672
  return null; if (null !== this._aerialPerspectiveLutRenderTarget)
2218
- return this._aerialPerspectiveLutRenderTarget; var e = this.scene, i = this._aerialPerspectiveLutRenderTarget = q("atmo-aerialPerspective", { width: 16, height: 64, layers: 32 }, e, {}); return this._aerialPerspectiveLutEffectWrapper = (function (e, i) { var n = e.isWebGPU && !t.EffectWrapper.ForceGLSL, r = n ? "atmosphere" : i.name; return H(e, "atmo-aerialPerspective", "aerialPerspective", __spreadArray(["layerIdx"], __read(i.useUbo ? [] : i.getUniformNames()), false), ["transmittanceLut", "multiScatteringLut"], i.useUbo ? [r] : [], ["POSITION_VEC2", "COMPUTE_WORLD_RAY"], n, function (e, t) { t.push.apply(t, __spreadArray([], __read(n ? [Promise.resolve().then(function () { return Ft; }), Promise.resolve().then(function () { return Pi; })] : [Promise.resolve().then(function () { return qt; }), Promise.resolve().then(function () { return Ci; })]), false)); }); })(this._engine, this.uniformBuffer), i; },
2673
+ return this._aerialPerspectiveLutRenderTarget; var e = this.scene, i = this._aerialPerspectiveLutRenderTarget = q("atmo-aerialPerspective", { width: 16, height: 64, layers: 32 }, e, {}); return this._aerialPerspectiveLutEffectWrapper = (function (e, i) { var r = e.isWebGPU && !t.EffectWrapper.ForceGLSL, n = r ? "atmosphere" : i.name; return W(e, "atmo-aerialPerspective", "aerialPerspective", __spreadArray(["layerIdx"], __read(i.useUbo ? [] : i.getUniformNames()), false), ["transmittanceLut", "multiScatteringLut"], i.useUbo ? [n] : [], ["POSITION_VEC2", "COMPUTE_WORLD_RAY"], r, function (e, t) { t.push.apply(t, __spreadArray([], __read(r ? [Promise.resolve().then(function () { return Wt; }), Promise.resolve().then(function () { return Mi; })] : [Promise.resolve().then(function () { return Qt; }), Promise.resolve().then(function () { return Oi; })]), false)); }); })(this._engine, this.uniformBuffer), i; },
2219
2674
  enumerable: false,
2220
2675
  configurable: true
2221
2676
  });
2222
2677
  Object.defineProperty(Atmosphere.prototype, "aerialPerspectiveIntensity", {
2223
2678
  get: function () { return this._aerialPerspectiveIntensity; },
2224
2679
  set: function (e) { if ((e = Math.max(.001, e)) !== this._aerialPerspectiveIntensity) {
2225
- var t_22 = 1 === e != (1 === this._aerialPerspectiveIntensity);
2226
- this._aerialPerspectiveIntensity = e, t_22 && (this._disposeAerialPerspectiveCompositor(), this._disposeGlobeAtmosphereCompositor());
2680
+ var t_27 = 1 === e != (1 === this._aerialPerspectiveIntensity);
2681
+ this._aerialPerspectiveIntensity = e, t_27 && (this._disposeAerialPerspectiveCompositor(), this._disposeGlobeAtmosphereCompositor());
2227
2682
  } },
2228
2683
  enumerable: false,
2229
2684
  configurable: true
@@ -2243,8 +2698,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2243
2698
  Object.defineProperty(Atmosphere.prototype, "aerialPerspectiveRadianceBias", {
2244
2699
  get: function () { return this._aerialPerspectiveRadianceBias; },
2245
2700
  set: function (e) { if (e !== this._aerialPerspectiveRadianceBias) {
2246
- var t_23 = 0 === e != (0 === this._aerialPerspectiveRadianceBias);
2247
- this._aerialPerspectiveRadianceBias = e, t_23 && (this._disposeAerialPerspectiveCompositor(), this._disposeGlobeAtmosphereCompositor());
2701
+ var t_28 = 0 === e != (0 === this._aerialPerspectiveRadianceBias);
2702
+ this._aerialPerspectiveRadianceBias = e, t_28 && (this._disposeAerialPerspectiveCompositor(), this._disposeGlobeAtmosphereCompositor());
2248
2703
  } },
2249
2704
  enumerable: false,
2250
2705
  configurable: true
@@ -2318,8 +2773,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2318
2773
  });
2319
2774
  Object.defineProperty(Atmosphere.prototype, "uniformBuffer", {
2320
2775
  get: function () { if (null === this._atmosphereUbo) {
2321
- var e_107 = this._atmosphereUbo = new t.UniformBuffer(this._engine, void 0, !0, "Atmosphere");
2322
- e_107.addUniform("peakRayleighScattering", 3), e_107.addUniform("planetRadius", 1), e_107.addUniform("peakMieScattering", 3), e_107.addUniform("atmosphereThickness", 1), e_107.addUniform("peakMieAbsorption", 3), e_107.addUniform("planetRadiusSquared", 1), e_107.addUniform("peakMieExtinction", 3), e_107.addUniform("atmosphereRadius", 1), e_107.addUniform("peakOzoneAbsorption", 3), e_107.addUniform("atmosphereRadiusSquared", 1), e_107.addUniform("horizonDistanceToAtmosphereEdge", 1), e_107.addUniform("horizonDistanceToAtmosphereEdgeSquared", 1), e_107.addUniform("planetRadiusWithOffset", 1), e_107.addUniform("planetRadiusOffset", 1), e_107.addUniform("atmosphereExposure", 1), e_107.addUniform("aerialPerspectiveRadianceBias", 1), e_107.addUniform("inverseAtmosphereThickness", 1), e_107.addUniform("aerialPerspectiveTransmittanceScale", 1), e_107.addUniform("inverseViewProjectionWithoutTranslation", 16), e_107.addUniform("directionToLight", 3), e_107.addUniform("multiScatteringIntensity", 1), e_107.addUniform("directionToLightRelativeToCameraGeocentricNormal", 3), e_107.addUniform("cameraRadius", 1), e_107.addUniform("lightRadianceAtCamera", 3), e_107.addUniform("diffuseSkyIrradianceDesaturationFactor", 1), e_107.addUniform("groundAlbedo", 3), e_107.addUniform("aerialPerspectiveSaturation", 1), e_107.addUniform("minMultiScattering", 3), e_107.addUniform("diffuseSkyIrradianceIntensity", 1), e_107.addUniform("cameraPositionGlobal", 3), e_107.addUniform("lightIntensity", 1), e_107.addUniform("clampedCameraPositionGlobal", 3), e_107.addUniform("aerialPerspectiveIntensity", 1), e_107.addUniform("cameraGeocentricNormal", 3), e_107.addUniform("clampedCameraRadius", 1), e_107.addUniform("cameraForward", 3), e_107.addUniform("clampedCameraHeight", 1), e_107.addUniform("cameraPosition", 3), e_107.addUniform("cosCameraHorizonAngleFromZenith", 1), e_107.addUniform("viewport", 4), e_107.addUniform("additionalDiffuseSkyIrradiance", 3), e_107.addUniform("cameraHeight", 1), e_107.addUniform("cameraNearPlane", 1), e_107.addUniform("originHeight", 1), e_107.addUniform("sinCameraAtmosphereHorizonAngleFromNadir", 1), e_107.addUniform("transmittanceSampleCount", 1), e_107.addUniform("skyViewLutSampleCount", 1), e_107.addUniform("multiScatteringLutSampleCount", 1), e_107.addUniform("multiScatteringAzimuthSampleCount", 1), e_107.addUniform("multiScatteringInclinationSampleCount", 1), e_107.addUniform("diffuseSkyIrradianceLutSampleCount", 1), e_107.create();
2776
+ var e_119 = this._atmosphereUbo = new t.UniformBuffer(this._engine, void 0, !0, "Atmosphere");
2777
+ e_119.addUniform("peakRayleighScattering", 3), e_119.addUniform("planetRadius", 1), e_119.addUniform("peakMieScattering", 3), e_119.addUniform("atmosphereThickness", 1), e_119.addUniform("peakMieAbsorption", 3), e_119.addUniform("planetRadiusSquared", 1), e_119.addUniform("peakMieExtinction", 3), e_119.addUniform("atmosphereRadius", 1), e_119.addUniform("peakOzoneAbsorption", 3), e_119.addUniform("atmosphereRadiusSquared", 1), e_119.addUniform("horizonDistanceToAtmosphereEdge", 1), e_119.addUniform("horizonDistanceToAtmosphereEdgeSquared", 1), e_119.addUniform("planetRadiusWithOffset", 1), e_119.addUniform("planetRadiusOffset", 1), e_119.addUniform("atmosphereExposure", 1), e_119.addUniform("aerialPerspectiveRadianceBias", 1), e_119.addUniform("inverseAtmosphereThickness", 1), e_119.addUniform("aerialPerspectiveTransmittanceScale", 1), e_119.addUniform("inverseViewProjectionWithoutTranslation", 16), e_119.addUniform("directionToLight", 3), e_119.addUniform("multiScatteringIntensity", 1), e_119.addUniform("directionToLightRelativeToCameraGeocentricNormal", 3), e_119.addUniform("cameraRadius", 1), e_119.addUniform("lightRadianceAtCamera", 3), e_119.addUniform("diffuseSkyIrradianceDesaturationFactor", 1), e_119.addUniform("groundAlbedo", 3), e_119.addUniform("aerialPerspectiveSaturation", 1), e_119.addUniform("minMultiScattering", 3), e_119.addUniform("diffuseSkyIrradianceIntensity", 1), e_119.addUniform("cameraPositionGlobal", 3), e_119.addUniform("lightIntensity", 1), e_119.addUniform("clampedCameraPositionGlobal", 3), e_119.addUniform("aerialPerspectiveIntensity", 1), e_119.addUniform("cameraGeocentricNormal", 3), e_119.addUniform("clampedCameraRadius", 1), e_119.addUniform("cameraForward", 3), e_119.addUniform("clampedCameraHeight", 1), e_119.addUniform("cameraPosition", 3), e_119.addUniform("cosCameraHorizonAngleFromZenith", 1), e_119.addUniform("viewport", 4), e_119.addUniform("additionalDiffuseSkyIrradiance", 3), e_119.addUniform("cameraHeight", 1), e_119.addUniform("cameraNearPlane", 1), e_119.addUniform("originHeight", 1), e_119.addUniform("sinCameraAtmosphereHorizonAngleFromNadir", 1), e_119.addUniform("transmittanceSampleCount", 1), e_119.addUniform("skyViewLutSampleCount", 1), e_119.addUniform("multiScatteringLutSampleCount", 1), e_119.addUniform("multiScatteringAzimuthSampleCount", 1), e_119.addUniform("multiScatteringInclinationSampleCount", 1), e_119.addUniform("diffuseSkyIrradianceLutSampleCount", 1), e_119.create();
2323
2778
  } return this._atmosphereUbo; },
2324
2779
  enumerable: false,
2325
2780
  configurable: true
@@ -2329,7 +2784,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2329
2784
  enumerable: false,
2330
2785
  configurable: true
2331
2786
  });
2332
- Atmosphere.prototype._eagerlyPreloadMaterialPluginShaderIncludesAsync = function () { return i(this, void 0, void 0, function () { var e_108; return __generator(this, function (_a) {
2787
+ Atmosphere.prototype._eagerlyPreloadMaterialPluginShaderIncludesAsync = function () { return i(this, void 0, void 0, function () { var e_120; return __generator(this, function (_a) {
2333
2788
  switch (_a.label) {
2334
2789
  case 0:
2335
2790
  _a.trys.push([0, 2, , 3]);
@@ -2338,7 +2793,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2338
2793
  _a.sent();
2339
2794
  return [3 /*break*/, 3];
2340
2795
  case 2:
2341
- e_108 = _a.sent();
2796
+ e_120 = _a.sent();
2342
2797
  return [3 /*break*/, 3];
2343
2798
  case 3: return [2 /*return*/];
2344
2799
  }
@@ -2353,31 +2808,31 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2353
2808
  return [2 /*return*/];
2354
2809
  }
2355
2810
  }); }); };
2356
- Atmosphere.prototype.dispose = function () { var e, i, n, r, a, s, o, l, c, d, h, u, m, p, f, g, v, S, _; this.scene.removeIsReadyCheck(this), null === (e = this._onBeforeCameraRenderObserver) || void 0 === e || e.remove(), this._onBeforeCameraRenderObserver = null, null === (i = this._onBeforeDrawPhaseObserver) || void 0 === i || i.remove(), this._onBeforeDrawPhaseObserver = null, null === (n = this._onAfterRenderingGroupObserver) || void 0 === n || n.remove(), this._onAfterRenderingGroupObserver = null, null === (r = this._onBeforeRenderObserver) || void 0 === r || r.remove(), this._onBeforeRenderObserver = null, null === (a = this._globeAtmosphereCompositorEffectWrapper) || void 0 === a || a.dispose(), this._globeAtmosphereCompositorEffectWrapper = null, null === (s = this._skyCompositorEffectWrapper) || void 0 === s || s.dispose(), this._skyCompositorEffectWrapper = null, null === (o = this._aerialPerspectiveCompositorEffectWrapper) || void 0 === o || o.dispose(), this._aerialPerspectiveCompositorEffectWrapper = null, null === (l = this._skyViewLutRenderTarget) || void 0 === l || l.dispose(), this._skyViewLutRenderTarget = null, null === (c = this._skyViewLutEffectWrapper) || void 0 === c || c.dispose(), this._skyViewLutEffectWrapper = null, null === (d = this._skyViewLutEffectRenderer) || void 0 === d || d.dispose(), this._skyViewLutEffectRenderer = null, null === (h = this._aerialPerspectiveLutRenderTarget) || void 0 === h || h.dispose(), this._aerialPerspectiveLutRenderTarget = null, null === (u = this._aerialPerspectiveLutEffectWrapper) || void 0 === u || u.dispose(), this._aerialPerspectiveLutEffectWrapper = null, null === (m = this._aerialPerspectiveLutEffectRenderer) || void 0 === m || m.dispose(), this._aerialPerspectiveLutEffectRenderer = null, null === (p = this._multiScatteringEffectWrapper) || void 0 === p || p.dispose(), this._multiScatteringEffectWrapper = null, null === (f = this._multiScatteringLutRenderTarget) || void 0 === f || f.dispose(), this._multiScatteringLutRenderTarget = null, null === (g = this._transmittanceLut) || void 0 === g || g.dispose(), this._transmittanceLut = null, null === (v = this._diffuseSkyIrradianceLut) || void 0 === v || v.dispose(), this._diffuseSkyIrradianceLut = null, null === (S = this._atmosphereUbo) || void 0 === S || S.dispose(), this._atmosphereUbo = null, null === (_ = this._effectRenderer) || void 0 === _ || _.dispose(), this._effectRenderer = null, this._atmosphereUniformBufferAsArray.length = 0, t.UnregisterMaterialPlugin(z); };
2811
+ Atmosphere.prototype.dispose = function () { var e, i, r, n, a, s, o, l, c, u, h, d, m, p, f, g, v, _, S; this.scene.removeIsReadyCheck(this), null === (e = this._onBeforeCameraRenderObserver) || void 0 === e || e.remove(), this._onBeforeCameraRenderObserver = null, null === (i = this._onBeforeDrawPhaseObserver) || void 0 === i || i.remove(), this._onBeforeDrawPhaseObserver = null, null === (r = this._onAfterRenderingGroupObserver) || void 0 === r || r.remove(), this._onAfterRenderingGroupObserver = null, null === (n = this._onBeforeRenderObserver) || void 0 === n || n.remove(), this._onBeforeRenderObserver = null, null === (a = this._globeAtmosphereCompositorEffectWrapper) || void 0 === a || a.dispose(), this._globeAtmosphereCompositorEffectWrapper = null, null === (s = this._skyCompositorEffectWrapper) || void 0 === s || s.dispose(), this._skyCompositorEffectWrapper = null, null === (o = this._aerialPerspectiveCompositorEffectWrapper) || void 0 === o || o.dispose(), this._aerialPerspectiveCompositorEffectWrapper = null, null === (l = this._skyViewLutRenderTarget) || void 0 === l || l.dispose(), this._skyViewLutRenderTarget = null, null === (c = this._skyViewLutEffectWrapper) || void 0 === c || c.dispose(), this._skyViewLutEffectWrapper = null, null === (u = this._skyViewLutEffectRenderer) || void 0 === u || u.dispose(), this._skyViewLutEffectRenderer = null, null === (h = this._aerialPerspectiveLutRenderTarget) || void 0 === h || h.dispose(), this._aerialPerspectiveLutRenderTarget = null, null === (d = this._aerialPerspectiveLutEffectWrapper) || void 0 === d || d.dispose(), this._aerialPerspectiveLutEffectWrapper = null, null === (m = this._aerialPerspectiveLutEffectRenderer) || void 0 === m || m.dispose(), this._aerialPerspectiveLutEffectRenderer = null, null === (p = this._multiScatteringEffectWrapper) || void 0 === p || p.dispose(), this._multiScatteringEffectWrapper = null, null === (f = this._multiScatteringLutRenderTarget) || void 0 === f || f.dispose(), this._multiScatteringLutRenderTarget = null, null === (g = this._transmittanceLut) || void 0 === g || g.dispose(), this._transmittanceLut = null, null === (v = this._diffuseSkyIrradianceLut) || void 0 === v || v.dispose(), this._diffuseSkyIrradianceLut = null, null === (_ = this._atmosphereUbo) || void 0 === _ || _.dispose(), this._atmosphereUbo = null, null === (S = this._effectRenderer) || void 0 === S || S.dispose(), this._effectRenderer = null, this._atmosphereUniformBufferAsArray.length = 0, t.UnregisterMaterialPlugin(z); };
2357
2812
  Atmosphere.prototype.isEnabled = function () { return this._isEnabled; };
2358
2813
  Atmosphere.prototype.setEnabled = function (e) { this._isEnabled = e; };
2359
- Atmosphere.prototype.isReady = function () { var e, t, i, n, r, a, s, o, l, c, d, h, u, m, p, f; if (!this._isEnabled)
2360
- return !0; var g = this._engine, v = this.uniformBuffer, S = this._isSkyViewLutEnabled, _ = this._isLinearSpaceComposition, y = this._applyApproximateTransmittance, T = this.depthTexture; return null !== (e = this._skyCompositorEffectWrapper) && void 0 !== e || (this._skyCompositorEffectWrapper = Y(g, v, S, _, y)), null !== (t = this._globeAtmosphereCompositorEffectWrapper) && void 0 !== t || (this._globeAtmosphereCompositorEffectWrapper = j(g, v, S, _, y, this._aerialPerspectiveIntensity, this._aerialPerspectiveRadianceBias, null !== T)), null !== T && (null !== (i = this._aerialPerspectiveCompositorEffectWrapper) && void 0 !== i || (this._aerialPerspectiveCompositorEffectWrapper = $(g, v, this._isAerialPerspectiveLutEnabled, S, _, y, this._aerialPerspectiveIntensity, this._aerialPerspectiveRadianceBias))), null === (n = this._transmittanceLut) || void 0 === n || n.readPixelsAsync(), null === (r = this._diffuseSkyIrradianceLut) || void 0 === r || r.readPixelsAsync(), this.renderGlobalLuts(), !(!(null === (a = this._transmittanceLut) || void 0 === a ? void 0 : a.hasLutData) || this._isDiffuseSkyIrradianceLutEnabled && !(null === (s = this._diffuseSkyIrradianceLut) || void 0 === s ? void 0 : s.hasLutData) || !this._hasRenderedMultiScatteringLut || !1 === (null === (o = this._multiScatteringLutRenderTarget) || void 0 === o ? void 0 : o.isReady()) || !1 === (null === (l = this._multiScatteringEffectWrapper) || void 0 === l ? void 0 : l.isReady()) || this._isSkyViewLutEnabled && (!1 === (null === (c = this._skyViewLutRenderTarget) || void 0 === c ? void 0 : c.isReady()) || !1 === (null === (d = this._skyViewLutEffectWrapper) || void 0 === d ? void 0 : d.isReady())) || this._isAerialPerspectiveLutEnabled && (!1 === (null === (h = this._aerialPerspectiveLutRenderTarget) || void 0 === h ? void 0 : h.isReady()) || !1 === (null === (u = this._aerialPerspectiveLutEffectWrapper) || void 0 === u ? void 0 : u.isReady())) || !1 === (null === (m = this._skyCompositorEffectWrapper) || void 0 === m ? void 0 : m.isReady()) || !1 === (null === (p = this._aerialPerspectiveCompositorEffectWrapper) || void 0 === p ? void 0 : p.isReady()) || !1 === (null === (f = this._globeAtmosphereCompositorEffectWrapper) || void 0 === f ? void 0 : f.isReady())); };
2814
+ Atmosphere.prototype.isReady = function () { var e, t, i, r, n, a, s, o, l, c, u, h, d, m, p, f; if (!this._isEnabled)
2815
+ return !0; var g = this._engine, v = this.uniformBuffer, _ = this._isSkyViewLutEnabled, S = this._isLinearSpaceComposition, y = this._applyApproximateTransmittance, T = this.depthTexture; return null !== (e = this._skyCompositorEffectWrapper) && void 0 !== e || (this._skyCompositorEffectWrapper = $(g, v, _, S, y)), null !== (t = this._globeAtmosphereCompositorEffectWrapper) && void 0 !== t || (this._globeAtmosphereCompositorEffectWrapper = j(g, v, _, S, y, this._aerialPerspectiveIntensity, this._aerialPerspectiveRadianceBias, null !== T)), null !== T && (null !== (i = this._aerialPerspectiveCompositorEffectWrapper) && void 0 !== i || (this._aerialPerspectiveCompositorEffectWrapper = Y(g, v, this._isAerialPerspectiveLutEnabled, _, S, y, this._aerialPerspectiveIntensity, this._aerialPerspectiveRadianceBias))), null === (r = this._transmittanceLut) || void 0 === r || r.readPixelsAsync(), null === (n = this._diffuseSkyIrradianceLut) || void 0 === n || n.readPixelsAsync(), this.renderGlobalLuts(), !(!(null === (a = this._transmittanceLut) || void 0 === a ? void 0 : a.hasLutData) || this._isDiffuseSkyIrradianceLutEnabled && !(null === (s = this._diffuseSkyIrradianceLut) || void 0 === s ? void 0 : s.hasLutData) || !this._hasRenderedMultiScatteringLut || !1 === (null === (o = this._multiScatteringLutRenderTarget) || void 0 === o ? void 0 : o.isReady()) || !1 === (null === (l = this._multiScatteringEffectWrapper) || void 0 === l ? void 0 : l.isReady()) || this._isSkyViewLutEnabled && (!1 === (null === (c = this._skyViewLutRenderTarget) || void 0 === c ? void 0 : c.isReady()) || !1 === (null === (u = this._skyViewLutEffectWrapper) || void 0 === u ? void 0 : u.isReady())) || this._isAerialPerspectiveLutEnabled && (!1 === (null === (h = this._aerialPerspectiveLutRenderTarget) || void 0 === h ? void 0 : h.isReady()) || !1 === (null === (d = this._aerialPerspectiveLutEffectWrapper) || void 0 === d ? void 0 : d.isReady())) || !1 === (null === (m = this._skyCompositorEffectWrapper) || void 0 === m ? void 0 : m.isReady()) || !1 === (null === (p = this._aerialPerspectiveCompositorEffectWrapper) || void 0 === p ? void 0 : p.isReady()) || !1 === (null === (f = this._globeAtmosphereCompositorEffectWrapper) || void 0 === f ? void 0 : f.isReady())); };
2361
2816
  Atmosphere.prototype.getClassName = function () { return "Atmosphere"; };
2362
2817
  Atmosphere.prototype._drawMultiScatteringLut = function () {
2363
2818
  var _this = this;
2364
2819
  var e = this._transmittanceLut.renderTarget;
2365
- Z(this._engine, this._effectRenderer, this._multiScatteringEffectWrapper, this._multiScatteringLutRenderTarget, function (t, i, n, r) { _this.bindUniformBufferToEffect(n), r.bindFramebuffer(i, void 0, void 0, void 0, !0), t.bindBuffers(n), n.setTexture("transmittanceLut", e), t.draw(); });
2820
+ Z(this._engine, this._effectRenderer, this._multiScatteringEffectWrapper, this._multiScatteringLutRenderTarget, function (t, i, r, n) { _this.bindUniformBufferToEffect(r), n.bindFramebuffer(i, void 0, void 0, void 0, !0), t.bindBuffers(r), r.setTexture("transmittanceLut", e), t.draw(); });
2366
2821
  };
2367
2822
  Atmosphere.prototype.drawAerialPerspectiveCompositor = function () {
2368
2823
  var _this = this;
2369
- var e, i, n;
2824
+ var e, i, r;
2370
2825
  if (null === this.depthTexture)
2371
2826
  return;
2372
2827
  if (!this.isEnabled())
2373
2828
  return;
2374
- var r = this._engine, a = null !== (e = this._aerialPerspectiveCompositorEffectWrapper) && void 0 !== e ? e : this._aerialPerspectiveCompositorEffectWrapper = $(r, this.uniformBuffer, this._isAerialPerspectiveLutEnabled, this._isSkyViewLutEnabled, this._isLinearSpaceComposition, this._applyApproximateTransmittance, this._aerialPerspectiveIntensity, this._aerialPerspectiveRadianceBias);
2829
+ var n = this._engine, a = null !== (e = this._aerialPerspectiveCompositorEffectWrapper) && void 0 !== e ? e : this._aerialPerspectiveCompositorEffectWrapper = Y(n, this.uniformBuffer, this._isAerialPerspectiveLutEnabled, this._isSkyViewLutEnabled, this._isLinearSpaceComposition, this._applyApproximateTransmittance, this._aerialPerspectiveIntensity, this._aerialPerspectiveRadianceBias);
2375
2830
  if (!this._isGlobalLutsReady)
2376
2831
  return;
2377
2832
  if (this._cameraAtmosphereVariables.clampedCameraRadius > this._physicalProperties.atmosphereRadius)
2378
2833
  return;
2379
2834
  var s = this._isSkyViewLutEnabled ? this.skyViewLutRenderTarget : null, o = this._multiScatteringLutRenderTarget, l = this._transmittanceLut.renderTarget, c = this._isAerialPerspectiveLutEnabled ? this.aerialPerspectiveLutRenderTarget : null;
2380
- a.isReady() && (null === (i = null == s ? void 0 : s.isReady()) || void 0 === i || i) && o.isReady() && l.isReady() && (null === (n = null == c ? void 0 : c.isReady()) || void 0 === n || n) && this.depthTexture.isReady() && Z(r, this._effectRenderer, a, null, function (e, t, i) { if (null === _this.depthTexture)
2835
+ a.isReady() && (null === (i = null == s ? void 0 : s.isReady()) || void 0 === i || i) && o.isReady() && l.isReady() && (null === (r = null == c ? void 0 : c.isReady()) || void 0 === r || r) && this.depthTexture.isReady() && Z(n, this._effectRenderer, a, null, function (e, t, i) { if (null === _this.depthTexture)
2381
2836
  throw new Error("Depth texture is required for aerial perspective compositor."); _this.bindUniformBufferToEffect(i), e.bindBuffers(i), i.setTexture("transmittanceLut", l), i.setTexture("multiScatteringLut", o), _this._isSkyViewLutEnabled && i.setTexture("skyViewLut", s), _this._isAerialPerspectiveLutEnabled && i.setTexture("aerialPerspectiveLut", c), i.setTexture("depthTexture", _this.depthTexture), e.draw(); }, 1, this.applyApproximateTransmittance ? t.Constants.ALPHA_PREMULTIPLIED_PORTERDUFF : t.Constants.ALPHA_ONEONE, !0, !1, t.Constants.ALWAYS, !1);
2382
2837
  };
2383
2838
  Atmosphere.prototype.drawSkyCompositor = function () {
@@ -2385,7 +2840,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2385
2840
  var e, i;
2386
2841
  if (!this.isEnabled())
2387
2842
  return;
2388
- var n = this._engine, r = null !== (e = this._skyCompositorEffectWrapper) && void 0 !== e ? e : this._skyCompositorEffectWrapper = Y(n, this.uniformBuffer, this._isSkyViewLutEnabled, this._isLinearSpaceComposition, this._applyApproximateTransmittance);
2843
+ var r = this._engine, n = null !== (e = this._skyCompositorEffectWrapper) && void 0 !== e ? e : this._skyCompositorEffectWrapper = $(r, this.uniformBuffer, this._isSkyViewLutEnabled, this._isLinearSpaceComposition, this._applyApproximateTransmittance);
2389
2844
  if (!this._isGlobalLutsReady)
2390
2845
  return;
2391
2846
  if (this._cameraAtmosphereVariables.clampedCameraRadius > this._physicalProperties.atmosphereRadius)
@@ -2393,20 +2848,20 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2393
2848
  if (null !== this.depthTexture && !this.depthTexture.isReady())
2394
2849
  return;
2395
2850
  var a = this._isSkyViewLutEnabled ? this.skyViewLutRenderTarget : null, s = this._multiScatteringLutRenderTarget, o = this._transmittanceLut.renderTarget;
2396
- r.isReady() && (null === (i = null == a ? void 0 : a.isReady()) || void 0 === i || i) && s.isReady() && o.isReady() && Z(n, this._effectRenderer, r, null, function (e, t, i) { _this.bindUniformBufferToEffect(i), e.bindBuffers(i), i.setTexture("multiScatteringLut", s), i.setTexture("transmittanceLut", o), _this._isSkyViewLutEnabled && i.setTexture("skyViewLut", a), e.draw(); }, 1, this._applyApproximateTransmittance ? t.Constants.ALPHA_PREMULTIPLIED_PORTERDUFF : t.Constants.ALPHA_ONEONE, !0, !1, t.Constants.EQUAL, !1);
2851
+ n.isReady() && (null === (i = null == a ? void 0 : a.isReady()) || void 0 === i || i) && s.isReady() && o.isReady() && Z(r, this._effectRenderer, n, null, function (e, t, i) { _this.bindUniformBufferToEffect(i), e.bindBuffers(i), i.setTexture("multiScatteringLut", s), i.setTexture("transmittanceLut", o), _this._isSkyViewLutEnabled && i.setTexture("skyViewLut", a), e.draw(); }, 1, this._applyApproximateTransmittance ? t.Constants.ALPHA_PREMULTIPLIED_PORTERDUFF : t.Constants.ALPHA_ONEONE, !0, !1, t.Constants.EQUAL, !1);
2397
2852
  };
2398
2853
  Atmosphere.prototype.drawGlobeAtmosphereCompositor = function () {
2399
2854
  var _this = this;
2400
2855
  var e, i;
2401
2856
  if (!this.isEnabled())
2402
2857
  return;
2403
- var n = this._engine, r = null !== (e = this._globeAtmosphereCompositorEffectWrapper) && void 0 !== e ? e : this._globeAtmosphereCompositorEffectWrapper = j(n, this.uniformBuffer, this._isSkyViewLutEnabled, this._isLinearSpaceComposition, this._applyApproximateTransmittance, this._aerialPerspectiveIntensity, this._aerialPerspectiveRadianceBias, null !== this.depthTexture);
2858
+ var r = this._engine, n = null !== (e = this._globeAtmosphereCompositorEffectWrapper) && void 0 !== e ? e : this._globeAtmosphereCompositorEffectWrapper = j(r, this.uniformBuffer, this._isSkyViewLutEnabled, this._isLinearSpaceComposition, this._applyApproximateTransmittance, this._aerialPerspectiveIntensity, this._aerialPerspectiveRadianceBias, null !== this.depthTexture);
2404
2859
  if (!this._isGlobalLutsReady)
2405
2860
  return;
2406
2861
  if (!(this._cameraAtmosphereVariables.clampedCameraRadius > this._physicalProperties.atmosphereRadius))
2407
2862
  return;
2408
2863
  var a = this._isSkyViewLutEnabled ? this.skyViewLutRenderTarget : null, s = this._multiScatteringLutRenderTarget, o = this._transmittanceLut.renderTarget;
2409
- r.isReady() && (null === (i = null == a ? void 0 : a.isReady()) || void 0 === i || i) && s.isReady() && o.isReady() && (null === this.depthTexture || this.depthTexture.isReady()) && Z(n, this._effectRenderer, r, null, function (e, t, i) { _this.bindUniformBufferToEffect(i), e.bindBuffers(i), i.setTexture("transmittanceLut", o), i.setTexture("multiScatteringLut", s), _this._isSkyViewLutEnabled && i.setTexture("skyViewLut", a), null !== _this.depthTexture && i.setTexture("depthTexture", _this.depthTexture), e.draw(); }, 1, this._applyApproximateTransmittance ? t.Constants.ALPHA_PREMULTIPLIED_PORTERDUFF : t.Constants.ALPHA_ONEONE, !0, !1, t.Constants.ALWAYS, !1);
2864
+ n.isReady() && (null === (i = null == a ? void 0 : a.isReady()) || void 0 === i || i) && s.isReady() && o.isReady() && (null === this.depthTexture || this.depthTexture.isReady()) && Z(r, this._effectRenderer, n, null, function (e, t, i) { _this.bindUniformBufferToEffect(i), e.bindBuffers(i), i.setTexture("transmittanceLut", o), i.setTexture("multiScatteringLut", s), _this._isSkyViewLutEnabled && i.setTexture("skyViewLut", a), null !== _this.depthTexture && i.setTexture("depthTexture", _this.depthTexture), e.draw(); }, 1, this._applyApproximateTransmittance ? t.Constants.ALPHA_PREMULTIPLIED_PORTERDUFF : t.Constants.ALPHA_ONEONE, !0, !1, t.Constants.ALWAYS, !1);
2410
2865
  };
2411
2866
  Atmosphere.prototype._disposeSkyCompositor = function () { var e; null === (e = this._skyCompositorEffectWrapper) || void 0 === e || e.dispose(), this._skyCompositorEffectWrapper = null; };
2412
2867
  Atmosphere.prototype._disposeAerialPerspectiveCompositor = function () { var e; null === (e = this._aerialPerspectiveCompositorEffectWrapper) || void 0 === e || e.dispose(), this._aerialPerspectiveCompositorEffectWrapper = null; };
@@ -2416,67 +2871,67 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2416
2871
  enumerable: false,
2417
2872
  configurable: true
2418
2873
  });
2419
- Atmosphere.prototype._updatePerCameraVariables = function (e) { var t = this._lights[0], i = this._directionToLight.copyFrom(t.direction).scaleInPlace(-1), n = this._physicalProperties, r = this._cameraAtmosphereVariables; r.update(e, n.planetRadius, n.planetRadiusWithOffset, n.atmosphereRadius, i, this.originHeight), this._transmittanceLut.updateLightParameters(t, r.clampedCameraRadius, r.cameraGeocentricNormal), this._linearLightColor.copyFrom(t.diffuse), this.getDiffuseSkyIrradianceToRef(i, 0, r.cameraGeocentricNormal, t.intensity, this._tempSceneAmbient), this.isLinearSpaceLight || this._tempSceneAmbient.toGammaSpaceToRef(this._tempSceneAmbient), this.scene.ambientColor = this._tempSceneAmbient, this.onAfterUpdateVariablesForCameraObservable.notifyObservers(e); };
2874
+ Atmosphere.prototype._updatePerCameraVariables = function (e) { var t = this._lights[0], i = this._directionToLight.copyFrom(t.direction).scaleInPlace(-1), r = this._physicalProperties, n = this._cameraAtmosphereVariables; n.update(e, r.planetRadius, r.planetRadiusWithOffset, r.atmosphereRadius, i, this.originHeight), this._transmittanceLut.updateLightParameters(t, n.clampedCameraRadius, n.cameraGeocentricNormal), this._linearLightColor.copyFrom(t.diffuse), this.getDiffuseSkyIrradianceToRef(i, 0, n.cameraGeocentricNormal, t.intensity, this._tempSceneAmbient), this.isLinearSpaceLight || this._tempSceneAmbient.toGammaSpaceToRef(this._tempSceneAmbient), this.scene.ambientColor = this._tempSceneAmbient, this.onAfterUpdateVariablesForCameraObservable.notifyObservers(e); };
2420
2875
  Atmosphere.prototype._renderLutsForCamera = function (e) { {
2421
2876
  this.onBeforeLightVariablesUpdateObservable.notifyObservers();
2422
- var e_109 = this.lights[0];
2423
- this.isLinearSpaceLight || (e_109.diffuse = e_109.diffuse.toGammaSpaceToRef(e_109.diffuse), e_109.specular = e_109.specular.toGammaSpaceToRef(e_109.specular));
2424
- var t_24 = e_109.intensity;
2425
- this._lightRadianceAtCamera.set(t_24 * this._linearLightColor.r, t_24 * this._linearLightColor.g, t_24 * this._linearLightColor.b);
2877
+ var e_121 = this.lights[0];
2878
+ this.isLinearSpaceLight || (e_121.diffuse = e_121.diffuse.toGammaSpaceToRef(e_121.diffuse), e_121.specular = e_121.specular.toGammaSpaceToRef(e_121.specular));
2879
+ var t_29 = e_121.intensity;
2880
+ this._lightRadianceAtCamera.set(t_29 * this._linearLightColor.r, t_29 * this._linearLightColor.g, t_29 * this._linearLightColor.b);
2426
2881
  } this.uniformBuffer.useUbo && this.updateUniformBuffer(); var t = this.isEnabled(); this.onBeforeRenderLutsForCameraObservable.notifyObservers(e), t && !this._transmittanceLut.isDirty && this._hasRenderedMultiScatteringLut && (this._isSkyViewLutEnabled && this._drawSkyViewLut(), this._isAerialPerspectiveLutEnabled && (this._cameraAtmosphereVariables.clampedCameraRadius <= this._physicalProperties.atmosphereRadius ? this._drawAerialPerspectiveLut() : this._aerialPerspectiveLutHasBeenRendered || this._clearAerialPerspectiveLut(), this._aerialPerspectiveLutHasBeenRendered = !0)), this.onAfterRenderLutsForCameraObservable.notifyObservers(e); };
2427
- Atmosphere.prototype.renderGlobalLuts = function () { var e, t, i, n, r; this.uniformBuffer.useUbo && this.updateUniformBuffer(), this._transmittanceLut.render() && (this._hasRenderedMultiScatteringLut = !1, null === (e = this._diffuseSkyIrradianceLut) || void 0 === e || e.markDirty()), this._transmittanceLut.isDirty || this._hasRenderedMultiScatteringLut || (null !== (t = this._multiScatteringEffectWrapper) && void 0 !== t || (this._multiScatteringEffectWrapper = W(this._engine, this.uniformBuffer, this._groundAlbedo)), (null === (i = this._multiScatteringEffectWrapper) || void 0 === i ? void 0 : i.isReady()) && (null === (n = this._multiScatteringLutRenderTarget) || void 0 === n ? void 0 : n.isReady()) && (this._drawMultiScatteringLut(), this._hasRenderedMultiScatteringLut = !0, this._hasEverRenderedMultiScatteringLut = !0)), !this._transmittanceLut.isDirty && this._hasRenderedMultiScatteringLut && (null === (r = this._diffuseSkyIrradianceLut) || void 0 === r || r.render()); };
2882
+ Atmosphere.prototype.renderGlobalLuts = function () { var e, t, i, r, n; this.uniformBuffer.useUbo && this.updateUniformBuffer(), this._transmittanceLut.render() && (this._hasRenderedMultiScatteringLut = !1, null === (e = this._diffuseSkyIrradianceLut) || void 0 === e || e.markDirty()), this._transmittanceLut.isDirty || this._hasRenderedMultiScatteringLut || (null !== (t = this._multiScatteringEffectWrapper) && void 0 !== t || (this._multiScatteringEffectWrapper = H(this._engine, this.uniformBuffer, this._groundAlbedo)), (null === (i = this._multiScatteringEffectWrapper) || void 0 === i ? void 0 : i.isReady()) && (null === (r = this._multiScatteringLutRenderTarget) || void 0 === r ? void 0 : r.isReady()) && (this._drawMultiScatteringLut(), this._hasRenderedMultiScatteringLut = !0, this._hasEverRenderedMultiScatteringLut = !0)), !this._transmittanceLut.isDirty && this._hasRenderedMultiScatteringLut && (null === (n = this._diffuseSkyIrradianceLut) || void 0 === n || n.render()); };
2428
2883
  Atmosphere.prototype.bindUniformBufferToEffect = function (e) { var t = this.uniformBuffer, i = 1 === e.shaderLanguage ? "atmosphere" : t.name; t.bindToEffect(e, i), t.useUbo ? t.update() : this.updateUniformBuffer(); };
2429
2884
  Atmosphere.prototype.updateUniformBuffer = function () { var e = this._physicalProperties, t = this._cameraAtmosphereVariables, i = this.uniformBuffer; i.updateVector3("peakRayleighScattering", e.rayleighScattering), i.updateFloat("planetRadius", e.planetRadius), i.updateVector3("peakMieScattering", e.mieScattering), i.updateFloat("atmosphereThickness", e.atmosphereThickness), i.updateVector3("peakMieAbsorption", e.mieAbsorption), i.updateFloat("planetRadiusSquared", e.planetRadiusSquared), i.updateVector3("peakMieExtinction", e.mieExtinction), i.updateFloat("atmosphereRadius", e.atmosphereRadius), i.updateVector3("peakOzoneAbsorption", e.ozoneAbsorption), i.updateFloat("atmosphereRadiusSquared", e.atmosphereRadiusSquared), i.updateFloat("horizonDistanceToAtmosphereEdge", e.horizonDistanceToAtmosphereEdge), i.updateFloat("horizonDistanceToAtmosphereEdgeSquared", e.horizonDistanceToAtmosphereEdgeSquared), i.updateFloat("planetRadiusWithOffset", e.planetRadiusWithOffset), i.updateFloat("planetRadiusOffset", e.planetRadiusOffset), i.updateFloat("aerialPerspectiveRadianceBias", this._aerialPerspectiveRadianceBias), i.updateFloat("inverseAtmosphereThickness", 1 / e.atmosphereThickness), i.updateFloat("aerialPerspectiveTransmittanceScale", this._aerialPerspectiveTransmittanceScale), i.updateMatrix("inverseViewProjectionWithoutTranslation", t.inverseViewProjectionMatrixWithoutTranslation), i.updateVector3("directionToLight", this._directionToLight), i.updateFloat("multiScatteringIntensity", this.multiScatteringIntensity), i.updateVector3("directionToLightRelativeToCameraGeocentricNormal", t.directionToLightRelativeToCameraGeocentricNormal), i.updateFloat("cameraRadius", t.cameraRadius), i.updateVector3("lightRadianceAtCamera", this._lightRadianceAtCamera), i.updateFloat("diffuseSkyIrradianceDesaturationFactor", this._diffuseSkyIrradianceDesaturationFactor), i.updateColor3("groundAlbedo", this._groundAlbedo), i.updateFloat("aerialPerspectiveSaturation", this._aerialPerspectiveSaturation), i.updateVector3("minMultiScattering", this._minimumMultiScattering), i.updateFloat("diffuseSkyIrradianceIntensity", this._diffuseSkyIrradianceIntensity), i.updateVector3("cameraPositionGlobal", t.cameraPositionGlobal), i.updateFloat("lightIntensity", this.lights[0].getScaledIntensity()), i.updateVector3("clampedCameraPositionGlobal", t.clampedCameraPositionGlobal), i.updateFloat("aerialPerspectiveIntensity", this._aerialPerspectiveIntensity), i.updateVector3("cameraGeocentricNormal", t.cameraGeocentricNormal), i.updateFloat("clampedCameraRadius", t.clampedCameraRadius), i.updateVector3("cameraForward", t.cameraForward), i.updateFloat("clampedCameraHeight", t.clampedCameraHeight), i.updateVector3("cameraPosition", t.cameraPosition), i.updateFloat("cosCameraHorizonAngleFromZenith", t.cosCameraHorizonAngleFromZenith), i.updateVector4("viewport", t.viewport), i.updateColor3("additionalDiffuseSkyIrradiance", this._additionalDiffuseSkyIrradiance), i.updateFloat("cameraHeight", t.cameraHeight), i.updateFloat("cameraNearPlane", t.cameraNearPlane), i.updateFloat("originHeight", this._originHeight), i.updateFloat("sinCameraAtmosphereHorizonAngleFromNadir", t.sinCameraAtmosphereHorizonAngleFromNadir), i.updateFloat("transmittanceSampleCount", 128), i.updateFloat("skyViewLutSampleCount", 30), i.updateFloat("multiScatteringLutSampleCount", 64), i.updateFloat("multiScatteringAzimuthSampleCount", 16), i.updateFloat("multiScatteringInclinationSampleCount", 8), i.updateFloat("diffuseSkyIrradianceLutSampleCount", 32), i.updateFloat("atmosphereExposure", this._exposure); };
2430
2885
  Atmosphere.prototype._drawAerialPerspectiveLut = function () {
2431
2886
  var _this = this;
2432
2887
  var e = this._transmittanceLut.renderTarget, t = this._multiScatteringLutRenderTarget;
2433
- Z(this._engine, this._effectRenderer, this._aerialPerspectiveLutEffectWrapper, this._aerialPerspectiveLutRenderTarget, function (i, n, r, a) { _this.bindUniformBufferToEffect(r), r.setTexture("transmittanceLut", e), r.setTexture("multiScatteringLut", t); for (var e_110 = 0; e_110 < 32; e_110++)
2434
- a.bindFramebuffer(n, void 0, void 0, void 0, !0, void 0, e_110), i.bindBuffers(r), r.setFloat("layerIdx", e_110), i.draw(); });
2888
+ Z(this._engine, this._effectRenderer, this._aerialPerspectiveLutEffectWrapper, this._aerialPerspectiveLutRenderTarget, function (i, r, n, a) { _this.bindUniformBufferToEffect(n), n.setTexture("transmittanceLut", e), n.setTexture("multiScatteringLut", t); for (var e_122 = 0; e_122 < 32; e_122++)
2889
+ a.bindFramebuffer(r, void 0, void 0, void 0, !0, void 0, e_122), i.bindBuffers(n), n.setFloat("layerIdx", e_122), i.draw(); });
2435
2890
  };
2436
2891
  Atmosphere.prototype._clearAerialPerspectiveLut = function () { var e; var t = null === (e = this._aerialPerspectiveLutRenderTarget) || void 0 === e ? void 0 : e.renderTarget; if (t) {
2437
- var e_111 = this._engine, i_18 = { r: 0, g: 0, b: 0, a: 0 };
2438
- for (var n_12 = 0; n_12 < 32; n_12++)
2439
- e_111.bindFramebuffer(t, void 0, void 0, void 0, !0, void 0, n_12), e_111.clear(i_18, !0, !1, !1);
2892
+ var e_123 = this._engine, i_18 = { r: 0, g: 0, b: 0, a: 0 };
2893
+ for (var r_15 = 0; r_15 < 32; r_15++)
2894
+ e_123.bindFramebuffer(t, void 0, void 0, void 0, !0, void 0, r_15), e_123.clear(i_18, !0, !1, !1);
2440
2895
  } };
2441
2896
  Atmosphere.prototype._drawSkyViewLut = function () {
2442
2897
  var _this = this;
2443
2898
  var e = this._transmittanceLut.renderTarget, t = this._multiScatteringLutRenderTarget;
2444
- Z(this._engine, this._effectRenderer, this._skyViewLutEffectWrapper, this._skyViewLutRenderTarget, function (i, n, r, a) { _this.bindUniformBufferToEffect(r), a.bindFramebuffer(n, void 0, void 0, void 0, !0), i.bindBuffers(r), r.setTexture("transmittanceLut", e), r.setTexture("multiScatteringLut", t), i.draw(); });
2899
+ Z(this._engine, this._effectRenderer, this._skyViewLutEffectWrapper, this._skyViewLutRenderTarget, function (i, r, n, a) { _this.bindUniformBufferToEffect(n), a.bindFramebuffer(r, void 0, void 0, void 0, !0), i.bindBuffers(n), n.setTexture("transmittanceLut", e), n.setTexture("multiScatteringLut", t), i.draw(); });
2445
2900
  };
2446
2901
  return Atmosphere;
2447
- }()), e.AtmospherePhysicalProperties = A, e.BuildFromNavmeshData = function (e) { var t = Ge(), i = t.importNavMesh(e); if (!i.navMesh)
2448
- throw new Error("Unable to deserialize NavMesh."); return { navMesh: i.navMesh, navMeshQuery: new t.NavMeshQuery(i.navMesh), tileCache: void 0 }; }, e.BuildFromTileCacheData = function (e, t) { var i = Ge(), n = i.importTileCache(e, t); if (!n.tileCache)
2449
- throw new Error("Unable to deserialize TileCache."); return { navMesh: n.navMesh, navMeshQuery: new i.NavMeshQuery(n.navMesh), tileCache: n.tileCache }; }, e.ComputeSmoothPath = et, e.ConvertNavPathPoints = Ke, e.CreateDebugNavMesh = ot, e.CreateDefaultTileCacheMeshProcess = He, e.CreateNavigationPluginAsync = function (e) { return i(this, void 0, void 0, function () { var n; return __generator(this, function (_a) {
2902
+ }()), e.AtmospherePhysicalProperties = A, e.BuildFromNavmeshData = function (e) { var t = Ze(), i = t.importNavMesh(e); if (!i.navMesh)
2903
+ throw new Error("Unable to deserialize NavMesh."); return { navMesh: i.navMesh, navMeshQuery: new t.NavMeshQuery(i.navMesh), tileCache: void 0 }; }, e.BuildFromTileCacheData = function (e, t) { var i = Ze(), r = i.importTileCache(e, t); if (!r.tileCache)
2904
+ throw new Error("Unable to deserialize TileCache."); return { navMesh: r.navMesh, navMeshQuery: new i.NavMeshQuery(r.navMesh), tileCache: r.tileCache }; }, e.ComputeSmoothPath = st, e.ConvertNavPathPoints = rt, e.CreateDebugNavMesh = mt, e.CreateDefaultTileCacheMeshProcess = je, e.CreateNavigationPluginAsync = function (e) { return i(this, void 0, void 0, function () { var r; return __generator(this, function (_a) {
2450
2905
  switch (_a.label) {
2451
- case 0: return [4 /*yield*/, function (e) { return i(this, void 0, void 0, function () { var n, r, a, e_112; return __generator(this, function (_a) {
2906
+ case 0: return [4 /*yield*/, function (e) { return i(this, void 0, void 0, function () { var r, n, a, e_124; return __generator(this, function (_a) {
2452
2907
  switch (_a.label) {
2453
2908
  case 0:
2454
- r = null !== (n = null == e ? void 0 : e.version) && void 0 !== n ? n : "0.43.0", a = Object.assign({ url: "https://unpkg.com/@recast-navigation", version: r }, e);
2455
- if (!!ze) return [3 /*break*/, 6];
2456
- if (!Be) return [3 /*break*/, 2];
2457
- return [4 /*yield*/, Be];
2909
+ n = null !== (r = null == e ? void 0 : e.version) && void 0 !== r ? r : "0.43.0", a = Object.assign({ url: "https://unpkg.com/@recast-navigation", version: n }, e);
2910
+ if (!!$e) return [3 /*break*/, 6];
2911
+ if (!Ye) return [3 /*break*/, 2];
2912
+ return [4 /*yield*/, Ye];
2458
2913
  case 1:
2459
2914
  _a.sent();
2460
2915
  return [3 /*break*/, 6];
2461
2916
  case 2:
2462
2917
  if (!a.instance) return [3 /*break*/, 3];
2463
- ze = a.instance;
2918
+ $e = a.instance;
2464
2919
  return [3 /*break*/, 6];
2465
2920
  case 3:
2466
- Be = function (e, n) { return i(this, void 0, void 0, function () { var i, r; return __generator(this, function (_a) {
2921
+ Ye = function (e, r) { return i(this, void 0, void 0, function () { var i, n; return __generator(this, function (_a) {
2467
2922
  switch (_a.label) {
2468
2923
  case 0:
2469
- i = { imports: { "@recast-navigation/core": "".concat(e, "/core@").concat(n, "/dist/index.mjs"), "@recast-navigation/wasm": "".concat(e, "/wasm@").concat(n, "/dist/recast-navigation.wasm-compat.js"), "@recast-navigation/generators": "".concat(e, "/generators@").concat(n, "/dist/index.mjs") } }, r = document.createElement("script");
2470
- r.type = "importmap", r.textContent = JSON.stringify(i), document.body.appendChild(r);
2471
- return [4 /*yield*/, t._LoadScriptModuleAsync("\n import * as CoreModule from '".concat(e, "/core@").concat(n, "/dist/index.mjs';\n import * as GeneratorsModule from '").concat(e, "/generators@").concat(n, "/dist/index.mjs';\n const returnedValue = {core: CoreModule, generators: GeneratorsModule};\n "))];
2924
+ i = { imports: { "@recast-navigation/core": "".concat(e, "/core@").concat(r, "/dist/index.mjs"), "@recast-navigation/wasm": "".concat(e, "/wasm@").concat(r, "/dist/recast-navigation.wasm-compat.js"), "@recast-navigation/generators": "".concat(e, "/generators@").concat(r, "/dist/index.mjs") } }, n = document.createElement("script");
2925
+ n.type = "importmap", n.textContent = JSON.stringify(i), document.body.appendChild(n);
2926
+ return [4 /*yield*/, t._LoadScriptModuleAsync("\n import * as CoreModule from '".concat(e, "/core@").concat(r, "/dist/index.mjs';\n import * as GeneratorsModule from '").concat(e, "/generators@").concat(r, "/dist/index.mjs';\n const returnedValue = {core: CoreModule, generators: GeneratorsModule};\n "))];
2472
2927
  case 1: return [2 /*return*/, _a.sent()];
2473
2928
  }
2474
2929
  }); }); }(a.url, a.version);
2475
- return [4 /*yield*/, Be];
2930
+ return [4 /*yield*/, Ye];
2476
2931
  case 4:
2477
- e_112 = _a.sent();
2478
- ze = Object.assign(Object.assign({}, e_112.core), e_112.generators);
2479
- return [4 /*yield*/, ze.init()];
2932
+ e_124 = _a.sent();
2933
+ $e = Object.assign(Object.assign({}, e_124.core), e_124.generators);
2934
+ return [4 /*yield*/, $e.init()];
2480
2935
  case 5:
2481
2936
  _a.sent();
2482
2937
  _a.label = 6;
@@ -2485,28 +2940,28 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2485
2940
  }); }); }(e)];
2486
2941
  case 1:
2487
2942
  _a.sent();
2488
- n = new dt(Ge());
2489
- return [2 /*return*/, (ct(n), n)];
2943
+ r = new gt(Ze());
2944
+ return [2 /*return*/, (ft(r), r)];
2490
2945
  }
2491
- }); }); }, e.CreateSoloNavMeshConfig = qe, e.CreateTileCacheNavMeshConfig = Ye, e.CreateTiledNavMeshConfig = Ze, e.DebugLayerOption = ut, e.DefaultMaxObstacles = 128, e.DefaultParagraphOptions = Te, e.DiffuseSkyIrradianceLut = D, e.FitStrategy = Se, e.FontAsset = /** @class */ (function () {
2492
- function FontAsset(e, i, n) {
2946
+ }); }); }, e.CreateSoloNavMeshConfig = Qe, e.CreateTileCacheNavMeshConfig = Je, e.CreateTiledNavMeshConfig = Ke, e.DebugLayerOption = _t, e.DefaultMaxObstacles = 128, e.DefaultParagraphOptions = Te, e.DiffuseSkyIrradianceLut = O, e.FitStrategy = _e, e.FontAsset = /** @class */ (function () {
2947
+ function FontAsset(e, i, r) {
2493
2948
  var _this = this;
2494
- this._chars = new Map, this._kernings = new Map, this._font = JSON.parse(e), this._font.pages = [i], this._font.chars.forEach(function (e) { return _this._chars.set(e.id, e); }), this._font.kernings.forEach(function (e) { var t = _this._kernings.get(e.first); t || (t = new Map, _this._kernings.set(e.first, t)), t.set(e.second, e.amount); }), this._charsRegex = new RegExp("[".concat(this._font.chars.map(function (e) { return e.char.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); }).join(""), "]"), "g"), this._updateFallbacks(), this.scale = 1 / this._font.info.size, this.textures = this._font.pages.map(function (e) { var i = new t.Texture(e, n, { noMipmap: !1, invertY: !1 }); return i.anisotropicFilteringLevel = 16, i; });
2949
+ this._chars = new Map, this._kernings = new Map, this._font = JSON.parse(e), this._font.pages = [i], this._font.chars.forEach(function (e) { return _this._chars.set(e.id, e); }), this._font.kernings.forEach(function (e) { var t = _this._kernings.get(e.first); t || (t = new Map, _this._kernings.set(e.first, t)), t.set(e.second, e.amount); }), this._charsRegex = new RegExp("[".concat(this._font.chars.map(function (e) { return e.char.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); }).join(""), "]"), "g"), this._updateFallbacks(), this.scale = 1 / this._font.info.size, this.textures = this._font.pages.map(function (e) { var i = new t.Texture(e, r, { noMipmap: !1, invertY: !1 }); return i.anisotropicFilteringLevel = 16, i; });
2495
2950
  }
2496
2951
  FontAsset.prototype.dispose = function () {
2497
- var e_113, _a;
2952
+ var e_125, _a;
2498
2953
  try {
2499
2954
  for (var _b = __values(this.textures), _c = _b.next(); !_c.done; _c = _b.next()) {
2500
- var e_114 = _c.value;
2501
- e_114.dispose();
2955
+ var e_126 = _c.value;
2956
+ e_126.dispose();
2502
2957
  }
2503
2958
  }
2504
- catch (e_113_1) { e_113 = { error: e_113_1 }; }
2959
+ catch (e_125_1) { e_125 = { error: e_125_1 }; }
2505
2960
  finally {
2506
2961
  try {
2507
2962
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2508
2963
  }
2509
- finally { if (e_113) throw e_113.error; }
2964
+ finally { if (e_125) throw e_125.error; }
2510
2965
  }
2511
2966
  this.textures.length = 0;
2512
2967
  };
@@ -2515,19 +2970,19 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2515
2970
  FontAsset.prototype._getKerning = function (e, t) { var i; return (null === (i = this._kernings.get(e)) || void 0 === i ? void 0 : i.get(t)) || 0; };
2516
2971
  FontAsset.prototype._unsupportedChars = function (e) { return e.replace(this._charsRegex, ""); };
2517
2972
  return FontAsset;
2518
- }()), e.GenerateNavMesh = lt, e.GetChaikinSmoothPath = function (e, t) {
2973
+ }()), e.GenerateNavMesh = pt, e.GetChaikinSmoothPath = function (e, t) {
2519
2974
  if (t === void 0) { t = 1; }
2520
2975
  for (var i_19 = 0; i_19 < t; i_19++) {
2521
- var t_25 = [];
2976
+ var t_30 = [];
2522
2977
  for (var i_20 = 0; i_20 < e.length - 1; i_20++) {
2523
- var n_13 = e[i_20], r_14 = e[i_20 + 1];
2524
- t_25.push({ x: .75 * n_13.x + .25 * r_14.x, y: .75 * n_13.y + .25 * r_14.y, z: .75 * n_13.z + .25 * r_14.z }), t_25.push({ x: .25 * n_13.x + .75 * r_14.x, y: .25 * n_13.y + .75 * r_14.y, z: .25 * n_13.z + .75 * r_14.z });
2978
+ var r_16 = e[i_20], n_17 = e[i_20 + 1];
2979
+ t_30.push({ x: .75 * r_16.x + .25 * n_17.x, y: .75 * r_16.y + .25 * n_17.y, z: .75 * r_16.z + .25 * n_17.z }), t_30.push({ x: .25 * r_16.x + .75 * n_17.x, y: .25 * r_16.y + .75 * n_17.y, z: .25 * r_16.z + .75 * n_17.z });
2525
2980
  }
2526
- e[0].x === e[e.length - 1].x && e[0].y === e[e.length - 1].y && e[0].z === e[e.length - 1].z && t_25.push(t_25[0]), e = t_25;
2981
+ e[0].x === e[e.length - 1].x && e[0].y === e[e.length - 1].y && e[0].z === e[e.length - 1].z && t_30.push(t_30[0]), e = t_30;
2527
2982
  }
2528
2983
  return e;
2529
- }, e.GetLShapedPath = function (e) { var i = []; for (var n_14 = 0; n_14 < e.length - 1; n_14++) {
2530
- var r_15 = e[n_14], a_14 = e[n_14 + 1], s_13 = ht(r_15, a_14);
2531
- i.push(r_15, new t.Vector3(s_13.x, a_14.y, s_13.z), a_14);
2532
- } return i; }, e.GetPositionsAndIndices = at, e.GetReversedIndices = st, e.HtmlMesh = _e, e.HtmlMeshRenderer = X, e.InjectGenerators = ct, e.NavigationDebugger = mt, e.PointerEventsCaptureBehavior = ve, e.RecastNavigationJSPluginV2 = dt, e.SdfTextParagraph = Ae, e.TextRenderer = Pe, e.ToCrowdAgentParams = je, e.ToSoloNavMeshGeneratorConfig = $e, e.TransmittanceLut = G, e.WaitForFullTileCacheUpdate = We, e.msdfPixelShader = we, e.msdfPixelShaderWGSL = Ue, e.msdfVertexShader = Ee, e.msdfVertexShaderWGSL = Oe;
2984
+ }, e.GetLShapedPath = function (e) { var i = []; for (var r_17 = 0; r_17 < e.length - 1; r_17++) {
2985
+ var n_18 = e[r_17], a_15 = e[r_17 + 1], s_14 = vt(n_18, a_15);
2986
+ i.push(n_18, new t.Vector3(s_14.x, a_15.y, s_14.z), a_15);
2987
+ } return i; }, e.GetPositionsAndIndices = ht, e.GetReversedIndices = dt, e.HtmlMesh = Se, e.HtmlMeshRenderer = K, e.InjectGenerators = ft, e.MultiTexture = He, e.NavigationDebugger = St, e.PointerEventsCaptureBehavior = ve, e.RecastNavigationJSPluginV2 = gt, e.RegisterMultiTexture = We, e.SdfTextParagraph = Ae, e.TextRenderer = Le, e.ToCrowdAgentParams = tt, e.ToSoloNavMeshGeneratorConfig = et, e.TransmittanceLut = k, e.WaitForFullTileCacheUpdate = Xe, e.msdfPixelShader = Ie, e.msdfPixelShaderWGSL = Ve, e.msdfVertexShader = Re, e.msdfVertexShaderWGSL = De;
2533
2988
  });